From f224567d52096fd6219a2a4a4d2b9cbcc5219e7a Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Wed, 4 Apr 2018 02:41:56 +0300 Subject: FB2 writer: represent HorizontalRule as empty line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit HorizontalRule corresponds to
element in the default output format, HTML. Current HTML standard defines
element as "paragraph-level thematic break". In typography it is often represented by extra space or centered asterism ("⁂"), but since FB2 does not support text centering, empty line (similar to extra space) is the only solution. Line breaks, on the other hand, don't generate anymore. Previously line breaks generated element inside paragraph, which is not allowed. So, this commit addresses issue #2424 ("FB2 produced by pandoc doesn't validate"). FB2 does not have a way to represent line breaks inside paragraphs. They are replaced with LF character, which is not rendered by FB2 readers, but at least preserves some information. --- test/writer.fb2 | 106 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 55 insertions(+), 51 deletions(-) (limited to 'test/writer.fb2') diff --git a/test/writer.fb2 b/test/writer.fb2 index 2136a6d8e..641d833cd 100644 --- a/test/writer.fb2 +++ b/test/writer.fb2 @@ -22,9 +22,8 @@

Pandoc Test Suite

-

This is a set of tests for pandoc. Most of them are adapted from John Gruber’s markdown test suite.

- -

——————————

+

This is a set of tests for pandoc. Most of them are adapted from +John Gruber’s markdown test suite.

@@ -78,8 +77,6 @@

with no blank line

-

——————————

-
@@ -87,11 +84,15 @@

Paragraphs

Here’s a regular paragraph.

-

In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Because a hard-wrapped line in the middle of a paragraph looked like a list item.

-

Here’s one with a bullet. * criminey.

-

There should be a hard line breakhere.

- -

——————————

+

In Markdown 1.0.0 and earlier. Version +8. This line turns into a list item. +Because a hard-wrapped line in the +middle of a paragraph looked like a +list item.

+

Here’s one with a bullet. +* criminey.

+

There should be a hard line break +here.

@@ -100,7 +101,8 @@

E-mail style:

-

This is a block quote. It is pretty short.

+

This is a block quote. +It is pretty short.

Code in a block quote:

@@ -126,11 +128,10 @@

nested

-

This should not be a block quote: 2 > 1.

+

This should not be a block quote: 2 +> 1.

And a following paragraph.

-

——————————

-
@@ -176,8 +177,6 @@ </p> <empty-line /> <empty-line /> -<p>——————————</p> -<empty-line /> </section> <section> <title> @@ -250,7 +249,8 @@ <p>Multiple paragraphs:</p> <p>1. Item 1, graf one.</p> <empty-line /> -<p>   Item 1. graf two. The quick brown fox jumped over the lazy dog’s back.</p> +<p>   Item 1. graf two. The quick brown fox jumped over the lazy dog’s +back.</p> <empty-line /> <p>2. Item 2.</p> <empty-line /> @@ -286,13 +286,17 @@ <title> <p>Tabs and spaces</p> -

• this is a list item indented with tabs

+

• this is a list item +indented with tabs

-

• this is a list item indented with spaces

+

• this is a list item +indented with spaces

-

• • this is an example list item indented with tabs

+

• • this is an example list item +indented with tabs

-

• • this is an example list item indented with spaces

+

• • this is an example list item +indented with spaces

@@ -304,7 +308,8 @@

    with a continuation

-

(3) iv. sublist with roman numerals, starting with 4

+

(3) iv. sublist with roman numerals, +starting with 4

(3) v. more items

(3) v. (A) a subsublist

(3) v. (B) a subsublist

@@ -321,8 +326,6 @@

M.A. 2007

B. Williams

-

——————————

-
@@ -379,7 +382,8 @@

    red fruit

-

    contains seeds, crisp, pleasant to taste

+

    contains seeds, +crisp, pleasant to taste

@@ -481,8 +485,6 @@

Hr’s:

-

——————————

-
@@ -518,9 +520,8 @@ <emphasis>hello</emphasis> </sup> a<sup>hello there</sup>.</p> <p>Subscripts: H<sub>2</sub>O, H<sub>23</sub>O, H<sub>many of them</sub>O.</p> -<p>These should not be superscripts or subscripts, because of the unescaped spaces: a^b c^d, a~b c~d.</p> -<empty-line /> -<p>——————————</p> +<p>These should not be superscripts or subscripts, +because of the unescaped spaces: a^b c^d, a~b c~d.</p> <empty-line /> </section> <section> @@ -529,8 +530,10 @@

“Hello,” said the spider. “‘Shelob’ is my name.”

‘A’, ‘B’, and ‘C’ are letters.

-

‘Oak,’ ‘elm,’ and ‘beech’ are names of trees. So is ‘pine.’

-

‘He said, “I want to go.”’ Were you alive in the 70’s?

+

‘Oak,’ ‘elm,’ and ‘beech’ are names of trees. +So is ‘pine.’

+

‘He said, “I want to go.”’ Were you alive in the +70’s?

Here is some quoted ‘code’ and a “quoted link [3] ”.

@@ -538,8 +541,6 @@

Dashes between numbers: 5–7, 255–66, 1987–1999.

Ellipses…and…and….

-

——————————

-
@@ -555,18 +556,18 @@ <p>• <code>223</code> </p> <p>• <code>p</code>-Tree</p> -<p>• Here’s some display math: <code>\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}</code> +<p>• Here’s some display math: +<code>\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}</code> </p> <p>• Here’s one that has a line break in it: <code>\alpha + \omega \times x^2</code>.</p> <p>These shouldn’t be math:</p> <p>• To get the famous equation, write <code>$e = mc^2$</code>.</p> -<p>• $22,000 is a <emphasis>lot</emphasis> of money. So is $34,000. (It worked if “lot” is emphasized.)</p> +<p>• $22,000 is a <emphasis>lot</emphasis> of money. So is $34,000. +(It worked if “lot” is emphasized.)</p> <p>• Shoes ($20) and socks ($5).</p> <p>• Escaped <code>$</code>: $73 <emphasis>this should be emphasized</emphasis> 23$.</p> <p>Here’s a LaTeX table:</p> <empty-line /> -<p>——————————</p> -<empty-line /> </section> <section> <title> @@ -600,8 +601,6 @@ <p>Plus: +</p> <p>Minus: -</p> <empty-line /> -<p>——————————</p> -<empty-line /> </section> <section> <title> @@ -727,8 +726,6 @@ </p> <empty-line /> <empty-line /> -<p>——————————</p> -<empty-line /> </section> </section> <section> @@ -739,8 +736,6 @@ <image l:href="#image1" l:type="imageType" alt="lalune" title="Voyage dans la Lune" /> <p>Here is a movie <image l:href="#image2" l:type="inlineImageType" alt="movie" /> icon.</p> <empty-line /> -<p>——————————</p> -<empty-line /> </section> <section> <title> @@ -750,7 +745,9 @@ <sup>[29]</sup> </a> and another.<a l:href="#n30" type="note"> <sup>[30]</sup> -</a> This should <emphasis>not</emphasis> be a footnote reference, because it contains a space.[^my note] Here is an inline note.<a l:href="#n31" type="note"> +</a> +This should <emphasis>not</emphasis> be a footnote reference, because it +contains a space.[^my note] Here is an inline note.<a l:href="#n31" type="note"> <sup>[31]</sup> </a> </p> @@ -989,28 +986,35 @@ <title> <p>29</p> -

Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.

+

Here is the footnote. It can go anywhere after the footnote +reference. It need not be placed at the end of the document.

<p>30</p> -

Here’s the long note. This one contains multiple blocks.

-

Subsequent blocks are indented to show that they belong to the footnote (as with list items).

+

Here’s the long note. This one contains multiple +blocks.

+

Subsequent blocks are indented to show that they belong to the +footnote (as with list items).

{ <code> }

-

If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.

+

If you want, you can indent every line, but you can also be +lazy and just indent the first line of each block.

<p>31</p> -

This is easier to type. Inline notes may contain links +

This +is easier to type. Inline notes may contain +links [31] - and ] verbatim characters, as well as [bracketed text].

+ and ] verbatim characters, +as well as [bracketed text].

-- cgit v1.2.3