From 4d3a0999222efbfe37372f51b245951b85086a37 Mon Sep 17 00:00:00 2001
From: Ori tags
This also removes extra newlines for simple list items, see changes to
tests for details.
Closes #57
---
org/html_writer.go | 33 ++++++-
org/testdata/blocks.html | 20 ++--
org/testdata/footnotes.html | 30 ++----
org/testdata/footnotes_in_headline.html | 20 ++--
org/testdata/headlines.html | 14 +--
org/testdata/inline.html | 126 +++++++-----------------
org/testdata/latex.html | 30 ++----
org/testdata/lists.html | 120 ++++++----------------
org/testdata/misc.html | 72 ++++----------
9 files changed, 146 insertions(+), 319 deletions(-)
diff --git a/org/html_writer.go b/org/html_writer.go
index 08a5b69..878560b 100644
--- a/org/html_writer.go
+++ b/org/html_writer.go
@@ -4,6 +4,7 @@ import (
"fmt"
"html"
"log"
+ "reflect"
"regexp"
"strconv"
"strings"
@@ -415,8 +416,8 @@ func (w *HTMLWriter) WriteListItem(li ListItem) {
if li.Status != "" {
attributes += fmt.Sprintf(` class="%s"`, listItemStatuses[li.Status])
}
- w.WriteString(fmt.Sprintf("
blocks like the quote block parse their content and can contain lists inline markup tables paragraphs …
+
-
@@ -90,15 +86,11 @@ blocks like the quote block parse their content and can contain
white-space: pre
).
white-space: pre
).
normal footnote reference 1 2 3 (footnote names can be anything in the format [\w-]
)
further references to the same footnote should not 1 render duplicates in the footnote list
-inline footnotes are also supported via 4.
-anonymous inline footnotes are also supported via 5.
-Footnote definitions are not printed where they appear. -Rather, they are gathered and exported at the end of the document in the footnote section. 6
-footnotes that reference a non-existant definition are rendered but log a warning 7
-[\w-]
)footnotes can contain markup
-and other elements
(&footnotes).add()
(docs).
-Headlines have to be htmlified twice - once for the outline and once for the headline itself. To do so we have to copy the writer
-Copying the writer copies footnotes - which contains a map and a slice. Changes to the map will always be reflected in the original map. -Changes to the slice will only be reflected if the slice doesn't grow.
-We can thus end up with a footnote being in the mapping but not the slice - and get an index out of range error.
-footnotes.add()
transparently gets translated to (&footnotes).add()
(docs).[1/2]
checked
-unchecked
-note that statistic tokens are marked up anywhere +
[100%]
<
-(Org mode proper does the same)
-emphasis and a hard line break
+
.emphasis with dot border chars.
-emphasis with a slash/inside
-emphasis followed by raw text with slash /
-->/not an emphasis/<-
-links with slashes do not become emphasis: https://somelinkshouldntrenderaccidentalemphasis.com/ emphasis
-underlined bold verbatim
code
strikethrough
bold string with an *asterisk inside
-inline source blocks like
verbatim
code
<h1>hello</h1>
inline export blocks
multiline emphasis is
+
multiline emphasis is
supported - and respects MaxEmphasisNewLines (default: 1)
so this
-is emphasized
-+is emphasized + /but this is -not emphasized/
-empty emphasis markers like ++ // __ and so on are ignored
-use _{} for subscriptsub and ^{} for superscriptsuper
-links
regular link https://example.com link without description
-regular link example.com link with description
-regular link to a file (image)
regular link to an org file (extension replaced with html) inline.html / ../testdata/inline.html
-regular link to a file (video)
-regular link to http (image)
regular link to https (image)
regular link enclosed in [] [https://www.example.com] [example.com]
-auto link, i.e. not inside \[[square brackets]\]
https://www.example.com
\[[square brackets]\]
https://www.example.comtimestamps
-
-
-
-
-
-
without latex delimiters the _{i=1}
in \sum_{i=1}^n a_n
is interpreted as subscript.
we support \(...\)
, \[...\]
, $$...$$
and \begin{$env}...\end{$env}
as latex fragment delimiters.
∑i=1^n a_n (without latex delimiter)
-\(\sum_{i=1}^n a_n\)
-\[\sum_{i=1}^n a_n\]
-$$\sum_{i=1}^n a_n$$
-\begin{xyz}\sum_{i=1}^n a_n\end{xyz}
-\begin{xyz} +
$2 + 2$, $3 - 3$
-unordered list item 1
-
+
list item with empty first and second line
-normally an empty line breaks the list item - but we make an exception for the first line and don't count it towards that limit
unordered list item 2 - with inline
markup
ordered sublist item 1
ordered sublist item 1
-ordered sublist item 2
-ordered sublist item 3
-ordered sublist item 2
--list item with empty first and second line - see above
-details -continued details
-details without a term
--details on a new line
-some list termination tests
unordered 1
-unordered 2
-ordered 1
-ordered 2
-ordered 1
-ordered 2
-unordered 1
-unordered 2
-ordered 1
-ordered 2
-1
-2
-1
-2
-unordered 1
-unordered 2
-use `[@n]` to change the value of list items
-foobar
-that even works in combination with list statuses (`[ ]`)
-ndash –
-mdash —
-ellipsis …
-acute Á and so on
-note that —— is replaced with 2 mdashes and …. becomes ellipsis+. and so on - that's how org also does it
-that
foo.
this list item +
foobar
-same +
foo
-bullet 1
sub bullet
-just like #46
--
-> – (en dash)
---
-> — (em dash)
--
-> – (en dash)---
-> — (em dash)also, consecutive dashes inside
inline code --
---
and verbatim --
---
--
---
and verbatim --
---
src/example/export blocks should not be converted!
a list item
-followed by another list item
-a footnote with markup
and a list
-because that's possible
-