diff options
| author | Volpeon <git@volpeon.ink> | 2021-01-08 11:45:30 +0100 |
|---|---|---|
| committer | Volpeon <git@volpeon.ink> | 2021-01-08 11:45:30 +0100 |
| commit | 8f373e6c6d3f9d322041ba4d949c1b0c39ae8ea0 (patch) | |
| tree | 3e4bd8c26b65a073d4580bc9f0076caceb234ce8 /scripts | |
| parent | Optimized CSS for code blocks (diff) | |
| download | volpeon.ink-8f373e6c6d3f9d322041ba4d949c1b0c39ae8ea0.tar.gz volpeon.ink-8f373e6c6d3f9d322041ba4d949c1b0c39ae8ea0.tar.bz2 volpeon.ink-8f373e6c6d3f9d322041ba4d949c1b0c39ae8ea0.zip | |
Added section link to the header in regular pages, improved template structure, improved CSS variable names, keep prefix for specific page items on mobile
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/metadata_filter.lua | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/scripts/metadata_filter.lua b/scripts/metadata_filter.lua index 4abb716..fb7b3c9 100644 --- a/scripts/metadata_filter.lua +++ b/scripts/metadata_filter.lua | |||
| @@ -137,15 +137,23 @@ function resolve_category(categories, category) | |||
| 137 | end | 137 | end |
| 138 | 138 | ||
| 139 | function create_main_menu_state(section, main_menu) | 139 | function create_main_menu_state(section, main_menu) |
| 140 | local active_item = nil | ||
| 141 | |||
| 140 | for i = 1, #main_menu do | 142 | for i = 1, #main_menu do |
| 141 | local item = main_menu[i] | 143 | local item = main_menu[i] |
| 142 | local active = pandoc.utils.stringify(item.id) == section.id | 144 | local active = pandoc.utils.stringify(item.id) == section.id |
| 143 | item.active = pandoc.MetaBool(active) | 145 | item.active = pandoc.MetaBool(active) |
| 146 | if active then | ||
| 147 | active_item = item | ||
| 148 | end | ||
| 144 | end | 149 | end |
| 145 | 150 | ||
| 146 | return main_menu:filter(function(item) | 151 | return pandoc.MetaMap({ |
| 147 | return not item.hidden or item.active | 152 | items = main_menu:filter(function(item) |
| 148 | end) | 153 | return not item.hidden or item.active |
| 154 | end), | ||
| 155 | active = active_item | ||
| 156 | }) | ||
| 149 | end | 157 | end |
| 150 | 158 | ||
| 151 | function organize_subpages(pages) | 159 | function organize_subpages(pages) |
