html: Remove cosmetic whitespace inside p tags

All tags are put on a line by themselves to help with visual
diffing. Apparently this extra cosmetic whitespace causes problems inside p
tags for ppl who want to use `white-space: pre`. Not much hurt for visual
diffing in removing cosmetic whitespace for just p tags and can't think of
anything that would break because of this right now. So let's do it and wait
for things to break.
This commit is contained in:
Niklas Fasching 2020-06-26 18:53:57 +02:00
parent 30dd2794cf
commit a383eef7a6
15 changed files with 216 additions and 577 deletions

View file

@ -24,13 +24,10 @@
<ul class="tags">
</ul>
<h1 class="title"><p>
About
</p>
<h1 class="title"><p>About</p>
</h1>
<p>
and some content
</p>
and some content</p>
</div>
</body>

View file

@ -24,9 +24,7 @@
<ul class="tags">
</ul>
<h1 class="title"><p>
some post
</p>
<h1 class="title"><p>some post</p>
</h1>
</div>

View file

@ -411,11 +411,8 @@ func (w *HTMLWriter) WriteParagraph(p Paragraph) {
return
}
w.WriteString("<p>")
if _, ok := p.Children[0].(LineBreak); !ok {
w.WriteString("\n")
}
WriteNodes(w, p.Children...)
w.WriteString("\n</p>\n")
w.WriteString("</p>\n")
}
func (w *HTMLWriter) WriteExample(e Example) {

View file

@ -61,27 +61,18 @@ are also supported
note that /inline/ *markup* ignored
</pre>
<blockquote>
<p>Mongodb is <strong>webscale</strong>. (source: <a href="http://www.mongodb-is-web-scale.com/">mongodb-is-web-scale</a>)</p>
<p>
Mongodb is <strong>webscale</strong>. (source: <a href="http://www.mongodb-is-web-scale.com/">mongodb-is-web-scale</a>)
</p>
<p>
blocks like the quote block parse their content and can contain
</p>
blocks like the quote block parse their content and can contain</p>
<ul>
<li>
<p>
lists
</p>
<p>lists</p>
</li>
<li>
<p>
inline <em>markup</em>
</p>
<p>inline <em>markup</em></p>
</li>
<li>
<p>
tables
</p>
<p>tables</p>
<table>
<tbody>
<tr>
@ -97,18 +88,13 @@ tables
</table>
</li>
<li>
<p>
paragraphs
</p>
<p>paragraphs</p>
</li>
<li>
<p>
</p>
<p></p>
<p>
whitespace is honored and not removed (but is not displayed because that&#39;s how html works by default)
it can be made visible using css (e.g. <code class="verbatim">white-space: pre</code>).
</p>
it can be made visible using css (e.g. <code class="verbatim">white-space: pre</code>).</p>
</li>
</ul>
</blockquote>
@ -135,31 +121,21 @@ console.log("Hello World!")
</script>
<ul>
<li>
<p>
list item 1
blocks can contain unindented lines that would normally end a list item
</p>
<p>list item 1
blocks can contain unindented lines that would normally end a list item</p>
<pre class="example">
this line is not indented - if it was outside of a block the list item would end
</pre>
<blockquote>
<p>
this line is not indented - if it was outside of a block the list item would end
</p>
<p>this line is not indented - if it was outside of a block the list item would end</p>
</blockquote>
<p>
now we&#39;re outside the block again and the following unindented line will be outside of the list item
</p>
<p>now we&#39;re outside the block again and the following unindented line will be outside of the list item</p>
</li>
</ul>
<p>
this unindented line is outside of the list item
</p>
<p>this unindented line is outside of the list item</p>
<ul>
<li>
<p>
list item 2
</p>
<p>list item 2</p>
<div class="src src-text">
<div class="highlight">
<pre>
@ -167,9 +143,7 @@ list item 2
</pre>
</div>
</div>
<p>
#+END_EXAMPLE
</p>
<p>#+END_EXAMPLE</p>
<blockquote>
<pre class="example">
#+END_QUOTE
@ -177,14 +151,10 @@ list item 2
</blockquote>
</li>
<li>
<p>
verse blocks
</p>
<p>verse blocks</p>
<ul>
<li>
<p>
emacs / ox-hugo rendering
</p>
<p>emacs / ox-hugo rendering</p>
<p class="verse">
Great clouds overhead<br />
Tiny black birds rise and fall<br />
@ -194,9 +164,7 @@ Snow covers Emacs<br />
</p>
</li>
<li>
<p>
go-org rendering
</p>
<p>go-org rendering</p>
<div class="src src-html">
<div class="highlight">
<pre>
@ -212,14 +180,11 @@ go-org rendering
.verse-block p + p { margin: 0; }
</style>
<div class="verse-block">
<p>
Great clouds overhead
<p>Great clouds overhead
Tiny black birds rise and fall
Snow covers Emacs
</p>
Snow covers Emacs</p>
<p>
—AlexSchroeder
</p>
—AlexSchroeder</p>
</div>
</li>
</ul>

View file

@ -1,6 +1,4 @@
<p>
Anything can be captioned.
</p>
<p>Anything can be captioned.</p>
<figure>
<div class="src src-sh">
<div class="highlight">
@ -19,13 +17,10 @@ captioned link (image in this case)
</figcaption>
</figure>
<p>
note that the whole paragraph is captioned, so a linebreak is needed for images to caption correctly
</p>
note that the whole paragraph is captioned, so a linebreak is needed for images to caption correctly</p>
<figure>
<p>
<img src="https://placekitten.com/200/200#.png" alt="https://placekitten.com/200/200#.png" title="https://placekitten.com/200/200#.png" />
see?
</p>
<p><img src="https://placekitten.com/200/200#.png" alt="https://placekitten.com/200/200#.png" title="https://placekitten.com/200/200#.png" />
see?</p>
<figcaption>
captioned link (image in this case)
</figcaption>

View file

@ -11,70 +11,47 @@ Using some footnotes
</h2>
<ul>
<li>
<p>
normal footnote reference <sup class="footnote-reference"><a id="footnote-reference-1" href="#footnote-1">1</a></sup> <sup class="footnote-reference"><a id="footnote-reference-2" href="#footnote-2">2</a></sup> <sup class="footnote-reference"><a id="footnote-reference-3" href="#footnote-3">3</a></sup> (footnote names can be anything in the format <code class="verbatim">[\w-]</code>)
</p>
<p>normal footnote reference <sup class="footnote-reference"><a id="footnote-reference-1" href="#footnote-1">1</a></sup> <sup class="footnote-reference"><a id="footnote-reference-2" href="#footnote-2">2</a></sup> <sup class="footnote-reference"><a id="footnote-reference-3" href="#footnote-3">3</a></sup> (footnote names can be anything in the format <code class="verbatim">[\w-]</code>)</p>
</li>
<li>
<p>
further references to the same footnote should not <sup class="footnote-reference"><a id="footnote-reference-1" href="#footnote-1">1</a></sup> render duplicates in the footnote list
</p>
<p>further references to the same footnote should not <sup class="footnote-reference"><a id="footnote-reference-1" href="#footnote-1">1</a></sup> render duplicates in the footnote list</p>
</li>
<li>
<p>
inline footnotes are also supported via <sup class="footnote-reference"><a id="footnote-reference-4" href="#footnote-4">4</a></sup>.
</p>
<p>inline footnotes are also supported via <sup class="footnote-reference"><a id="footnote-reference-4" href="#footnote-4">4</a></sup>.</p>
</li>
<li>
<p>
anonymous inline footnotes are also supported via <sup class="footnote-reference"><a id="footnote-reference-5" href="#footnote-5">5</a></sup>.
</p>
<p>anonymous inline footnotes are also supported via <sup class="footnote-reference"><a id="footnote-reference-5" href="#footnote-5">5</a></sup>.</p>
</li>
<li>
<p>
Footnote definitions are not printed where they appear.
Rather, they are gathered and exported at the end of the document in the footnote section. <sup class="footnote-reference"><a id="footnote-reference-6" href="#footnote-6">6</a></sup>
</p>
<p>Footnote definitions are not printed where they appear.
Rather, they are gathered and exported at the end of the document in the footnote section. <sup class="footnote-reference"><a id="footnote-reference-6" href="#footnote-6">6</a></sup></p>
</li>
<li>
<p>
footnotes that reference a non-existant definition are rendered but log a warning <sup class="footnote-reference"><a id="footnote-reference-7" href="#footnote-7">7</a></sup>
</p>
<p>footnotes that reference a non-existant definition are rendered but log a warning <sup class="footnote-reference"><a id="footnote-reference-7" href="#footnote-7">7</a></sup></p>
</li>
</ul>
<h2 id="headline-2">
Footnotes
</h2>
<p>Please note that the footnotes section is not automatically excluded from the export like in emacs. <sup class="footnote-reference"><a id="footnote-reference-8" href="#footnote-8">8</a></sup></p>
<p>
Please note that the footnotes section is not automatically excluded from the export like in emacs. <sup class="footnote-reference"><a id="footnote-reference-8" href="#footnote-8">8</a></sup>
</p>
<p>
this is not part of <sup class="footnote-reference"><a id="footnote-reference-8" href="#footnote-8">8</a></sup> anymore as there are 2 blank lines in between!
</p>
this is not part of <sup class="footnote-reference"><a id="footnote-reference-8" href="#footnote-8">8</a></sup> anymore as there are 2 blank lines in between!</p>
<div class="footnotes">
<hr class="footnotes-separatator">
<div class="footnote-definitions">
<div class="footnote-definition">
<sup id="footnote-1"><a href="#footnote-reference-1">1</a></sup>
<div class="footnote-body">
<p>
<a href="https://www.example.com">https://www.example.com</a>
</p>
<p><a href="https://www.example.com">https://www.example.com</a></p>
<ul>
<li>
<p>
footnotes can contain <strong>markup</strong>
</p>
<p>footnotes can contain <strong>markup</strong></p>
</li>
<li>
<p>
and other elements
</p>
<p>and other elements</p>
<ul>
<li>
<p>
like blocks
</p>
<p>like blocks</p>
<div class="src src-text">
<div class="highlight">
<pre>
@ -84,9 +61,7 @@ other non-plain
</div>
</li>
<li>
<p>
and tables
</p>
<p>and tables</p>
<table>
<tbody>
<tr>
@ -114,41 +89,32 @@ and tables
<div class="footnote-body">
<p>
Footnotes break after two consecutive empty lines - just like paragraphs - see <a href="https://orgmode.org/worg/dev/org-syntax.html.">https://orgmode.org/worg/dev/org-syntax.html.</a>
This shouldn&#39;t happen when the definition line and the line after that are empty.
</p>
This shouldn&#39;t happen when the definition line and the line after that are empty.</p>
</div>
</div>
<div class="footnote-definition">
<sup id="footnote-3"><a href="#footnote-reference-3">3</a></sup>
<div class="footnote-body">
<p>
yolo
</p>
<p>yolo</p>
</div>
</div>
<div class="footnote-definition">
<sup id="footnote-4"><a href="#footnote-reference-4">4</a></sup>
<div class="footnote-body">
<p>
the inline footnote definition
</p>
<p>the inline footnote definition</p>
</div>
</div>
<div class="footnote-definition">
<sup id="footnote-5"><a href="#footnote-reference-5">5</a></sup>
<div class="footnote-body">
<p>
the anonymous inline footnote definition
</p>
<p>the anonymous inline footnote definition</p>
</div>
</div>
<div class="footnote-definition">
<sup id="footnote-6"><a href="#footnote-reference-6">6</a></sup>
<div class="footnote-body">
<p>
so this definition will not be at the end of this section in the exported document.
Rather, it will be somewhere down below in the footnotes section.
</p>
<p>so this definition will not be at the end of this section in the exported document.
Rather, it will be somewhere down below in the footnotes section.</p>
</div>
</div>
<div class="footnote-definition">
@ -156,8 +122,7 @@ Rather, it will be somewhere down below in the footnotes section.
<div class="footnote-body">
<p>
There&#39;s multiple reasons for that. Among others, doing so requires i18n (to recognize the section) and silently
hides content before and after the footnotes.
</p>
hides content before and after the footnotes.</p>
</div>
</div>
</div>

View file

@ -13,32 +13,22 @@ Title <sup class="footnote-reference"><a id="footnote-reference-1" href="#footno
<div class="footnote-definition">
<sup id="footnote-1"><a href="#footnote-reference-1">1</a></sup>
<div class="footnote-body">
<p>
this test file just exists to reproduce a bug with footnotes in headlines - that only happens in very specific circumstances.
The TLDR is:
</p>
<p>this test file just exists to reproduce a bug with footnotes in headlines - that only happens in very specific circumstances.
The TLDR is:</p>
<ul>
<li>
<p>
HTMLWriter.footnotes should be a pointer field. I didn&#39;t notice my error as go translated my pointer-method calls on
non-pointer values rather than complaining - i.e. <code class="verbatim">footnotes.add()</code> transparently gets translated to <code class="verbatim">(&amp;footnotes).add()</code> (<a href="https://golang.org/ref/spec#Calls">docs</a>).
</p>
<p>HTMLWriter.footnotes should be a pointer field. I didn&#39;t notice my error as go translated my pointer-method calls on
non-pointer values rather than complaining - i.e. <code class="verbatim">footnotes.add()</code> transparently gets translated to <code class="verbatim">(&amp;footnotes).add()</code> (<a href="https://golang.org/ref/spec#Calls">docs</a>).</p>
</li>
<li>
<p>
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
</p>
<p>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</p>
</li>
<li>
<p>
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&#39;t grow.
</p>
<p>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&#39;t grow.</p>
</li>
<li>
<p>
We can thus end up with a footnote being in the mapping but not the slice - and get an index out of range error.
</p>
<p>We can thus end up with a footnote being in the mapping but not the slice - and get an index out of range error.</p>
</li>
</ul>
</div>

View file

@ -23,21 +23,15 @@ Simple Headline <code class="statistic">[1/2]</code>
</h2>
<ul>
<li class="checked">
<p>
checked
</p>
<p>checked</p>
</li>
<li class="unchecked">
<p>
unchecked
</p>
<p>unchecked</p>
</li>
<li>
<p>
note that statistic tokens are marked up anywhere
<p>note that statistic tokens are marked up anywhere
not just where they are actually meant to be - even here &gt; <code class="statistic">[100%]</code> &lt;
(Org mode proper does the same)
</p>
(Org mode proper does the same)</p>
</li>
</ul>
<h2 id="headline-2">
@ -50,28 +44,19 @@ Headline with todo status &amp; priority
Headline with TODO status
</h2>
<p>
we can link to headlines that define a custom_id: <a href="#this-will-be-the-id-of-the-headline">#this-will-be-the-id-of-the-headline</a>
</p>
we can link to headlines that define a custom_id: <a href="#this-will-be-the-id-of-the-headline">#this-will-be-the-id-of-the-headline</a></p>
<h2 id="headline-4">
<span class="priority">[A]</span>
Headline with tags &amp; priority&#xa0;&#xa0;&#xa0;<span class="tags"><span>foo</span>&#xa0;<span>bar</span></span>
</h2>
<p>
Still outside the drawer
</p>
<p>
This is inside the drawer
</p>
<p>
Still outside the drawer
</p>
<p>Still outside the drawer</p>
<p>This is inside the drawer</p>
<p>Still outside the drawer</p>
<h2 id="headline-5">
<span class="todo">CUSTOM</span>
headline with custom status
</h2>
<p>
it&#39;s possible to use <code class="verbatim">#+SETUPFILE</code> - in this case the setup file contains the following
</p>
<p>it&#39;s possible to use <code class="verbatim">#+SETUPFILE</code> - in this case the setup file contains the following</p>
<div class="src src-org">
<div class="highlight">
<pre>
@ -83,20 +68,14 @@ it&#39;s possible to use <code class="verbatim">#+SETUPFILE</code> - in this cas
<h2 id="headline-7">
malformed property drawer
</h2>
<p>
:PROPERTIES:
not a property
</p>
<p>
:END:
</p>
<p>:PROPERTIES:
not a property</p>
<p>:END:</p>
<h2 id="headline-8">
level limit for headlines to be included in the table of contents
</h2>
<p>
The toc option allows setting a <a href="https://orgmode.org/manual/Export-settings.html">level limit</a>. For this file we set it to 1 - which means that the following headlines
won&#39;t be included in the table of contents.
</p>
<p>The toc option allows setting a <a href="https://orgmode.org/manual/Export-settings.html">level limit</a>. For this file we set it to 1 - which means that the following headlines
won&#39;t be included in the table of contents.</p>
<h3 id="headline-9">
headline 2 not in toc
</h3>
@ -106,6 +85,4 @@ headline 3 not in toc
<h3 id="headline-11">
anoter headline 2 not in toc
</h3>
<p>
you get the gist…
</p>
<p>you get the gist…</p>

View file

@ -1,181 +1,116 @@
<ul>
<li>
<p>
<em>emphasis</em> and a hard line break <br>
<p><em>emphasis</em> and a hard line break <br>
see? <br>
also hard line breaks not followed by a newline get ignored, see \\
</p>
also hard line breaks not followed by a newline get ignored, see \\</p>
</li>
<li>
<p>
<em>.emphasis with dot border chars.</em>
</p>
<p><em>.emphasis with dot border chars.</em></p>
</li>
<li>
<p>
<em>emphasis with a slash/inside</em>
</p>
<p><em>emphasis with a slash/inside</em></p>
</li>
<li>
<p>
<em>emphasis</em> followed by raw text with slash /
</p>
<p><em>emphasis</em> followed by raw text with slash /</p>
</li>
<li>
<p>
-&gt;/not an emphasis/&lt;-
</p>
<p>-&gt;/not an emphasis/&lt;-</p>
</li>
<li>
<p>
links with slashes do not become <em>emphasis</em>: <a href="https://somelinkshouldntrenderaccidentalemphasis.com">https://somelinkshouldntrenderaccidentalemphasis.com</a>/ <em>emphasis</em>
</p>
<p>links with slashes do not become <em>emphasis</em>: <a href="https://somelinkshouldntrenderaccidentalemphasis.com">https://somelinkshouldntrenderaccidentalemphasis.com</a>/ <em>emphasis</em></p>
</li>
<li>
<p>
<span style="text-decoration: underline;">underlined</span> <strong>bold</strong> <code class="verbatim">verbatim</code> <code>code</code> <del>strikethrough</del>
</p>
<p><span style="text-decoration: underline;">underlined</span> <strong>bold</strong> <code class="verbatim">verbatim</code> <code>code</code> <del>strikethrough</del></p>
</li>
<li>
<p>
<strong>bold string with an *asterisk inside</strong>
</p>
<p><strong>bold string with an *asterisk inside</strong></p>
</li>
<li>
<p>
inline source blocks like <div class="src src-inline src-html">
<p>inline source blocks like <div class="src src-inline src-html">
<div class="highlight-inline">
<pre>
&lt;h1&gt;hello&lt;/h1&gt;
</pre>
</div>
</div>
</p>
</div></p>
</li>
<li>
<p>
inline export blocks <h1>hello</h1>
</p>
<p>inline export blocks <h1>hello</h1></p>
</li>
<li>
<p>
<code class="verbatim">multiline emphasis is
<p><code class="verbatim">multiline emphasis is
supported - and respects MaxEmphasisNewLines (default: 1)</code>
<em>so this
is emphasized</em>
</p>
is emphasized</em></p>
<p>
/but
this
is
not emphasized/
</p>
not emphasized/</p>
</li>
<li>
<p>
empty emphasis markers like ++ // __ and so on are ignored
</p>
<p>empty emphasis markers like ++ // __ and so on are ignored</p>
</li>
<li>
<p>
use _{} for subscript<sub>sub</sub> and ^{} for superscript<sup>super</sup>
</p>
<p>use _{} for subscript<sub>sub</sub> and ^{} for superscript<sup>super</sup></p>
</li>
<li>
<p>
links
</p>
<p>links</p>
<ol>
<li>
<p>
regular link <a href="https://example.com">https://example.com</a> link without description
</p>
<p>regular link <a href="https://example.com">https://example.com</a> link without description</p>
</li>
<li>
<p>
regular link <a href="https://example.com">example.com</a> link with description
</p>
<p>regular link <a href="https://example.com">example.com</a> link with description</p>
</li>
<li>
<p>
regular link to a file (image) <img src="my-img.png" alt="my-img.png" title="my-img.png" />
</p>
<p>regular link to a file (image) <img src="my-img.png" alt="my-img.png" title="my-img.png" /></p>
</li>
<li>
<p>
regular link to a file (video) <video src="my-video.mp4" title="my-video.mp4">my-video.mp4</video>
</p>
<p>regular link to a file (video) <video src="my-video.mp4" title="my-video.mp4">my-video.mp4</video></p>
</li>
<li>
<p>
regular link to http (image) <img src="http://placekitten.com/200/200#.png" alt="http://placekitten.com/200/200#.png" title="http://placekitten.com/200/200#.png" />
</p>
<p>regular link to http (image) <img src="http://placekitten.com/200/200#.png" alt="http://placekitten.com/200/200#.png" title="http://placekitten.com/200/200#.png" /></p>
</li>
<li>
<p>
regular link to https (image) <img src="https://placekitten.com/200/200#.png" alt="https://placekitten.com/200/200#.png" title="https://placekitten.com/200/200#.png" />
</p>
<p>regular link to https (image) <img src="https://placekitten.com/200/200#.png" alt="https://placekitten.com/200/200#.png" title="https://placekitten.com/200/200#.png" /></p>
</li>
<li>
<p>
regular link enclosed in [] [<a href="https://www.example.com">https://www.example.com</a>] [<a href="https://www.example.com">example.com</a>]
</p>
<p>regular link enclosed in [] [<a href="https://www.example.com">https://www.example.com</a>] [<a href="https://www.example.com">example.com</a>]</p>
</li>
<li>
<p>
auto link, i.e. not inside <code class="verbatim">\[[square brackets]\]</code> <a href="https://www.example.com">https://www.example.com</a>
</p>
<p>auto link, i.e. not inside <code class="verbatim">\[[square brackets]\]</code> <a href="https://www.example.com">https://www.example.com</a></p>
</li>
</ol>
</li>
<li>
<p>
timestamps
</p>
<p>timestamps</p>
<ul>
<li>
<p>
<span class="timestamp">&lt;2019-01-06 Sun&gt;</span>
</p>
<p><span class="timestamp">&lt;2019-01-06 Sun&gt;</span></p>
</li>
<li>
<p>
<span class="timestamp">&lt;2019-01-06 Sun&gt;</span>
</p>
<p><span class="timestamp">&lt;2019-01-06 Sun&gt;</span></p>
</li>
<li>
<p>
<span class="timestamp">&lt;2019-01-06 Sun 18:00&gt;</span>
</p>
<p><span class="timestamp">&lt;2019-01-06 Sun 18:00&gt;</span></p>
</li>
<li>
<p>
<span class="timestamp">&lt;2019-01-06 Sun 18:00 +1w&gt;</span>
</p>
<p><span class="timestamp">&lt;2019-01-06 Sun 18:00 +1w&gt;</span></p>
</li>
<li>
<p>
<span class="timestamp">&lt;2019-01-06 Sun 18:00&gt;</span>
</p>
<p><span class="timestamp">&lt;2019-01-06 Sun 18:00&gt;</span></p>
</li>
<li>
<p>
<span class="timestamp">&lt;2019-01-06 Sun 18:00 +1w&gt;</span>
</p>
<p><span class="timestamp">&lt;2019-01-06 Sun 18:00 +1w&gt;</span></p>
</li>
</ul>
</li>
<li>
<p>
<code class="verbatim">#+LINK</code> based links: <a href="https://www.example.com/foobar">https://www.example.com/foobar</a>
</p>
<p><code class="verbatim">#+LINK</code> based links: <a href="https://www.example.com/foobar">https://www.example.com/foobar</a></p>
</li>
<li>
<p>
<code class="verbatim">#+MACROs</code>: <p>
<h1>yolo</h1>
</p>
<p><code class="verbatim">#+MACROs</code>: <p><h1>yolo</h1></p>
</p>
</li>
</ul>

View file

@ -10,17 +10,14 @@ and <span style="text-decoration: underline;">multiple</span> lines of <strong>c
</figcaption>
</figure>
<p>
and an image with custom html attributes and a caption
</p>
and an image with custom html attributes and a caption</p>
<figure>
<img src="https://placekitten.com/200/200#.png" alt="https://placekitten.com/200/200#.png" title="https://placekitten.com/200/200#.png" style="height: 100%; border: 10px solid black;" id="kittens"/>
<figcaption>
kittens!
</figcaption>
</figure>
<p>
named paragraph
</p>
<p>named paragraph</p>
<div class="src src-text">
<div class="highlight">
<pre>

View file

@ -1,43 +1,27 @@
<p>
without latex delimiters the <code class="verbatim">_{i=1}</code> in <code class="verbatim">\sum_{i=1}^n a_n</code> is interpreted as subscript.
we support <code class="verbatim">\(...\)</code>, <code class="verbatim">\[...\]</code>, <code class="verbatim">$$...$$</code> and <code class="verbatim">\begin{$env}...\end{$env}</code> as latex fragment delimiters.
</p>
<p>without latex delimiters the <code class="verbatim">_{i=1}</code> in <code class="verbatim">\sum_{i=1}^n a_n</code> is interpreted as subscript.
we support <code class="verbatim">\(...\)</code>, <code class="verbatim">\[...\]</code>, <code class="verbatim">$$...$$</code> and <code class="verbatim">\begin{$env}...\end{$env}</code> as latex fragment delimiters.</p>
<ul>
<li>
<p>
<sub>i=1</sub>^n a_n (without latex delimiter)
</p>
<p><sub>i=1</sub>^n a_n (without latex delimiter)</p>
</li>
<li>
<p>
\(\sum_{i=1}^n a_n\)
</p>
<p>\(\sum_{i=1}^n a_n\)</p>
</li>
<li>
<p>
\[\sum_{i=1}^n a_n\]
</p>
<p>\[\sum_{i=1}^n a_n\]</p>
</li>
<li>
<p>
$$\sum_{i=1}^n a_n$$
</p>
<p>$$\sum_{i=1}^n a_n$$</p>
</li>
<li>
<p>
\begin{xyz}\sum_{i=1}^n a_n\end{xyz}
</p>
<p>\begin{xyz}\sum_{i=1}^n a_n\end{xyz}</p>
</li>
<li>
<p>
\begin{xyz}
<p>\begin{xyz}
\sum_{i=1}^n a_n
\end{xyz}
</p>
\end{xyz}</p>
</li>
<li>
<p>
$2 + 2$, $3 - 3$
</p>
<p>$2 + 2$, $3 - 3$</p>
</li>
</ul>

View file

@ -1,64 +1,44 @@
<ul>
<li class="unchecked">
<p>
unordered list item 1
</p>
<p>unordered list item 1</p>
</li>
<li>
<p>
list item with empty first and second line <br>
normally an empty line breaks the list item - but we make an exception for the first line and don&#39;t count it towards that limit
</p>
normally an empty line breaks the list item - but we make an exception for the first line and don&#39;t count it towards that limit</p>
</li>
<li>
<p>
unordered list item 2 - with <code>inline</code> <em>markup</em>
</p>
<p>unordered list item 2 - with <code>inline</code> <em>markup</em></p>
<ol>
<li class="indeterminate">
<p>
ordered sublist item 1
</p>
<p>ordered sublist item 1</p>
<ol>
<li class="checked">
<p>
ordered sublist item 1
</p>
<p>ordered sublist item 1</p>
</li>
<li class="unchecked">
<p>
ordered sublist item 2
</p>
<p>ordered sublist item 2</p>
</li>
<li class="checked">
<p>
ordered sublist item 3
</p>
<p>ordered sublist item 3</p>
</li>
</ol>
</li>
<li>
<p>
ordered sublist item 2
</p>
<p>ordered sublist item 2</p>
</li>
<li>
<p>
list item with empty first and second line - see above
</p>
list item with empty first and second line - see above</p>
</li>
</ol>
</li>
<li class="checked">
<p>
unordered list item 3 - and a <a href="https://example.com">link</a>
and some lines of text
</p>
<p>unordered list item 3 - and a <a href="https://example.com">link</a>
and some lines of text</p>
<ol>
<li>
<p>
and another subitem
</p>
<p>and another subitem</p>
<div class="src src-sh">
<div class="highlight">
<pre>
@ -68,9 +48,7 @@ echo with a block
</div>
</li>
<li>
<p>
and another one with a table
</p>
<p>and another one with a table</p>
<table>
<thead>
<tr>
@ -88,15 +66,12 @@ and another one with a table
</tbody>
</table>
<p>
and text with an empty line in between as well!
</p>
and text with an empty line in between as well!</p>
</li>
</ol>
</li>
<li>
<p>
unordered list item 4
</p>
<p>unordered list item 4</p>
<pre class="example">
with an example
@ -105,33 +80,27 @@ that spans multiple lines
</li>
</ul>
<p>
descriptive lists
</p>
descriptive lists</p>
<dl>
<dt class="unchecked">
term
</dt>
<dd>
<p>
details
continued details
</p>
<p>details
continued details</p>
</dd>
<dt class="unchecked">
?
</dt>
<dd>
<p>
details without a term
</p>
<p>details without a term</p>
</dd>
<dt class="checked">
term
</dt>
<dd>
<p>
details on a new line
</p>
details on a new line</p>
</dd>
<dt>
term
@ -139,8 +108,7 @@ term
<dd>
<p>
details on a new line (with an empty line in between)
<strong>continued</strong>
</p>
<strong>continued</strong></p>
<div class="src src-bash">
<div class="highlight">
<pre>
@ -150,67 +118,45 @@ echo &#34;Hello World!&#34;
</div>
</dd>
</dl>
<p>
some list termination tests
</p>
<p>some list termination tests</p>
<ul>
<li>
<p>
unordered 1
</p>
<p>unordered 1</p>
</li>
<li>
<p>
unordered 2
</p>
<p>unordered 2</p>
</li>
</ul>
<ol>
<li>
<p>
ordered 1
</p>
<p>ordered 1</p>
</li>
<li>
<p>
ordered 2
</p>
<p>ordered 2</p>
</li>
</ol>
<ol>
<li>
<p>
ordered 1
</p>
<p>ordered 1</p>
</li>
<li>
<p>
ordered 2
</p>
<p>ordered 2</p>
</li>
</ol>
<ul>
<li>
<p>
unordered 1
</p>
<p>unordered 1</p>
</li>
<li>
<p>
unordered 2
</p>
<p>unordered 2</p>
</li>
</ul>
<ol>
<li>
<p>
ordered 1
</p>
<p>ordered 1</p>
</li>
<li>
<p>
ordered 2
</p>
<p>ordered 2</p>
</li>
</ol>
<dl>
@ -218,17 +164,13 @@ ordered 2
unordered descriptive
</dt>
<dd>
<p>
1
</p>
<p>1</p>
</dd>
<dt>
unordered descriptive
</dt>
<dd>
<p>
2
</p>
<p>2</p>
</dd>
</dl>
<dl>
@ -236,28 +178,20 @@ unordered descriptive
ordered descriptive
</dt>
<dd>
<p>
1
</p>
<p>1</p>
</dd>
<dt>
ordered descriptive
</dt>
<dd>
<p>
2
</p>
<p>2</p>
</dd>
</dl>
<ul>
<li>
<p>
unordered 1
</p>
<p>unordered 1</p>
</li>
<li>
<p>
unordered 2
</p>
<p>unordered 2</p>
</li>
</ul>

195
org/testdata/misc.html vendored
View file

@ -1,6 +1,4 @@
<h1 class="title"><p>
Misc title <b>with an inline html export</b>
</p>
<h1 class="title"><p>Misc title <b>with an inline html export</b></p>
</h1>
<nav>
<ul>
@ -93,43 +91,32 @@ issues from goorgeous (free test cases, yay!)
<a href="https://github.com/chaseadamsio/goorgeous/issues/29">#29:</a> Support verse block
</h4>
<div class="verse-block">
<p>
This
<p>This
<strong>is</strong>
verse
</p>
verse</p>
</div>
<div class="custom-block">
<p>
or even a <strong>totally</strong> <em>custom</em> kind of block
crazy ain&#39;t it?
</p>
<p>or even a <strong>totally</strong> <em>custom</em> kind of block
crazy ain&#39;t it?</p>
</div>
<h4 id="headline-4">
<span class="todo">DONE</span>
<a href="https://github.com/chaseadamsio/goorgeous/issues/30">#30</a>: Support #+SETUPFILE
</h4>
<p>
see <code class="verbatim">./headlines.org</code>
</p>
<p>see <code class="verbatim">./headlines.org</code></p>
<h4 id="headline-5">
<span class="todo">DONE</span>
<a href="https://github.com/chaseadamsio/goorgeous/issues/31">#31</a>: Support #+INCLUDE
</h4>
<p>
Note that only src/example/export block inclusion is supported for now.
<p>Note that only src/example/export block inclusion is supported for now.
There&#39;s quite a lot more to include (see the <a href="https://orgmode.org/manual/Include-files.html">org manual for include files</a>) but I
don&#39;t have a use case for this yet and stuff like namespacing footnotes of included files
adds quite a bit of complexity.
</p>
adds quite a bit of complexity.</p>
<p>
for now files can be included as:
</p>
for now files can be included as:</p>
<ul>
<li>
<p>
src block
</p>
<p>src block</p>
<div class="src src-org">
<div class="highlight">
<pre>
@ -179,28 +166,20 @@ you get the gist...
</div>
</li>
<li>
<p>
export block
</p>
<p>
Paragraphs are the default element.
</p>
<p>export block</p>
<p>Paragraphs are the default element.</p>
<p>
Empty lines and other elements end paragraphs - but paragraphs
can
obviously
span
multiple
lines.
</p>
lines.</p>
<p>
Paragraphs can contain inline markup like <em>emphasis</em> <strong>strong</strong> and links <a href="https://www.example.com">example.com</a> and stuff.
</p>
Paragraphs can contain inline markup like <em>emphasis</em> <strong>strong</strong> and links <a href="https://www.example.com">example.com</a> and stuff.</p>
</li>
<li>
<p>
example block
</p>
<p>example block</p>
<pre class="example">
language: go
go: &#34;1.x&#34;
@ -247,73 +226,53 @@ deploy:
</h4>
<ul>
<li>
<p>
ndash
</p>
<p>ndash </p>
</li>
<li>
<p>
mdash —
</p>
<p>mdash —</p>
</li>
<li>
<p>
ellipsis …
</p>
<p>ellipsis …</p>
</li>
<li>
<p>
acute Á and so on
</p>
<p>acute Á and so on</p>
</li>
<li>
<p>
note that —— is replaced with 2 mdashes and …. becomes ellipsis+. and so on - that&#39;s how org also does it
</p>
<p>note that —— is replaced with 2 mdashes and …. becomes ellipsis+. and so on - that&#39;s how org also does it</p>
</li>
</ul>
<h4 id="headline-9">
<span class="todo">DONE</span>
<a href="https://github.com/chaseadamsio/goorgeous/issues/47">#47:</a> Consecutive <code>code</code> wrapped text gets joined
</h4>
<p>
either <code>this</code> or <code>that</code> foo.
<p>either <code>this</code> or <code>that</code> foo.
either <code>this</code>
or <code>that</code> foo.
</p>
or <code>that</code> foo.</p>
<h4 id="headline-10">
<span class="todo">DONE</span>
<a href="https://github.com/chaseadamsio/goorgeous/issues/50">#50</a>: LineBreaks in lists are preserved
</h4>
<ul>
<li>
<p>
this list item
<p>this list item
has
multiple
linbreaks - but it&#39;s still just one paragraph (i.e. no line breaks are rendered)
</p>
linbreaks - but it&#39;s still just one paragraph (i.e. no line breaks are rendered)</p>
</li>
<li>
<p>
foobar
</p>
<p>foobar</p>
</li>
</ul>
<ol>
<li>
<p>
same
<p>same
goes
for
ordered
lists
</p>
lists</p>
</li>
<li>
<p>
foo
</p>
<p>foo</p>
</li>
</ol>
<h4 id="headline-11">
@ -321,9 +280,7 @@ foo
<a href="https://github.com/chaseadamsio/goorgeous/issues/68">#68</a>: Quote block with inline markup
</h4>
<blockquote>
<p>
<a href="https://www.example.com"><em>this</em> <strong>is</strong> <span style="text-decoration: underline;">markup</span>!</a>
</p>
<p><a href="https://www.example.com"><em>this</em> <strong>is</strong> <span style="text-decoration: underline;">markup</span>!</a></p>
</blockquote>
<h4 id="headline-12">
<span class="todo">DONE</span>
@ -336,14 +293,10 @@ foo
</h4>
<ul>
<li>
<p>
bullet 1
</p>
<p>bullet 1</p>
<ul>
<li>
<p>
sub bullet
</p>
<p>sub bullet</p>
</li>
</ul>
</li>
@ -356,13 +309,10 @@ sub bullet
<span class="todo">DONE</span>
<a href="https://github.com/chaseadamsio/goorgeous/issues/78">#78</a>: Emphasis at beginning of line
</h4>
<p>
<em>italics</em>
</p>
<p><em>italics</em></p>
<p>
Text
<em>italics</em>
</p>
<em>italics</em></p>
<h4 id="headline-16">
<span class="todo">DONE</span>
<a href="https://github.com/chaseadamsio/goorgeous/issues/82">#82</a>: Crash on empty headline
@ -370,9 +320,7 @@ Text
<h5 id="headline-17">
</h5>
<p>
just a space as title…
</p>
<p>just a space as title…</p>
<h4 id="headline-18">
<span class="todo">DONE</span>
<a href="https://github.com/chaseadamsio/goorgeous/issues/84">#84</a>: Paragraphs that are not followed by an empty line are not parsed correctly
@ -380,47 +328,31 @@ just a space as title…
<h5 id="headline-19">
Foo
</h5>
<p>
Foo paragraph.
</p>
<p>Foo paragraph.</p>
<h5 id="headline-20">
Bar
</h5>
<p>
Bar paragraph
</p>
<p>Bar paragraph</p>
<h4 id="headline-21">
<span class="todo">DONE</span>
<a href="https://github.com/chaseadamsio/goorgeous/issues/86">#86</a>: Multiple hyphens not converted to dashes
</h4>
<p>
just like #46
</p>
<p>just like #46</p>
<ul>
<li>
<p>
<code class="verbatim">--</code> -&gt; (en dash)
</p>
<p><code class="verbatim">--</code> -&gt; (en dash)</p>
</li>
<li>
<p>
<code class="verbatim">---</code> -&gt; — (em dash)
</p>
<p><code class="verbatim">---</code> -&gt; — (em dash)</p>
</li>
</ul>
<p>
also, consecutive dashes inside
</p>
<p>also, consecutive dashes inside</p>
<ul>
<li>
<p>
inline code <code class="verbatim">--</code> <code class="verbatim">---</code> and verbatim <code>--</code> <code>---</code>
</p>
<p>inline code <code class="verbatim">--</code> <code class="verbatim">---</code> and verbatim <code>--</code> <code>---</code></p>
</li>
<li>
<p>
src/example/export blocks should not be converted!
</p>
<p>src/example/export blocks should not be converted!</p>
<div class="src src-sh">
<div class="highlight">
<pre>
@ -441,21 +373,15 @@ src/example/export blocks should not be converted!
<span class="todo">DONE</span>
<a href="https://github.com/chaseadamsio/goorgeous/issues/87">#87</a>: Markup in footnotes is rendered literally
</h4>
<p>
footnotes can contain <strong>markup</strong> - and other elements and stuff <sup class="footnote-reference"><a id="footnote-reference-1" href="#footnote-1">1</a></sup> <sup class="footnote-reference"><a id="footnote-reference-2" href="#footnote-2">2</a></sup>
</p>
<p>footnotes can contain <strong>markup</strong> - and other elements and stuff <sup class="footnote-reference"><a id="footnote-reference-1" href="#footnote-1">1</a></sup> <sup class="footnote-reference"><a id="footnote-reference-2" href="#footnote-2">2</a></sup></p>
<h4 id="headline-23">
<span class="todo">DONE</span>
<a href="https://github.com/chaseadamsio/goorgeous/issues/92">#92</a>: src blocks only render in caps
</h4>
<p>
The behaviour of Org mode <code class="verbatim">&lt;s TAB</code> changed and it now inserts lowercased src blocks (go-org already handled this one)
</p>
<p>The behaviour of Org mode <code class="verbatim">&lt;s TAB</code> changed and it now inserts lowercased src blocks (go-org already handled this one)</p>
<ul>
<li>
<p>
lowercased:
</p>
<p>lowercased:</p>
<div class="src src-bash">
<div class="highlight">
<pre>
@ -465,9 +391,7 @@ uname -a
</div>
</li>
<li>
<p>
uppercased
</p>
<p>uppercased</p>
<div class="src src-bash">
<div class="highlight">
<pre>
@ -483,12 +407,9 @@ issues (wrongly) filed with hugo
<h4 id="headline-25">
<a href="https://github.com/gohugoio/hugo/issues/3874">#3874</a> exporting images in org mode
</h4>
<p>Hello, I&#39;m writing hugo blogs using org-mode.</p>
<p>
Hello, I&#39;m writing hugo blogs using org-mode.
</p>
<p>
When inserting an image link like <img src="/home/amos/Pictures/Screenshots/img-2017-09-11-165647.png" alt="/home/amos/Pictures/Screenshots/img-2017-09-11-165647.png" title="/home/amos/Pictures/Screenshots/img-2017-09-11-165647.png" />, hugo doesn&#39;t export the image.
</p>
When inserting an image link like <img src="/home/amos/Pictures/Screenshots/img-2017-09-11-165647.png" alt="/home/amos/Pictures/Screenshots/img-2017-09-11-165647.png" title="/home/amos/Pictures/Screenshots/img-2017-09-11-165647.png" />, hugo doesn&#39;t export the image.</p>
<h4 id="headline-26">
<a href="https://github.com/gohugoio/hugo/issues/4006">#4006</a> source code blocks in org not rendered correctly
</h4>
@ -516,9 +437,7 @@ index out of range in headline priority parsing
<h4 id="headline-30">
index out of range in explicit line break parsing
</h4>
<p>
0\\
</p>
<p>0\\ </p>
<h2 id="headline-31">
Footnotes
</h2>
@ -528,19 +447,13 @@ Footnotes
<div class="footnote-definition">
<sup id="footnote-1"><a href="#footnote-reference-1">1</a></sup>
<div class="footnote-body">
<p>
a footnote <em>with</em> <strong>markup</strong>
</p>
<p>a footnote <em>with</em> <strong>markup</strong></p>
<ul>
<li>
<p>
and a <strong>list</strong>
</p>
<p>and a <strong>list</strong></p>
</li>
<li>
<p>
because that&#39;s possible
</p>
<p>because that&#39;s possible</p>
</li>
</ul>
</div>
@ -548,9 +461,7 @@ because that&#39;s possible
<div class="footnote-definition">
<sup id="footnote-2"><a href="#footnote-reference-2">2</a></sup>
<div class="footnote-body">
<p>
that also goes for <strong>inline</strong> footnote <em>definitions</em>
</p>
<p>that also goes for <strong>inline</strong> footnote <em>definitions</em></p>
</div>
</div>
</div>

View file

@ -3,14 +3,12 @@
<span class="priority">[A]</span>
<code class="verbatim">#+OPTIONS:</code> toggles supported by <code class="verbatim">go-org</code>&#xa0;&#xa0;&#xa0;<span class="tags"><span>tag1</span>&#xa0;<span>tag2</span></span>
</h2>
<p>
<code class="verbatim">go-org</code> supports multiple export toggles as described in the <a href="https://orgmode.org/manual/Export-settings.html">export settings</a> section of the Org mode manual.
<p><code class="verbatim">go-org</code> supports multiple export toggles as described in the <a href="https://orgmode.org/manual/Export-settings.html">export settings</a> section of the Org mode manual.
By default (most of?) those toggles are enabled. This file starts with <code class="verbatim">#+OPTIONS: toc:nil f:nil e:nil</code> and thus
disables the table of contents, footnotes &amp; entities.
That means, entities like <code class="verbatim">---</code> --- (mdash) will be left untouched, footnotes like <code class="verbatim">[fn:1]</code> will
not be exported and there won&#39;t be a table of contents at the top.
As buffer options are merged with the defaults, the above headline will be exported <strong>with</strong> priority, todo status &amp; tags.
</p>
As buffer options are merged with the defaults, the above headline will be exported <strong>with</strong> priority, todo status &amp; tags.</p>
<table>
<thead>
<tr>

View file

@ -1,14 +1,10 @@
<p>
Paragraphs are the default element.
</p>
<p>Paragraphs are the default element.</p>
<p>
Empty lines and other elements end paragraphs - but paragraphs
can
obviously
span
multiple
lines.
</p>
lines.</p>
<p>
Paragraphs can contain inline markup like <em>emphasis</em> <strong>strong</strong> and links <a href="https://www.example.com">example.com</a> and stuff.
</p>
Paragraphs can contain inline markup like <em>emphasis</em> <strong>strong</strong> and links <a href="https://www.example.com">example.com</a> and stuff.</p>