git.iko.soy/typeable/pandoc
on master help sign in
Added some entity tests in Markdown reader tests.

Change types of divs. From Docbook "sect#" and "simplesect" to "level#" and "section." Add tests. Add mention of TEI to README. Small changes to TEI writer.

commit4d74a966c4dae72f627696e6440f8ac530965d6c authorJohn MacFarlane <jgm@berkeley.edu> dateFri 8 Jan 2016, 17:33 (11 years ago) parent25a9ca6
3 files changed+25−22
README+8−7 src/Text/Pandoc/Writers/TEI.hs+6−6 tests/Tests/Writers/TEI.hs+11−9
README+8−7
@@ -22,7 +22,7 @@ markup], [Haddock markup], [OPML], [Emacs Org mode], [DocBook],
2222[OpenDocument], [ODT], [Word docx], [GNU Texinfo], [MediaWiki markup],
2323[DokuWiki markup], [Haddock markup], [EPUB] (v2 or v3),
2424[FictionBook2], [Textile], [groff man] pages, [Emacs Org mode],
25−[AsciiDoc], [InDesign ICML], and [Slidy], [Slideous], [DZSlides],
25+[AsciiDoc], [InDesign ICML], [TEI XML], and [Slidy], [Slideous], [DZSlides],
2626[reveal.js] or [S5] HTML slide shows. It can also produce [PDF] output
2727on systems where LaTeX, ConTeXt, or `wkhtmltopdf` is installed.
2828
@@ -89,6 +89,7 @@ Markdown can be expected to be lossy.
8989[reveal.js]: http://lab.hakim.se/reveal-js/
9090[FictionBook2]: http://www.fictionbook.org/index.php/Eng:XML_Schema_Fictionbook_2.1
9191[InDesign ICML]: https://www.adobe.com/content/dam/Adobe/en/devnet/indesign/cs55-docs/IDML/idml-specification.pdf
92+[TEI Simple]: https://github.com/TEIC/TEI-Simple
9293
9394Using `pandoc`
9495--------------
@@ -277,11 +278,11 @@ General options
277278 `docx` (Word docx), `haddock` (Haddock markup), `rtf` (rich text
278279 format), `epub` (EPUB v2 book), `epub3` (EPUB v3), `fb2`
279280 (FictionBook2 e-book), `asciidoc` (AsciiDoc), `icml` (InDesign
280− ICML), `slidy` (Slidy HTML and javascript slide show), `slideous`
281− (Slideous HTML and javascript slide show), `dzslides` (DZSlides
282− HTML5 + javascript slide show), `revealjs` (reveal.js HTML5 +
283− javascript slide show), `s5` (S5 HTML and javascript slide show),
284− or the path of a custom lua writer (see [Custom
281+ ICML), `tei` (TEI Simple), `slidy` (Slidy HTML and javascript slide
282+ show), `slideous` (Slideous HTML and javascript slide show),
283+ `dzslides` (DZSlides HTML5 + javascript slide show), `revealjs`
284+ (reveal.js HTML5 + javascript slide show), `s5` (S5 HTML and javascript
285+ slide show), or the path of a custom lua writer (see [Custom
285286 writers], below). Note that `odt`, `epub`, and
286287 `epub3` output will not be directed to *stdout*; an output
287288 filename must be specified using the `-o/--output` option. If
@@ -471,7 +472,7 @@ General writer options
471472`-s`, `--standalone`
472473
473474: Produce output with an appropriate header and footer (e.g. a
474− standalone HTML, LaTeX, or RTF file, not a fragment). This option
475+ standalone HTML, LaTeX, TEI, or RTF file, not a fragment). This option
475476 is set automatically for `pdf`, `epub`, `epub3`, `fb2`, `docx`, and `odt`
476477 output.
477478
src/Text/Pandoc/Writers/TEI.hs+6−6
@@ -92,8 +92,8 @@ elementToTEI opts lvl (Sec _ _num (id',_,_) title elements) =
9292 else elements
9393 divType = case lvl of
9494 n | n == 0 -> "chapter"
95− | n >= 1 && n <= 5 -> "sect" ++ show n
96− | otherwise -> "simplesect"
95+ | n >= 1 && n <= 5 -> "level" ++ show n
96+ | otherwise -> "section"
9797 in inTags True "div" [("type", divType) | not (null id')] $
9898-- ("id", writerIdentifierPrefix opts ++ id') | not (null id')] $
9999 inTagsSimple "head" (inlinesToTEI opts title) $$
@@ -181,7 +181,7 @@ blockToTEI _ (CodeBlock (_,classes,_) str) =
181181 else languagesByExtension . map toLower $ s
182182 langs = concatMap langsFrom classes
183183blockToTEI opts (BulletList lst) =
184− let attribs = [("type", "bullet") | isTightList lst]
184+ let attribs = [("type", "unordered")]
185185 in inTags True "list" attribs $ listItemsToTEI opts lst
186186blockToTEI _ (OrderedList _ []) = empty
187187blockToTEI opts (OrderedList (start, numstyle, _) (first:rest)) =
@@ -277,9 +277,9 @@ inlineToTEI _ (Math t str) =
277277 DisplayMath -> inTags True "figure" [("type","math")] $
278278 inTags False "formula" [("notation","TeX")] $ text (str)
279279
280−inlineToTEI _ (RawInline f x) | f == "html" || f == "tei" = text x
281− | otherwise = empty
282−inlineToTEI _ LineBreak = text ""
280+inlineToTEI _ (RawInline f x) | f == "tei" = text x
281+ | otherwise = empty
282+inlineToTEI _ LineBreak = selfClosingTag "lb" []
283283inlineToTEI _ Space = space
284284-- because we use \n for LineBreak, we can't do soft breaks:
285285inlineToTEI _ SoftBreak = space
tests/Tests/Writers/TEI.hs+11−9
@@ -27,15 +27,17 @@ infix 4 =:
2727tests :: [Test]
2828tests = [ testGroup "block elements"
2929 ["para" =: para "Lorem ipsum cetera."
30− =?> "<p>Lorem ipsum cetera.</p>"
30+ =?> "<p>Lorem ipsum cetera.</p>"
3131 ]
32−-- ]
33−-- , testGroup "lists"
34−-- [
35−-- ]
3632 , testGroup "inlines"
3733 [
38− "Emphasis" =: emph ("emphasized")
39− =?> "<hi rendition=\"simple:italic\">emphasized</hi>"
40− ]
41− ]
34+ "Emphasis" =: emph ("emphasized")
35+ =?> "<p><hi rendition=\"simple:italic\">emphasized</hi></p>"
36+ ,"SingleQuoted" =: singleQuoted (text "quoted material")
37+ =?> "<p><quote>quoted material</quote></p>"
38+ ,"DoubleQuoted" =: doubleQuoted (text "quoted material")
39+ =?> "<p><quote>quoted material</quote></p>"
40+ ,"NestedQuoted" =: doubleQuoted (singleQuoted (text "quoted material"))
41+ =?> "<p><quote><quote>quoted material</quote></quote></p>"
42+ ]
43+ ]