Add support for ": example" elements
This commit is contained in:
parent
24ace5aa0e
commit
c012b0a533
8 changed files with 75 additions and 0 deletions
13
org/html.go
13
org/html.go
|
@ -88,6 +88,8 @@ func (w *HTMLWriter) writeNodes(ns ...Node) {
|
|||
|
||||
case Paragraph:
|
||||
w.writeParagraph(n)
|
||||
case Example:
|
||||
w.writeExample(n)
|
||||
case HorizontalRule:
|
||||
w.writeHorizontalRule(n)
|
||||
case Text:
|
||||
|
@ -264,6 +266,17 @@ func (w *HTMLWriter) writeParagraph(p Paragraph) {
|
|||
w.WriteString("\n</p>\n")
|
||||
}
|
||||
|
||||
func (w *HTMLWriter) writeExample(e Example) {
|
||||
w.WriteString(`<pre class="example">` + "\n")
|
||||
if len(e.Children) != 0 {
|
||||
for _, n := range e.Children {
|
||||
w.writeNodes(n)
|
||||
w.WriteString("\n")
|
||||
}
|
||||
}
|
||||
w.WriteString("\n</pre>\n")
|
||||
}
|
||||
|
||||
func (w *HTMLWriter) writeHorizontalRule(h HorizontalRule) {
|
||||
w.WriteString("<hr>\n")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue