forked from EduCraft/curriculum-project-hub
feat(cph): add outline export command
This commit is contained in:
@@ -242,3 +242,57 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Render a teacher-facing outline. `children` is intentionally separate from
|
||||
/// the lesson body: each node heading is accompanied by an optional planning
|
||||
/// note rendered as a visually distinct teaching-tip box.
|
||||
#let _render-outline-node(node, level) = {
|
||||
let title = node.at("title", default: "")
|
||||
let kind = node.at("kind", default: "")
|
||||
heading(level: level)[#title]
|
||||
|
||||
if kind != "" {
|
||||
block(
|
||||
inset: (x: 0.35em, y: 0.1em),
|
||||
fill: gray.lighten(80%),
|
||||
radius: 0.2em,
|
||||
text(size: 9pt, fill: gray.darken(30%))[#kind],
|
||||
)
|
||||
}
|
||||
|
||||
let notes = node.at("notes", default: none)
|
||||
if notes != none and notes != "" {
|
||||
block(
|
||||
width: 100%,
|
||||
inset: (x: 1em, y: 0.7em),
|
||||
fill: rgb("#fff8e7"),
|
||||
stroke: rgb("#e6c45a") + 0.6pt,
|
||||
radius: 0.3em,
|
||||
breakable: true,
|
||||
{
|
||||
set text(size: 10.5pt)
|
||||
text(weight: "bold")[教学提示]
|
||||
linebreak()
|
||||
notes
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
for child in node.at("children", default: ()) {
|
||||
_render-outline-node(child, level + 1)
|
||||
}
|
||||
}
|
||||
|
||||
/// Render the outline document supplied by `cph outline --format pdf`.
|
||||
#let render-outline(outline) = {
|
||||
let title = outline.at("title", default: "课程大纲")
|
||||
let authors = outline.at("authors", default: ())
|
||||
set document(title: title, author: authors)
|
||||
show: base-style.with(heading-numbering: default-heading-numbering)
|
||||
|
||||
title-block()
|
||||
subtitle-block([课程大纲])
|
||||
for child in outline.at("children", default: ()) {
|
||||
_render-outline-node(child, 1)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user