Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _functions.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The functions here go between the sets defined on the [Sets](sets.qmd) page.

:::

## Functions
[]{#functions}

{{< include mds/_subfiles/functions/_def-function.qmd >}}

Expand Down
9 changes: 8 additions & 1 deletion _sets-functions.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@ include mds/_sets-functions.qmd keep rendering. It includes the three fragments
replaced it, one after another. Each fragment includes the macros and opens with its own
introduction, so in a host page each introduction follows the previous fragment's last
section and links to pages (sets.qmd and the others) that the host may not have. No host
site includes this shim today; new host pages should include the three fragments directly. -->
site includes this shim today; new host pages should include the three fragments directly.
The sets and functions fragments no longer open with a section heading,
so a host page that includes them writes its own Sets and Functions headings;
the shim writes them here, with ids that differ from the fragments' own anchors. -->

## Sets {#sec-shim-sets}

{{< include mds/_sets.qmd >}}

## Functions {#sec-shim-functions}

{{< include mds/_functions.qmd >}}

{{< include mds/_expressions-algorithms.qmd >}}
2 changes: 1 addition & 1 deletion _sets.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ the expressions that write functions down and the algorithms that compute them.

:::

## Sets
[]{#sets}

{{< include mds/_subfiles/sets/_def-set.qmd >}}

Expand Down
2 changes: 2 additions & 0 deletions indicator-functions.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ format:
output-file: indicator-functions-handout.pdf
docx:
output-file: indicator-functions.docx
filters:
- split-page-headings.lua
---

{{< include mds/_indicator-functions.qmd >}}
2 changes: 2 additions & 0 deletions linear-algebra-matrices.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ format:
output-file: linear-algebra-matrices-handout.pdf
docx:
output-file: linear-algebra-matrices.docx
filters:
- split-page-headings.lua
---

{{< include latex-macros/macros.qmd >}}
Expand Down
2 changes: 2 additions & 0 deletions linear-algebra-vectors.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ format:
output-file: linear-algebra-vectors-handout.pdf
docx:
output-file: linear-algebra-vectors.docx
filters:
- split-page-headings.lua
---

{{< include latex-macros/macros.qmd >}}
Expand Down
35 changes: 35 additions & 0 deletions split-page-headings.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
-- For a page that renders one section fragment on its own.
-- The fragment opens with a level 2 heading that repeats the page title,
-- because the combined Linear Algebra page includes the same fragment as a section.
-- Drop that heading and move every later heading deeper than level 2 up one level,
-- so the page body starts at level 2 under the title.
-- The fragments that use this filter have no other level 2 heading.
function Pandoc(doc)
local title = pandoc.utils.stringify(doc.meta.title or "")
local dropped = false
local blocks = pandoc.List()
for _, block in ipairs(doc.blocks) do
if block.t == "Header" then
if not dropped and block.level == 2
and pandoc.utils.stringify(block.content):lower() == title:lower() then
dropped = true
-- Keep the heading's id as an empty anchor so links to it still work.
if block.identifier ~= "" then
blocks:insert(pandoc.Para({pandoc.Span({}, pandoc.Attr(block.identifier))}))
end
else
if dropped and block.level > 2 then
block.level = block.level - 1
end
blocks:insert(block)
end
else
blocks:insert(block)
end
end
if not dropped then
io.stderr:write("split-page-headings.lua: no level 2 heading matches the title '" .. title .. "'\n")
end
doc.blocks = blocks
return doc
end
Loading