diff --git a/src/Text/Pandoc/Writers/FB2.hs b/src/Text/Pandoc/Writers/FB2.hs index e1fa7f474..a46011a8f 100644 --- a/src/Text/Pandoc/Writers/FB2.hs +++ b/src/Text/Pandoc/Writers/FB2.hs @@ -365,10 +365,7 @@ blockToXml h@Header{} = do -- should not occur after hierarchicalize, except inside lists/blockquotes report $ BlockNotRendered h return [] -blockToXml HorizontalRule = return - [ el "empty-line" () - , el "p" (txt (replicate 10 '—')) - , el "empty-line" () ] +blockToXml HorizontalRule = return [ el "empty-line" () ] blockToXml (Table caption aligns _ headers rows) = do hd <- mkrow "th" headers aligns bd <- mapM (\r -> mkrow "td" r aligns) rows @@ -398,7 +395,7 @@ plainToPara [] = [] plainToPara (Plain inlines : rest) = Para inlines : plainToPara rest plainToPara (Para inlines : rest) = - Para inlines : Plain [LineBreak] : plainToPara rest + Para inlines : HorizontalRule : plainToPara rest -- HorizontalRule will be converted to plainToPara (p:rest) = p : plainToPara rest -- Simulate increased indentation level. Will not really work @@ -449,8 +446,8 @@ toXml (Quoted DoubleQuote ss) = do toXml (Cite _ ss) = cMapM toXml ss -- FIXME: support citation styles toXml (Code _ s) = return [el "code" s] toXml Space = return [txt " "] -toXml SoftBreak = return [txt " "] -toXml LineBreak = return [el "empty-line" ()] +toXml SoftBreak = return [txt "\n"] +toXml LineBreak = return [txt "\n"] toXml (Math _ formula) = insertMath InlineImage formula toXml il@(RawInline _ _) = do report $ InlineNotRendered il diff --git a/test/Tests/Writers/FB2.hs b/test/Tests/Writers/FB2.hs index 5a04d9159..7699c58e9 100644 --- a/test/Tests/Writers/FB2.hs +++ b/test/Tests/Writers/FB2.hs @@ -25,8 +25,8 @@ tests = [ testGroup "block elements" ] , testGroup "inlines" [ - "Emphasis" =: emph "emphasized" - =?> fb2 "emphasized" + "Emphasis" =: para (emph "emphasized") + =?> fb2 "

emphasized

" ] , "bullet list" =: bulletList [ plain $ text "first" , plain $ text "second" diff --git a/test/fb2/basic.fb2 b/test/fb2/basic.fb2 index b5dbfc145..df71e8456 100644 --- a/test/fb2/basic.fb2 +++ b/test/fb2/basic.fb2 @@ -1,3 +1,75 @@ -unrecognisedpandoc<p />
<p>Top-level title</p>
<p>Section</p>
<p>Subsection</p>

This emphasized strong verbatim markdown. See this link.

Ordered list:

1. one

2. two

3. three

Blockquote is for citatons.

Code

block

is

for

code.

Strikeout is Pandoc’s extension. Superscript and subscripts too: H2O is a liquid[1]. 210 is 1024.

Math is another Pandoc extension: E = m c^2.

<p>1</p>

Sometimes.

- + + + +unrecognised + + +pandoc + + + + +<p /> + +
+ +<p>Top-level title</p> + +
+ +<p>Section</p> + +
+ +<p>Subsection</p> + +

This emphasized strong verbatim markdown. +See this link.

+

Ordered list:

+

1. one

+

2. two

+

3. three

+ +

Blockquote +is +for +citatons.

+
+ +

+Code +

+

+block +

+

+is +

+

+for +

+

+code. +

+ +

+Strikeout is Pandoc’s extension. +Superscript and subscripts too: H2O is a liquid +[1] +. +210 is 1024.

+

Math is another Pandoc extension: E = m c^2.

+
+
+
+ + +
+ +<p>1</p> + +

Sometimes.

+
+ +
diff --git a/test/tables.fb2 b/test/tables.fb2 index 56ed5316b..6be553df9 100644 --- a/test/tables.fb2 +++ b/test/tables.fb2 @@ -1,3 +1,16 @@ -unrecognisedpandoc<p />

Simple table with caption:

RightLeftCenterDefault
12121212
123123123123
1111

Demonstration of simple table syntax.

Simple table without caption:

RightLeftCenterDefault
12121212
123123123123
1111

Simple table indented two spaces:

RightLeftCenterDefault
12121212
123123123123
1111

Demonstration of simple table syntax.

Multiline table with caption:

Centered HeaderLeft AlignedRight AlignedDefault aligned
Firstrow12.0Example of a row that spans multiple lines.
Secondrow5.0Here’s another one. Note the blank line between rows.

Here’s the caption. It may span multiple lines.

Multiline table without caption:

Centered HeaderLeft AlignedRight AlignedDefault aligned
Firstrow12.0Example of a row that spans multiple lines.
Secondrow5.0Here’s another one. Note the blank line between rows.

Table without column headers:

12121212
123123123123
1111

Multiline table without column headers:

Firstrow12.0Example of a row that spans multiple lines.
Secondrow5.0Here’s another one. Note the blank line between rows.

+unrecognisedpandoc<p />

Simple table with caption:

RightLeftCenterDefault
12121212
123123123123
1111

Demonstration of simple table syntax.

Simple table without caption:

RightLeftCenterDefault
12121212
123123123123
1111

Simple table indented two spaces:

RightLeftCenterDefault
12121212
123123123123
1111

Demonstration of simple table syntax.

Multiline table with caption:

Centered +HeaderLeft +AlignedRight +AlignedDefault aligned
Firstrow12.0Example of a row that spans +multiple lines.
Secondrow5.0Here’s another one. Note +the blank line between rows.

Here’s the caption. +It may span multiple lines.

Multiline table without caption:

Centered +HeaderLeft +AlignedRight +AlignedDefault aligned
Firstrow12.0Example of a row that spans +multiple lines.
Secondrow5.0Here’s another one. Note +the blank line between rows.

Table without column headers:

12121212
123123123123
1111

Multiline table without column headers:

Firstrow12.0Example of a row that spans +multiple lines.
Secondrow5.0Here’s another one. Note +the blank line between rows.

diff --git a/test/writer.fb2 b/test/writer.fb2 index ceebac65c..b2d002230 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.

@@ -76,8 +75,6 @@

with no blank line

-

——————————

-
@@ -85,11 +82,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.

@@ -98,7 +99,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:

@@ -124,11 +126,10 @@

nested

-

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

+

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

And a following paragraph.

-

——————————

-
@@ -174,8 +175,6 @@ </p> <empty-line /> <empty-line /> -<p>——————————</p> -<empty-line /> </section> <section> <title> @@ -248,7 +247,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 /> @@ -284,13 +284,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

@@ -302,7 +306,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

@@ -319,8 +324,6 @@

M.A. 2007

B. Williams

-

——————————

-
@@ -377,7 +380,8 @@

    red fruit

-

    contains seeds, crisp, pleasant to taste

+

    contains seeds, +crisp, pleasant to taste

@@ -479,8 +483,6 @@

Hr’s:

-

——————————

-
@@ -515,9 +517,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> @@ -526,15 +527,15 @@

“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”.

Some dashes: one—two — three—four — five.

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

Ellipses…and…and….

-

——————————

-
@@ -550,18 +551,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> @@ -595,8 +596,6 @@ <p>Plus: +</p> <p>Minus: -</p> <empty-line /> -<p>——————————</p> -<empty-line /> </section> <section> <title> @@ -681,8 +680,6 @@ </p> <empty-line /> <empty-line /> -<p>——————————</p> -<empty-line /> </section> </section> <section> @@ -693,8 +690,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> @@ -704,7 +699,9 @@ <sup>[1]</sup> </a> and another.<a l:href="#n2" type="note"> <sup>[2]</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="#n3" 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="#n3" type="note"> <sup>[3]</sup> </a> </p> @@ -726,26 +723,33 @@ <title> <p>1</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>2</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>3</p> -

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

+

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

@@ -761,4 +765,3 @@ </section> </body> </FictionBook> -