git.iko.soy/typeable/pandoc
on master help sign in
Use pandoc-types 1.9.*.
commit78816497f3d1691daf5c1a43f9bd8b8908f6f312 authorJohn MacFarlane <fiddlosopher@gmail.com> dateTue 13 Dec 2011, 14:29 (15 years ago) parentbab0c33
7 files changed+49−49
pandoc.cabal+2−2 src/Tests/Arbitrary.hs+3−3 src/Tests/Readers/LaTeX.hs+26−25 src/Tests/Readers/Markdown.hs+10−11 src/Tests/Readers/RST.hs+6−6 src/Tests/Writers/HTML.hs+1−1 src/Tests/Writers/Markdown.hs+1−1
pandoc.cabal+2−2
@@ -218,7 +218,7 @@ Library
218218 random >= 1 && < 1.1,
219219 extensible-exceptions >= 0.1 && < 0.2,
220220 citeproc-hs >= 0.3.4 && < 0.4,
221− pandoc-types == 1.8.*,
221+ pandoc-types == 1.9.*,
222222 json >= 0.4 && < 0.6,
223223 dlist >= 0.4 && < 0.6,
224224 tagsoup >= 0.12.5 && < 0.13,
@@ -306,7 +306,7 @@ Executable pandoc
306306 random >= 1 && < 1.1,
307307 extensible-exceptions >= 0.1 && < 0.2,
308308 citeproc-hs >= 0.3.4 && < 0.4,
309− pandoc-types == 1.8.*,
309+ pandoc-types == 1.9.*,
310310 json >= 0.4 && < 0.6,
311311 dlist >= 0.4 && < 0.6,
312312 tagsoup >= 0.12.5 && < 0.13,
src/Tests/Arbitrary.hs+3−3
@@ -1,5 +1,5 @@
11{-# OPTIONS_GHC -fno-warn-orphans #-}
2−{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-}
2+{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, ScopedTypeVariables #-}
33-- provides Arbitrary instance for Pandoc types
44module Tests.Arbitrary ()
55where
@@ -22,10 +22,10 @@ arbAttr = do
2222 return (id',classes,keyvals)
2323
2424instance Arbitrary Inlines where
25− arbitrary = liftM fromList arbitrary
25+ arbitrary = liftM (fromList :: [Inline] -> Inlines) arbitrary
2626
2727instance Arbitrary Blocks where
28− arbitrary = liftM fromList arbitrary
28+ arbitrary = liftM (fromList :: [Block] -> Blocks) arbitrary
2929
3030instance Arbitrary Inline where
3131 arbitrary = resize 3 $ arbInline 2
src/Tests/Readers/LaTeX.hs+26−25
@@ -7,6 +7,7 @@ import Tests.Helpers
77import Tests.Arbitrary()
88import Text.Pandoc.Builder
99import Text.Pandoc
10+import Data.Monoid (mempty)
1011
1112latex :: String -> Pandoc
1213latex = readLaTeX defaultParserState
@@ -35,10 +36,10 @@ tests = [ testGroup "basic"
3536 "\\subsubsection{header}" =?> header 3 "header"
3637 , "emph" =:
3738 "\\section{text \\emph{emph}}" =?>
38− header 1 ("text" +++ space +++ emph "emph")
39+ header 1 ("text" <> space <> emph "emph")
3940 , "link" =:
4041 "\\section{text \\href{/url}{link}}" =?>
41− header 1 ("text" +++ space +++ link "/url" "" "link")
42+ header 1 ("text" <> space <> link "/url" "" "link")
4243 ]
4344
4445 , testGroup "space and comments"
@@ -67,13 +68,13 @@ baseCitation = Citation{ citationId = "item1"
6768natbibCitations :: Test
6869natbibCitations = testGroup "natbib"
6970 [ "citet" =: "\\citet{item1}"
70− =?> para (cite [baseCitation] empty)
71+ =?> para (cite [baseCitation] mempty)
7172 , "suffix" =: "\\citet[p.~30]{item1}"
7273 =?> para
73− (cite [baseCitation{ citationSuffix = toList $ text "p.\160\&30" }] empty)
74+ (cite [baseCitation{ citationSuffix = toList $ text "p.\160\&30" }] mempty)
7475 , "suffix long" =: "\\citet[p.~30, with suffix]{item1}"
7576 =?> para (cite [baseCitation{ citationSuffix =
76− toList $ text "p.\160\&30, with suffix" }] empty)
77+ toList $ text "p.\160\&30, with suffix" }] mempty)
7778 , "multiple" =: "\\citeauthor{item1} \\citetext{\\citeyear{item1}; \\citeyear[p.~30]{item2}; \\citealp[see also][]{item3}}"
7879 =?> para (cite [baseCitation{ citationMode = AuthorInText }
7980 ,baseCitation{ citationMode = SuppressAuthor
@@ -82,7 +83,7 @@ natbibCitations = testGroup "natbib"
8283 ,baseCitation{ citationId = "item3"
8384 , citationPrefix = [Str "see",Space,Str "also"]
8485 , citationMode = NormalCitation }
85− ] empty)
86+ ] mempty)
8687 , "group" =: "\\citetext{\\citealp[see][p.~34--35]{item1}; \\citealp[also][chap. 3]{item3}}"
8788 =?> para (cite [baseCitation{ citationMode = NormalCitation
8889 , citationPrefix = [Str "see"]
@@ -91,36 +92,36 @@ natbibCitations = testGroup "natbib"
9192 , citationId = "item3"
9293 , citationPrefix = [Str "also"]
9394 , citationSuffix = [Str "chap.",Space,Str "3"] }
94− ] empty)
95+ ] mempty)
9596 , "suffix and locator" =: "\\citep[pp.~33, 35--37, and nowhere else]{item1}"
9697 =?> para (cite [baseCitation{ citationMode = NormalCitation
97− , citationSuffix = [Str "pp.\160\&33,",Space,Str "35",EnDash,Str "37,",Space,Str "and",Space,Str "nowhere",Space, Str "else"] }] empty)
98+ , citationSuffix = [Str "pp.\160\&33,",Space,Str "35",EnDash,Str "37,",Space,Str "and",Space,Str "nowhere",Space, Str "else"] }] mempty)
9899 , "suffix only" =: "\\citep[and nowhere else]{item1}"
99100 =?> para (cite [baseCitation{ citationMode = NormalCitation
100− , citationSuffix = toList $ text "and nowhere else" }] empty)
101+ , citationSuffix = toList $ text "and nowhere else" }] mempty)
101102 , "no author" =: "\\citeyearpar{item1}, and now Doe with a locator \\citeyearpar[p.~44]{item2}"
102− =?> para (cite [baseCitation{ citationMode = SuppressAuthor }] empty +++
103− text ", and now Doe with a locator " +++
103+ =?> para (cite [baseCitation{ citationMode = SuppressAuthor }] mempty <>
104+ text ", and now Doe with a locator " <>
104105 cite [baseCitation{ citationMode = SuppressAuthor
105106 , citationSuffix = [Str "p.\160\&44"]
106− , citationId = "item2" }] empty)
107+ , citationId = "item2" }] mempty)
107108 , "markup" =: "\\citep[\\emph{see}][p. \\textbf{32}]{item1}"
108109 =?> para (cite [baseCitation{ citationMode = NormalCitation
109110 , citationPrefix = [Emph [Str "see"]]
110111 , citationSuffix = [Str "p.",Space,
111− Strong [Str "32"]] }] empty)
112+ Strong [Str "32"]] }] mempty)
112113 ]
113114
114115biblatexCitations :: Test
115116biblatexCitations = testGroup "biblatex"
116117 [ "textcite" =: "\\textcite{item1}"
117− =?> para (cite [baseCitation] empty)
118+ =?> para (cite [baseCitation] mempty)
118119 , "suffix" =: "\\textcite[p.~30]{item1}"
119120 =?> para
120− (cite [baseCitation{ citationSuffix = toList $ text "p.\160\&30" }] empty)
121+ (cite [baseCitation{ citationSuffix = toList $ text "p.\160\&30" }] mempty)
121122 , "suffix long" =: "\\textcite[p.~30, with suffix]{item1}"
122123 =?> para (cite [baseCitation{ citationSuffix =
123− toList $ text "p.\160\&30, with suffix" }] empty)
124+ toList $ text "p.\160\&30, with suffix" }] mempty)
124125 , "multiple" =: "\\textcites{item1}[p.~30]{item2}[see also][]{item3}"
125126 =?> para (cite [baseCitation{ citationMode = AuthorInText }
126127 ,baseCitation{ citationMode = NormalCitation
@@ -129,7 +130,7 @@ biblatexCitations = testGroup "biblatex"
129130 ,baseCitation{ citationId = "item3"
130131 , citationPrefix = [Str "see",Space,Str "also"]
131132 , citationMode = NormalCitation }
132− ] empty)
133+ ] mempty)
133134 , "group" =: "\\autocites[see][p.~34--35]{item1}[also][chap. 3]{item3}"
134135 =?> para (cite [baseCitation{ citationMode = NormalCitation
135136 , citationPrefix = [Str "see"]
@@ -138,24 +139,24 @@ biblatexCitations = testGroup "biblatex"
138139 , citationId = "item3"
139140 , citationPrefix = [Str "also"]
140141 , citationSuffix = [Str "chap.",Space,Str "3"] }
141− ] empty)
142+ ] mempty)
142143 , "suffix and locator" =: "\\autocite[pp.~33, 35--37, and nowhere else]{item1}"
143144 =?> para (cite [baseCitation{ citationMode = NormalCitation
144− , citationSuffix = [Str "pp.\160\&33,",Space,Str "35",EnDash,Str "37,",Space,Str "and",Space,Str "nowhere",Space, Str "else"] }] empty)
145+ , citationSuffix = [Str "pp.\160\&33,",Space,Str "35",EnDash,Str "37,",Space,Str "and",Space,Str "nowhere",Space, Str "else"] }] mempty)
145146 , "suffix only" =: "\\autocite[and nowhere else]{item1}"
146147 =?> para (cite [baseCitation{ citationMode = NormalCitation
147− , citationSuffix = toList $ text "and nowhere else" }] empty)
148+ , citationSuffix = toList $ text "and nowhere else" }] mempty)
148149 , "no author" =: "\\autocite*{item1}, and now Doe with a locator \\autocite*[p.~44]{item2}"
149− =?> para (cite [baseCitation{ citationMode = SuppressAuthor }] empty +++
150− text ", and now Doe with a locator " +++
150+ =?> para (cite [baseCitation{ citationMode = SuppressAuthor }] mempty <>
151+ text ", and now Doe with a locator " <>
151152 cite [baseCitation{ citationMode = SuppressAuthor
152153 , citationSuffix = [Str "p.\160\&44"]
153− , citationId = "item2" }] empty)
154+ , citationId = "item2" }] mempty)
154155 , "markup" =: "\\autocite[\\emph{see}][p. \\textbf{32}]{item1}"
155156 =?> para (cite [baseCitation{ citationMode = NormalCitation
156157 , citationPrefix = [Emph [Str "see"]]
157158 , citationSuffix = [Str "p.",Space,
158− Strong [Str "32"]] }] empty)
159+ Strong [Str "32"]] }] mempty)
159160 , "parencite" =: "\\parencite{item1}"
160− =?> para (cite [baseCitation{ citationMode = NormalCitation }] empty)
161+ =?> para (cite [baseCitation{ citationMode = NormalCitation }] mempty)
161162 ]
src/Tests/Readers/Markdown.hs+10−11
@@ -8,7 +8,6 @@ import Tests.Arbitrary()
88import Text.Pandoc.Builder
99-- import Text.Pandoc.Shared ( normalize )
1010import Text.Pandoc
11−import Data.Sequence (singleton)
1211
1312markdown :: String -> Pandoc
1413markdown = readMarkdown defaultParserState{ stateStandalone = True }
@@ -61,26 +60,26 @@ tests = [ testGroup "inline code"
6160 , testGroup "smart punctuation"
6261 [ test markdownSmart "quote before ellipses"
6362 ("'...hi'"
64− =?> para (singleQuoted (singleton Ellipses +++ "hi")))
63+ =?> para (singleQuoted (singleton Ellipses <> "hi")))
6564 ]
6665 , testGroup "mixed emphasis and strong"
6766 [ "emph and strong emph alternating" =:
6867 "*xxx* ***xxx*** xxx\n*xxx* ***xxx*** xxx"
69− =?> para (emph "xxx" +++ space +++ strong (emph "xxx") +++
70− space +++ "xxx" +++ space +++
71− emph "xxx" +++ space +++ strong (emph "xxx") +++
72− space +++ "xxx")
68+ =?> para (emph "xxx" <> space <> strong (emph "xxx") <>
69+ space <> "xxx" <> space <>
70+ emph "xxx" <> space <> strong (emph "xxx") <>
71+ space <> "xxx")
7372 , "emph with spaced strong" =:
7473 "*x **xx** x*"
75− =?> para (emph ("x" +++ space +++ strong "xx" +++ space +++ "x"))
74+ =?> para (emph ("x" <> space <> strong "xx" <> space <> "x"))
7675 ]
7776 , testGroup "footnotes"
7877 [ "indent followed by newline and flush-left text" =:
7978 "[^1]\n\n[^1]: my note\n\n \nnot in note\n"
80− =?> para (note (para "my note")) +++ para "not in note"
79+ =?> para (note (para "my note")) <> para "not in note"
8180 , "indent followed by newline and indented text" =:
8281 "[^1]\n\n[^1]: my note\n \n in note\n"
83− =?> para (note (para "my note" +++ para "in note"))
82+ =?> para (note (para "my note" <> para "in note"))
8483 , "recursive note" =:
8584 "[^1]\n\n[^1]: See [^1]\n"
8685 =?> para (note (para "See [^1]"))
@@ -90,9 +89,9 @@ tests = [ testGroup "inline code"
9089 "inverse bird tracks and html" $
9190 "> a\n\n< b\n\n<div>\n"
9291 =?> codeBlockWith ("",["sourceCode","literate","haskell"],[]) "a"
93− +++
92+ <>
9493 codeBlockWith ("",["sourceCode","haskell"],[]) "b"
95− +++
94+ <>
9695 rawBlock "html" "<div>\n\n"
9796 ]
9897-- the round-trip properties frequently fail
src/Tests/Readers/RST.hs+6−6
@@ -18,8 +18,8 @@ infix 5 =:
1818
1919tests :: [Test]
2020tests = [ "line block with blank line" =:
21− "| a\n|\n| b" =?> para (str "a" +++ linebreak +++
22− linebreak +++ str " " +++ str "b")
21+ "| a\n|\n| b" =?> para (str "a" <> linebreak <>
22+ linebreak <> str " " <> str "b")
2323 , "field list" =:
2424 [_LIT|
2525:Hostname: media08
@@ -51,10 +51,10 @@ tests = [ "line block with blank line" =:
5151 , "URLs with following punctuation" =:
5252 ("http://google.com, http://yahoo.com; http://foo.bar.baz.\n" ++
5353 "http://foo.bar/baz_(bam) (http://foo.bar)") =?>
54− para (link "http://google.com" "" "http://google.com" +++ ", " +++
55− link "http://yahoo.com" "" "http://yahoo.com" +++ "; " +++
56− link "http://foo.bar.baz" "" "http://foo.bar.baz" +++ ". " +++
54+ para (link "http://google.com" "" "http://google.com" <> ", " <>
55+ link "http://yahoo.com" "" "http://yahoo.com" <> "; " <>
56+ link "http://foo.bar.baz" "" "http://foo.bar.baz" <> ". " <>
5757 link "http://foo.bar/baz_(bam)" "" "http://foo.bar/baz_(bam)"
58− +++ " (" +++ link "http://foo.bar" "" "http://foo.bar" +++ ")")
58+ <> " (" <> link "http://foo.bar" "" "http://foo.bar" <> ")")
5959 ]
6060
src/Tests/Writers/HTML.hs+1−1
@@ -40,7 +40,7 @@ tests = [ testGroup "inline code"
4040 ]
4141 , testGroup "images"
4242 [ "alt with formatting" =:
43− image "/url" "title" ("my " +++ emph "image")
43+ image "/url" "title" ("my " <> emph "image")
4444 =?> "<img src=\"/url\" title=\"title\" alt=\"my image\" />"
4545 ]
4646 ]
src/Tests/Writers/Markdown.hs+1−1
@@ -29,6 +29,6 @@ infix 5 =:
2929
3030tests :: [Test]
3131tests = [ "indented code after list"
32− =: (orderedList [ para "one" +++ para "two" ] +++ codeBlock "test")
32+ =: (orderedList [ para "one" <> para "two" ] <> codeBlock "test")
3333 =?> "1. one\n\n two\n\n<!-- -->\n\n test"
3434 ]