diff --git a/go.mod b/go.mod
index ab5c376c6e..0b1aac7cac 100644
--- a/go.mod
+++ b/go.mod
@@ -27,6 +27,7 @@ require (
github.com/cznic/strutil v0.0.0-20181122101858-275e90344537 // indirect
github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc
github.com/dgrijalva/jwt-go v3.2.0+incompatible
+ github.com/dlclark/regexp2 v1.2.1 // indirect
github.com/dustin/go-humanize v1.0.0
github.com/editorconfig/editorconfig-core-go/v2 v2.1.1
github.com/emirpasic/gods v1.12.0
@@ -73,7 +74,7 @@ require (
github.com/mitchellh/go-homedir v1.1.0
github.com/msteinert/pam v0.0.0-20151204160544-02ccfbfaf0cc
github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5
- github.com/niklasfasching/go-org v0.1.9
+ github.com/niklasfasching/go-org v1.3.2
github.com/oliamb/cutter v0.2.2
github.com/olivere/elastic/v7 v7.0.9
github.com/pkg/errors v0.9.1
@@ -99,7 +100,7 @@ require (
github.com/yuin/goldmark-highlighting v0.0.0-20200307114337-60d527fdb691
github.com/yuin/goldmark-meta v0.0.0-20191126180153-f0638e958b60
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a
- golang.org/x/net v0.0.0-20200707034311-ab3426394381
+ golang.org/x/net v0.0.0-20200904194848-62affa334b73
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae
golang.org/x/text v0.3.3
diff --git a/go.sum b/go.sum
index 08a1d20ffd..bfa81019c7 100644
--- a/go.sum
+++ b/go.sum
@@ -194,6 +194,8 @@ github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8
github.com/dlclark/regexp2 v1.1.6/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
github.com/dlclark/regexp2 v1.2.0 h1:8sAhBGEM0dRWogWqWyQeIJnxjWO6oIjl8FKqREDsGfk=
github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
+github.com/dlclark/regexp2 v1.2.1 h1:Ff/S0snjr1oZHUNOkvA/gP6KUaMg5vDDl3Qnhjnwgm8=
+github.com/dlclark/regexp2 v1.2.1/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/dsnet/compress v0.0.1 h1:PlZu0n3Tuv04TzpfPbrnI0HW/YwodEXDS+oPKahKF0Q=
@@ -705,8 +707,8 @@ github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5 h1:BvoENQQU+fZ9uukda/R
github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
-github.com/niklasfasching/go-org v0.1.9 h1:Toz8WMIt+qJb52uYEk1YD/muLuOOmRt1CfkV+bKVMkI=
-github.com/niklasfasching/go-org v0.1.9/go.mod h1:AsLD6X7djzRIz4/RFZu8vwRL0VGjUvGZCCH1Nz0VdrU=
+github.com/niklasfasching/go-org v1.3.2 h1:ZKTSd+GdJYkoZl1pBXLR/k7DRiRXnmB96TRiHmHdzwI=
+github.com/niklasfasching/go-org v1.3.2/go.mod h1:AsLD6X7djzRIz4/RFZu8vwRL0VGjUvGZCCH1Nz0VdrU=
github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229/go.mod h1:0aYXnNPJ8l7uZxf45rWW1a/uME32OF0rhiYGNQ2oF2E=
github.com/nwaples/rardecode v1.0.0 h1:r7vGuS5akxOnR4JQSkko62RJ1ReCMXxQRPtxsiFMBOs=
github.com/nwaples/rardecode v1.0.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0=
@@ -1010,6 +1012,8 @@ golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200707034311-ab3426394381 h1:VXak5I6aEWmAXeQjA+QSZzlgNrpq9mjcfDemuexIKsU=
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
+golang.org/x/net v0.0.0-20200904194848-62affa334b73 h1:MXfv8rhZWmFeqX3GNZRsd6vOLoaCHjYEX3qkRo3YBUA=
+golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/oauth2 v0.0.0-20180620175406-ef147856a6dd/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
diff --git a/modules/markup/orgmode/orgmode_test.go b/modules/markup/orgmode/orgmode_test.go
index 40323912b4..020a3f592a 100644
--- a/modules/markup/orgmode/orgmode_test.go
+++ b/modules/markup/orgmode/orgmode_test.go
@@ -27,12 +27,12 @@ func TestRender_StandardLinks(t *testing.T) {
assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(buffer))
}
- googleRendered := "
\nhttps://google.com/\n
"
+ googleRendered := "https://google.com/
"
test("[[https://google.com/]]", googleRendered)
lnk := util.URLJoin(AppSubURL, "WikiPage")
test("[[WikiPage][WikiPage]]",
- "\nWikiPage\n
")
+ "WikiPage
")
}
func TestRender_Images(t *testing.T) {
@@ -48,5 +48,5 @@ func TestRender_Images(t *testing.T) {
result := util.URLJoin(AppSubURL, url)
test("[[file:"+url+"]]",
- "\n
\n
")
+ "
")
}
diff --git a/vendor/github.com/dlclark/regexp2/.travis.yml b/vendor/github.com/dlclark/regexp2/.travis.yml
index a24aededa9..2aa5ea1eef 100644
--- a/vendor/github.com/dlclark/regexp2/.travis.yml
+++ b/vendor/github.com/dlclark/regexp2/.travis.yml
@@ -1,5 +1,5 @@
language: go
go:
- - 1.5
+ - 1.9
- tip
\ No newline at end of file
diff --git a/vendor/github.com/dlclark/regexp2/regexp.go b/vendor/github.com/dlclark/regexp2/regexp.go
index 709e034259..7c7b01d879 100644
--- a/vendor/github.com/dlclark/regexp2/regexp.go
+++ b/vendor/github.com/dlclark/regexp2/regexp.go
@@ -235,17 +235,14 @@ func (re *Regexp) getRunesAndStart(s string, startAt int) ([]rune, int) {
ret[i] = r
i++
}
+ if startAt == len(s) {
+ runeIdx = i
+ }
return ret[:i], runeIdx
}
func getRunes(s string) []rune {
- ret := make([]rune, len(s))
- i := 0
- for _, r := range s {
- ret[i] = r
- i++
- }
- return ret[:i]
+ return []rune(s)
}
// MatchRunes return true if the runes matches the regex
diff --git a/vendor/github.com/dlclark/regexp2/syntax/parser.go b/vendor/github.com/dlclark/regexp2/syntax/parser.go
index f13f779cf6..be88e2eede 100644
--- a/vendor/github.com/dlclark/regexp2/syntax/parser.go
+++ b/vendor/github.com/dlclark/regexp2/syntax/parser.go
@@ -1250,10 +1250,10 @@ func (p *parser) scanBasicBackslash(scanOnly bool) (*regexNode, error) {
return nil, nil
}
- if p.useOptionE() || p.isCaptureSlot(capnum) {
+ if p.isCaptureSlot(capnum) {
return newRegexNodeM(ntRef, p.options, capnum), nil
}
- if capnum <= 9 {
+ if capnum <= 9 && !p.useOptionE() {
return nil, p.getErr(ErrUndefinedBackRef, capnum)
}
@@ -1808,11 +1808,11 @@ func (p *parser) scanOctal() rune {
i := 0
d := int(p.rightChar(0) - '0')
for c > 0 && d <= 7 {
- i *= 8
- i += d
- if p.useOptionE() && i >= 0x20 {
+ if i >= 0x20 && p.useOptionE() {
break
}
+ i *= 8
+ i += d
c--
p.moveRight(1)
diff --git a/vendor/github.com/niklasfasching/go-org/org/block.go b/vendor/github.com/niklasfasching/go-org/org/block.go
index 78ad9a7915..11b135fdfa 100644
--- a/vendor/github.com/niklasfasching/go-org/org/block.go
+++ b/vendor/github.com/niklasfasching/go-org/org/block.go
@@ -10,6 +10,11 @@ type Block struct {
Name string
Parameters []string
Children []Node
+ Result Node
+}
+
+type Result struct {
+ Node Node
}
type Example struct {
@@ -19,6 +24,8 @@ type Example struct {
var exampleLineRegexp = regexp.MustCompile(`^(\s*):(\s(.*)|\s*$)`)
var beginBlockRegexp = regexp.MustCompile(`(?i)^(\s*)#\+BEGIN_(\w+)(.*)`)
var endBlockRegexp = regexp.MustCompile(`(?i)^(\s*)#\+END_(\w+)`)
+var resultRegexp = regexp.MustCompile(`(?i)^(\s*)#\+RESULTS:`)
+var exampleBlockEscapeRegexp = regexp.MustCompile(`(^|\n)([ \t]*),([ \t]*)(\*|,\*|#\+|,#\+)`)
func lexBlock(line string) (token, bool) {
if m := beginBlockRegexp.FindStringSubmatch(line); m != nil {
@@ -29,6 +36,13 @@ func lexBlock(line string) (token, bool) {
return nilToken, false
}
+func lexResult(line string) (token, bool) {
+ if m := resultRegexp.FindStringSubmatch(line); m != nil {
+ return token{"result", len(m[1]), "", m}, true
+ }
+ return nilToken, false
+}
+
func lexExample(line string) (token, bool) {
if m := exampleLineRegexp.FindStringSubmatch(line); m != nil {
return token{"example", len(m[1]), m[3], m}, true
@@ -45,22 +59,41 @@ func (d *Document) parseBlock(i int, parentStop stopFn) (int, Node) {
stop := func(d *Document, i int) bool {
return i >= len(d.tokens) || (d.tokens[i].kind == "endBlock" && d.tokens[i].content == name)
}
- block, i := Block{name, parameters, nil}, i+1
+ block, i := Block{name, parameters, nil, nil}, i+1
if isRawTextBlock(name) {
rawText := ""
for ; !stop(d, i); i++ {
rawText += trim(d.tokens[i].matches[0]) + "\n"
}
+ if name == "EXAMPLE" || (name == "SRC" && len(parameters) >= 1 && parameters[0] == "org") {
+ rawText = exampleBlockEscapeRegexp.ReplaceAllString(rawText, "$1$2$3$4")
+ }
block.Children = d.parseRawInline(rawText)
} else {
consumed, nodes := d.parseMany(i, stop)
block.Children = nodes
i += consumed
}
- if i < len(d.tokens) && d.tokens[i].kind == "endBlock" && d.tokens[i].content == name {
- return i + 1 - start, block
+ if i >= len(d.tokens) || d.tokens[i].kind != "endBlock" || d.tokens[i].content != name {
+ return 0, nil
}
- return 0, nil
+ if name == "SRC" {
+ consumed, result := d.parseSrcBlockResult(i+1, parentStop)
+ block.Result = result
+ i += consumed
+ }
+ return i + 1 - start, block
+}
+
+func (d *Document) parseSrcBlockResult(i int, parentStop stopFn) (int, Node) {
+ start := i
+ for ; !parentStop(d, i) && d.tokens[i].kind == "text" && d.tokens[i].content == ""; i++ {
+ }
+ if parentStop(d, i) || d.tokens[i].kind != "result" {
+ return 0, nil
+ }
+ consumed, result := d.parseResult(i, parentStop)
+ return (i - start) + consumed, result
}
func (d *Document) parseExample(i int, parentStop stopFn) (int, Node) {
@@ -71,6 +104,14 @@ func (d *Document) parseExample(i int, parentStop stopFn) (int, Node) {
return i - start, example
}
+func (d *Document) parseResult(i int, parentStop stopFn) (int, Node) {
+ if i+1 >= len(d.tokens) {
+ return 0, nil
+ }
+ consumed, node := d.parseOne(i+1, parentStop)
+ return consumed + 1, Result{node}
+}
+
func trimIndentUpTo(max int) func(string) string {
return func(line string) string {
i := 0
@@ -80,5 +121,17 @@ func trimIndentUpTo(max int) func(string) string {
}
}
+func (b Block) ParameterMap() map[string]string {
+ if len(b.Parameters) == 0 {
+ return nil
+ }
+ m := map[string]string{":lang": b.Parameters[0]}
+ for i := 1; i+1 < len(b.Parameters); i += 2 {
+ m[b.Parameters[i]] = b.Parameters[i+1]
+ }
+ return m
+}
+
func (n Example) String() string { return orgWriter.WriteNodesAsString(n) }
func (n Block) String() string { return orgWriter.WriteNodesAsString(n) }
+func (n Result) String() string { return orgWriter.WriteNodesAsString(n) }
diff --git a/vendor/github.com/niklasfasching/go-org/org/document.go b/vendor/github.com/niklasfasching/go-org/org/document.go
index 3c60e5b54f..0f016c1157 100644
--- a/vendor/github.com/niklasfasching/go-org/org/document.go
+++ b/vendor/github.com/niklasfasching/go-org/org/document.go
@@ -36,6 +36,8 @@ type Document struct {
Path string // Path of the file containing the parse input - used to resolve relative paths during parsing (e.g. INCLUDE).
tokens []token
baseLvl int
+ Macros map[string]string
+ Links map[string]string
Nodes []Node
NamedNodes map[string]Node
Outline Outline // Outline is a Table Of Contents for the document and contains all sections (headline + content).
@@ -63,6 +65,7 @@ var lexFns = []lexFn{
lexHeadline,
lexDrawer,
lexBlock,
+ lexResult,
lexList,
lexTable,
lexHorizontalRule,
@@ -83,7 +86,7 @@ func New() *Configuration {
DefaultSettings: map[string]string{
"TODO": "TODO | DONE",
"EXCLUDE_TAGS": "noexport",
- "OPTIONS": "toc:t <:t e:t f:t pri:t todo:t tags:t",
+ "OPTIONS": "toc:t <:t e:t f:t pri:t todo:t tags:t title:t",
},
Log: log.New(os.Stderr, "go-org: ", 0),
ReadFile: ioutil.ReadFile,
@@ -120,6 +123,8 @@ func (c *Configuration) Parse(input io.Reader, path string) (d *Document) {
Outline: Outline{outlineSection, outlineSection, 0},
BufferSettings: map[string]string{},
NamedNodes: map[string]Node{},
+ Links: map[string]string{},
+ Macros: map[string]string{},
Path: path,
}
defer func() {
@@ -169,12 +174,13 @@ func (d *Document) Get(key string) string {
// - < (export timestamps)
// - e (export org entities)
// - f (export footnotes)
-// - toc (export table of content)
+// - title (export title)
+// - toc (export table of content. an int limits the included org headline lvl)
// - todo (export headline todo status)
// - pri (export headline priority)
// - tags (export headline tags)
// see https://orgmode.org/manual/Export-settings.html for more information
-func (d *Document) GetOption(key string) bool {
+func (d *Document) GetOption(key string) string {
get := func(settings map[string]string) string {
for _, field := range strings.Fields(settings["OPTIONS"]) {
if strings.HasPrefix(field, key+":") {
@@ -187,15 +193,11 @@ func (d *Document) GetOption(key string) bool {
if value == "" {
value = get(d.DefaultSettings)
}
- switch value {
- case "t":
- return true
- case "nil":
- return false
- default:
- d.Log.Printf("Bad value for export option %s (%s)", key, value)
- return false
+ if value == "" {
+ value = "nil"
+ d.Log.Printf("Missing value for export option %s", key)
}
+ return value
}
func (d *Document) parseOne(i int, stop stopFn) (consumed int, node Node) {
@@ -206,6 +208,8 @@ func (d *Document) parseOne(i int, stop stopFn) (consumed int, node Node) {
consumed, node = d.parseTable(i, stop)
case "beginBlock":
consumed, node = d.parseBlock(i, stop)
+ case "result":
+ consumed, node = d.parseResult(i, stop)
case "beginDrawer":
consumed, node = d.parseDrawer(i, stop)
case "text":
diff --git a/vendor/github.com/niklasfasching/go-org/org/headline.go b/vendor/github.com/niklasfasching/go-org/org/headline.go
index 749d1ff005..7e0b8eb2a6 100644
--- a/vendor/github.com/niklasfasching/go-org/org/headline.go
+++ b/vendor/github.com/niklasfasching/go-org/org/headline.go
@@ -35,14 +35,14 @@ var tagRegexp = regexp.MustCompile(`(.*?)\s+(:[A-Za-z0-9_@#%:]+:\s*$)`)
func lexHeadline(line string) (token, bool) {
if m := headlineRegexp.FindStringSubmatch(line); m != nil {
- return token{"headline", len(m[1]), m[2], m}, true
+ return token{"headline", 0, m[2], m}, true
}
return nilToken, false
}
func (d *Document) parseHeadline(i int, parentStop stopFn) (int, Node) {
t, headline := d.tokens[i], Headline{}
- headline.Lvl = t.lvl
+ headline.Lvl = len(t.matches[1])
headline.Index = d.addHeadline(&headline)
@@ -69,7 +69,7 @@ func (d *Document) parseHeadline(i int, parentStop stopFn) (int, Node) {
headline.Title = d.parseInline(text)
stop := func(d *Document, i int) bool {
- return parentStop(d, i) || d.tokens[i].kind == "headline" && d.tokens[i].lvl <= headline.Lvl
+ return parentStop(d, i) || d.tokens[i].kind == "headline" && len(d.tokens[i].matches[1]) <= headline.Lvl
}
consumed, nodes := d.parseMany(i+1, stop)
if len(nodes) > 0 {
diff --git a/vendor/github.com/niklasfasching/go-org/org/html_writer.go b/vendor/github.com/niklasfasching/go-org/org/html_writer.go
index d630db5ceb..d66e6effb3 100644
--- a/vendor/github.com/niklasfasching/go-org/org/html_writer.go
+++ b/vendor/github.com/niklasfasching/go-org/org/html_writer.go
@@ -5,6 +5,7 @@ import (
"html"
"log"
"regexp"
+ "strconv"
"strings"
"unicode"
@@ -15,7 +16,7 @@ import (
// HTMLWriter exports an org document into a html document.
type HTMLWriter struct {
ExtendingWriter Writer
- HighlightCodeBlock func(source, lang string) string
+ HighlightCodeBlock func(source, lang string, inline bool) string
strings.Builder
document *Document
@@ -60,7 +61,10 @@ func NewHTMLWriter() *HTMLWriter {
document: &Document{Configuration: defaultConfig},
log: defaultConfig.Log,
htmlEscape: true,
- HighlightCodeBlock: func(source, lang string) string {
+ HighlightCodeBlock: func(source, lang string, inline bool) string {
+ if inline {
+ return fmt.Sprintf("", html.EscapeString(source))
+ }
return fmt.Sprintf("", html.EscapeString(source))
},
footnotes: &footnotes{
@@ -88,7 +92,11 @@ func (w *HTMLWriter) WriterWithExtensions() Writer {
func (w *HTMLWriter) Before(d *Document) {
w.document = d
w.log = d.Log
- if title := d.Get("TITLE"); title != "" {
+ if title := d.Get("TITLE"); title != "" && w.document.GetOption("title") != "nil" {
+ titleDocument := d.Parse(strings.NewReader(title), d.Path)
+ if titleDocument.Error == nil {
+ title = w.WriteNodesAsString(titleDocument.Nodes...)
+ }
w.WriteString(fmt.Sprintf(`%s
`+"\n", title))
}
w.WriteOutline(d)
@@ -102,38 +110,54 @@ func (w *HTMLWriter) WriteComment(Comment) {}
func (w *HTMLWriter) WritePropertyDrawer(PropertyDrawer) {}
func (w *HTMLWriter) WriteBlock(b Block) {
- content := ""
- if isRawTextBlock(b.Name) {
- builder, htmlEscape := w.Builder, w.htmlEscape
- w.Builder, w.htmlEscape = strings.Builder{}, false
- WriteNodes(w, b.Children...)
- out := w.String()
- w.Builder, w.htmlEscape = builder, htmlEscape
- content = strings.TrimRightFunc(out, unicode.IsSpace)
- } else {
- content = w.WriteNodesAsString(b.Children...)
- }
- switch name := b.Name; {
- case name == "SRC":
+ content, params := w.blockContent(b.Name, b.Children), b.ParameterMap()
+
+ switch b.Name {
+ case "SRC":
+ if params[":exports"] == "results" || params[":exports"] == "none" {
+ break
+ }
lang := "text"
if len(b.Parameters) >= 1 {
lang = strings.ToLower(b.Parameters[0])
}
- content = w.HighlightCodeBlock(content, lang)
+ content = w.HighlightCodeBlock(content, lang, false)
w.WriteString(fmt.Sprintf("\n%s\n
\n", lang, content))
- case name == "EXAMPLE":
- w.WriteString(`` + "\n" + content + "\n
\n")
- case name == "EXPORT" && len(b.Parameters) >= 1 && strings.ToLower(b.Parameters[0]) == "html":
- w.WriteString(content + "\n")
- case name == "QUOTE":
+ case "EXAMPLE":
+ w.WriteString(`` + "\n" + html.EscapeString(content) + "\n
\n")
+ case "EXPORT":
+ if len(b.Parameters) >= 1 && strings.ToLower(b.Parameters[0]) == "html" {
+ w.WriteString(content + "\n")
+ }
+ case "QUOTE":
w.WriteString("\n" + content + "
\n")
- case name == "CENTER":
+ case "CENTER":
w.WriteString(`` + "\n")
w.WriteString(content + "
\n")
default:
w.WriteString(fmt.Sprintf(``, strings.ToLower(b.Name)) + "\n")
w.WriteString(content + "
\n")
}
+
+ if b.Result != nil && params[":exports"] != "code" && params[":exports"] != "none" {
+ WriteNodes(w, b.Result)
+ }
+}
+
+func (w *HTMLWriter) WriteResult(r Result) { WriteNodes(w, r.Node) }
+
+func (w *HTMLWriter) WriteInlineBlock(b InlineBlock) {
+ content := w.blockContent(strings.ToUpper(b.Name), b.Children)
+ switch b.Name {
+ case "src":
+ lang := strings.ToLower(b.Parameters[0])
+ content = w.HighlightCodeBlock(content, lang, true)
+ w.WriteString(fmt.Sprintf("\n%s\n
", lang, content))
+ case "export":
+ if strings.ToLower(b.Parameters[0]) == "html" {
+ w.WriteString(content)
+ }
+ }
}
func (w *HTMLWriter) WriteDrawer(d Drawer) {
@@ -155,7 +179,7 @@ func (w *HTMLWriter) WriteFootnoteDefinition(f FootnoteDefinition) {
}
func (w *HTMLWriter) WriteFootnotes(d *Document) {
- if !w.document.GetOption("f") || len(w.footnotes.list) == 0 {
+ if w.document.GetOption("f") == "nil" || len(w.footnotes.list) == 0 {
return
}
w.WriteString(`