Support basic #+INCLUDE (src/example/export block only)
including org files is more complex - e.g. footnotes need to be namespaced to their source file. org does this by prefixing each included files footnotes with a number - but even that is not enough as it doesn't guarantee uniqueness. As I don't have a usecase for it, I'll avoid the additional complexity for now.
This commit is contained in:
parent
04df30a7b5
commit
2947d7632d
13 changed files with 150 additions and 26 deletions
|
@ -11,7 +11,6 @@ import (
|
|||
|
||||
type HTMLWriter struct {
|
||||
stringBuilder
|
||||
document *Document
|
||||
HighlightCodeBlock func(source, lang string) string
|
||||
}
|
||||
|
||||
|
@ -65,6 +64,8 @@ func (w *HTMLWriter) writeNodes(ns ...Node) {
|
|||
switch n := n.(type) {
|
||||
case Keyword:
|
||||
w.writeKeyword(n)
|
||||
case Include:
|
||||
w.writeInclude(n)
|
||||
case Comment:
|
||||
continue
|
||||
case NodeWithMeta:
|
||||
|
@ -144,6 +145,10 @@ func (w *HTMLWriter) writeKeyword(k Keyword) {
|
|||
}
|
||||
}
|
||||
|
||||
func (w *HTMLWriter) writeInclude(i Include) {
|
||||
w.writeNodes(i.Resolve())
|
||||
}
|
||||
|
||||
func (w *HTMLWriter) writeFootnoteDefinition(f FootnoteDefinition) {
|
||||
n := f.Name
|
||||
w.WriteString(`<div class="footnote-definition">` + "\n")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue