Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Fachgruppenwebseite Metadaten
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fginfo
Fachgruppenwebseite Metadaten
Commits
8d6914b3
"README.md" did not exist on "1f727d3204be0496609a768c10ef534ca93e3f96"
Commit
8d6914b3
authored
2 years ago
by
Jake
Browse files
Options
Downloads
Patches
Plain Diff
render hidden pages too
parent
9943cdeb
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fgs/generator.py
+26
-9
26 additions, 9 deletions
fgs/generator.py
theme/templates/macros/getters.html
+5
-1
5 additions, 1 deletion
theme/templates/macros/getters.html
with
31 additions
and
10 deletions
fgs/generator.py
+
26
−
9
View file @
8d6914b3
...
...
@@ -12,21 +12,34 @@ class Generator:
pages
=
self
.
factories
[
'
page
'
].
all
()
published_pages
=
[]
hidden_pages
=
[]
for
lang
in
self
.
config
[
'
lang
'
][
'
supported
'
]:
for
slug
,
page
in
pages
[
lang
].
items
():
if
page
.
status
==
"
published
"
:
published_pages
.
append
(
page
)
elif
page
.
status
==
"
hidden
"
:
hidden_pages
.
append
(
page
)
# pages
all_pages
=
{}
# set context.pages from published_pages as a dict of languages containing dicts of slugs
all_published_pages
=
{}
for
lang
in
self
.
config
[
'
lang
'
][
'
supported
'
]:
all_published_pages
[
lang
]
=
{}
for
page
in
published_pages
:
if
page
.
lang
not
in
all_pages
:
all_pages
[
page
.
lang
]
=
{}
if
page
.
slug
in
all_pages
[
page
.
lang
]:
if
page
.
slug
in
all_published_pages
[
page
.
lang
]:
raise
Exception
(
"
duplicate language (
"
,
lang
,
"
) for slug
'"
,
slug
,
"'"
)
all_published_pages
[
page
.
lang
][
page
.
slug
]
=
page
self
.
context
[
'
pages
'
]
=
all_published_pages
# set context.hidden_pages from hidden_pages as a dict of languages containing dicts of slugs
all_hidden_pages
=
{}
for
lang
in
self
.
config
[
'
lang
'
][
'
supported
'
]:
all_hidden_pages
[
lang
]
=
{}
for
page
in
hidden_pages
:
if
page
.
slug
in
all_hidden_pages
[
page
.
lang
]:
raise
Exception
(
"
duplicate language (
"
,
lang
,
"
) for slug
'"
,
slug
,
"'"
)
all_pages
[
page
.
lang
][
page
.
slug
]
=
page
self
.
context
[
'
pages
'
]
=
all_pages
all_
hidden_
pages
[
page
.
lang
][
page
.
slug
]
=
page
self
.
context
[
'
hidden_
pages
'
]
=
all_
hidden_
pages
# pages_modified
pages_modified
=
{}
...
...
@@ -40,7 +53,6 @@ class Generator:
pages_modified
[
lang
]
=
lang_pages
self
.
context
[
'
pages_modified
'
]
=
pages_modified
# TODO hidden pages
# TODO draft pages
# TODO authors
...
...
@@ -88,10 +100,15 @@ class Generator:
writer
.
write_file
(
f
.
link
.
path
,
f
.
rawcontents
,
mode
=
"
wb
"
)
for
lang
in
self
.
config
[
'
lang
'
][
'
supported
'
]:
# all pages
# all
published
pages
for
page
in
self
.
context
[
'
pages
'
][
lang
].
values
():
writer
.
write_template
(
page
.
template
,
page
.
link
.
path
,
lang
,
{
'
page
'
:
page
},
page
.
config
)
# all hidden pages
for
page
in
self
.
context
[
'
hidden_pages
'
][
lang
].
values
():
#print(page.slug)
writer
.
write_template
(
page
.
template
,
page
.
link
.
path
,
lang
,
{
'
page
'
:
page
},
page
.
config
)
# all tags
for
tag
in
self
.
context
[
'
tags
'
][
lang
].
values
():
writer
.
write_template
(
'
tag.html
'
,
tag
.
link
.
path
,
lang
,
{
'
tag
'
:
tag
},
tag
.
config
)
...
...
This diff is collapsed.
Click to expand it.
theme/templates/macros/getters.html
+
5
−
1
View file @
8d6914b3
{%- macro page_by_slug(slug, lang) -%}
{{- caller(pages[lang][slug]) -}}
{%- if slug in pages[lang]-%}
{{- caller(pages[lang][slug]) -}}
{%- elif slug in hidden_pages[lang]-%}
{{- caller(hidden_pages[lang][slug]) -}}
{%- endif -%}
{%- endmacro -%}
{%- macro tag_by_name(name, lang) -%}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment