File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -125,7 +125,7 @@ jobs:
125125 PARENT_SLUG="${SECTION_PARENTS[$SECTION]}"
126126
127127 echo "Converting ${DOC}.md..."
128- pandoc "${DOC}.md" --wrap=none --lua-filter=scripts/fix-internal-links.lua -f markdown -t html5 -o "${SLUG}.html"
128+ pandoc "${DOC}.md" --wrap=none -M section="$SECTION" - -lua-filter=scripts/fix-internal-links.lua -f markdown -t html5 -o "${SLUG}.html"
129129
130130 HTML_CONTENT=$(cat "${SLUG}.html")
131131
Original file line number Diff line number Diff line change 11-- Pandoc Lua filter: rewrite internal .md links for different output targets.
22--
33-- Set the LINK_MODE environment variable (or pandoc metadata) to control behavior:
4- -- "website" (default) → /slug (absolute paths for WordPress)
4+ -- "website" (default) → /governance/<section>/ slug (absolute paths for WordPress)
55-- "html" → slug.html (relative paths for standalone HTML files)
66-- "combined" → #heading-anchor (fragment links within the combined PDF)
77--
1010-- - Standards docs get a "standards-" prefix to avoid slug collisions
1111
1212local mode = os.getenv (" LINK_MODE" ) or " website"
13+ local current_section = os.getenv (" LINK_SECTION" ) or nil
1314
14- -- Read mode from pandoc metadata as fallback
15+ -- Read mode and section from pandoc metadata as fallback
1516function Meta (meta )
1617 if meta [" link-mode" ] then
1718 mode = pandoc .utils .stringify (meta [" link-mode" ])
1819 end
20+ if meta [" section" ] then
21+ current_section = pandoc .utils .stringify (meta [" section" ])
22+ end
1923end
2024
2125function Link (el )
@@ -59,8 +63,13 @@ function Link(el)
5963 el .target = ' #' .. base
6064 end
6165 else
62- -- website mode (default)
63- el .target = ' /' .. base .. anchor
66+ -- website mode (default): /governance/<section>/<slug>
67+ local section = dir or current_section
68+ if section then
69+ el .target = ' /governance/' .. section .. ' /' .. base .. anchor
70+ else
71+ el .target = ' /governance/' .. base .. anchor
72+ end
6473 end
6574
6675 return el
You can’t perform that action at this time.
0 commit comments