Skip to content

Commit

Permalink
Fix formatting inside Org Verse blocks not getting rendered
Browse files Browse the repository at this point in the history
  • Loading branch information
kaushalmodi committed Jan 13, 2022
1 parent fb63e22 commit 95a6760
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ox-blackfriday.el
Expand Up @@ -1377,7 +1377,7 @@ contextual information."
(lambda (m)
(org-html--make-string (length m) " "))
ret))
(ret (format "<p class=\"verse\">\n%s</p>" ret)))
(ret (format "<p class=\"verse\">\n\n%s\n</p>" ret)))
ret))


Expand Down
6 changes: 6 additions & 0 deletions test/site/content/posts/consecutive-verses.md
Expand Up @@ -6,6 +6,7 @@ draft = false
+++

<p class="verse">

Tyger Tyger, burning bright,<br />
In the forests of the night;<br />
What immortal hand or eye,<br />
Expand All @@ -17,15 +18,19 @@ On what wings dare he aspire?<br />
What the hand, dare seize the fire?<br />
<br />
&nbsp;&nbsp;&nbsp;-- "The Tyger" _by_ William Blake<br />

</p>

<p class="verse">

Some parts can be **bold**<br />
&nbsp;&nbsp;Some can be `monospace`<br />
&nbsp;&nbsp;&nbsp;&nbsp;Some can be _italic_ too.<br />

</p>

<p class="verse">

What is this life if, full of care,<br />
We have no time to stand and stare.<br />
<br />
Expand All @@ -36,4 +41,5 @@ No time to see, when woods we pass,<br />
Where squirrels hide their nuts in grass.<br />
<br />
&nbsp;&nbsp;&nbsp;-- "Leisure" _by_ William Henry Davis<br />

</p>
2 changes: 2 additions & 0 deletions test/site/content/posts/one-verse.md
Expand Up @@ -10,9 +10,11 @@ but otherwise use normal formatting, you can use the _verse_
construct, which can also be used to format poetry -- [Reference](https://orgmode.org/manual/Paragraphs.html).

<p class="verse">

Great clouds overhead<br />
Tiny black birds rise and fall<br />
Snow covers Emacs<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;-- AlexSchroeder<br />

</p>
14 changes: 14 additions & 0 deletions test/site/content/posts/verse-for-indentation.md
Expand Up @@ -7,7 +7,9 @@ draft = false
Some text before indented text.

<p class="verse">

&nbsp;&nbsp;&nbsp;&nbsp;Text indented by 4 spaces<br />

</p>

Org removes indentation from the first line of the text block even in
Expand All @@ -22,25 +24,33 @@ removed when translating to Markdown.
- More indentation than in the above example:

<p class="verse">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Text indented by 8 spaces<br />

</p>
- Leading blank line followed by indented text:

<p class="verse">

<br />
&nbsp;&nbsp;&nbsp;&nbsp;Text indented by 4 spaces<br />

</p>
- Indented text followed by a trailing blank line:

<p class="verse">

&nbsp;&nbsp;&nbsp;&nbsp;Text indented by 4 spaces<br />
<br />

</p>
- Using tab characters for indentation; each tab character still
constitutes for one `&nbsp;` in HTML.

<p class="verse">

&nbsp;&nbsp;&nbsp;&nbsp;Text indented by 4 tab characters<br />

</p>


Expand All @@ -60,11 +70,13 @@ Only the **first** `>` character immediately following spaces and empty
lines will be removed:

<p class="verse">

<br />
Line 1 above was empty. So the first `>` seen on this line is removed.<br />
Line 3 had no `>` char.<br />
&gt; ← See that this `>` on line 4 is retained even at the beginning of the line.<br />
Line 5 has this &gt; charcter in-between and is retained.<br />

</p>

If someone really wants to have `>` as the first non-blank character
Expand All @@ -83,9 +95,11 @@ Line 5 has this > charcter in-between and is retained.
```

<p class="verse">

<br />
&gt;Line 1 above was empty. So **only** the first `>` seen on this line is removed.<br />
Line 3 had no `>` char.<br />
&gt; ← See that this `>` on line 4 is retained even at the beginning of the line.<br />
Line 5 has this &gt; charcter in-between and is retained.<br />

</p>

0 comments on commit 95a6760

Please sign in to comment.