~ubuntu-branches/ubuntu/quantal/pandoc/quantal

« back to all changes in this revision

Viewing changes to src/Tests/Readers/Markdown.hs

  • Committer: Package Import Robot
  • Author(s): Clint Adams, Kiwamu Okabe, Jonas Smedegaard, Clint Adams
  • Date: 2012-03-04 20:35:25 UTC
  • mfrom: (3.1.12 sid)
  • Revision ID: package-import@ubuntu.com-20120304203525-9rr3xli9gxlefshr
Tags: 1.9.1.1-1
* New upstream release.

[ Kiwamu Okabe ]
* Allow DM uploads.
* New debian/watch file to scan pandoc 1.9
* Bump standards-version to 3.9.3.
* Move maintenance to Haskell team, with Jonas and Kiwamu as
  uploaders.
* Add new (build-)dependencies:
  + libghc-blaze-html-*
  + libghc-temporary-*
  + libghc-zlib-*
  Drop obsolete (build-)dependency:
  + libghc-deepseq-*
  Tighten build-dependencies:
  + libghc-http-dev
  + libghc-texmath-dev
  + libghc-pandoc-types-dev
  + libghc-json-dev
  + libghc-highlighting-kate-dev

[ Jonas Smedegaard ]
* Newline-delimit uploaders field.
* Update copyright file:
  + Extend copyright years.
  + Adapt a Files section.
  + Bump copyright format to final version 1.0.
* Update long descriptions:
  + Mention newly supported output formats:
    - Word Docx
    - AsciiDoc
    - DZSlides.
  + Explicitly mention output formats XHTML and HTML 5.
  + Explicitly mention out put (sub)format LaTeX beamer.
  + No longer mention markdown2pdf: Dropped upstream.

[ Clint Adams ]
* Move -doc build dependencies to Build-Depends-Indep.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
import Text.Pandoc.Builder
9
9
-- import Text.Pandoc.Shared ( normalize )
10
10
import Text.Pandoc
11
 
import Data.Sequence (singleton)
12
11
 
13
12
markdown :: String -> Pandoc
14
13
markdown = readMarkdown defaultParserState{ stateStandalone = True }
16
15
markdownSmart :: String -> Pandoc
17
16
markdownSmart = readMarkdown defaultParserState{ stateSmart = True }
18
17
 
19
 
infix 5 =:
 
18
infix 4 =:
20
19
(=:) :: ToString c
21
20
     => String -> (String, c) -> Test
22
21
(=:) = test markdown
44
43
            "`*` {.haskell .special x=\"7\"}"
45
44
            =?> para (codeWith ("",["haskell","special"],[("x","7")]) "*")
46
45
          ]
 
46
        , testGroup "backslash escapes"
 
47
          [ "in URL" =:
 
48
            "[hi](/there\\))"
 
49
            =?> para (link "/there)" "" "hi")
 
50
          , "in title" =:
 
51
            "[hi](/there \"a\\\"a\")"
 
52
            =?> para (link "/there" "a\"a" "hi")
 
53
          , "in reference link title" =:
 
54
            "[hi]\n\n[hi]: /there (a\\)a)"
 
55
            =?> para (link "/there" "a)a" "hi")
 
56
          , "in reference link URL" =:
 
57
            "[hi]\n\n[hi]: /there\\.0"
 
58
            =?> para (link "/there.0" "" "hi")
 
59
          ]
47
60
        , testGroup "smart punctuation"
48
61
          [ test markdownSmart "quote before ellipses"
49
62
            ("'...hi'"
50
 
            =?> para (singleQuoted (singleton Ellipses +++ "hi")))
 
63
            =?> para (singleQuoted ("…hi")))
 
64
          , test markdownSmart "apostrophe before emph"
 
65
            ("D'oh! A l'*aide*!"
 
66
            =?> para ("D’oh! A l’" <> emph "aide" <> "!"))
 
67
          , test markdownSmart "apostrophe in French"
 
68
            ("À l'arrivée de la guerre, le thème de l'«impossibilité du socialisme»"
 
69
            =?> para ("À l’arrivée de la guerre, le thème de l’«impossibilité du socialisme»"))
51
70
          ]
52
71
        , testGroup "mixed emphasis and strong"
53
72
          [ "emph and strong emph alternating" =:
54
73
            "*xxx* ***xxx*** xxx\n*xxx* ***xxx*** xxx"
55
 
            =?> para (emph "xxx" +++ space +++ strong (emph "xxx") +++
56
 
                      space +++ "xxx" +++ space +++
57
 
                      emph "xxx" +++ space +++ strong (emph "xxx") +++
58
 
                      space +++ "xxx")
 
74
            =?> para (emph "xxx" <> space <> strong (emph "xxx") <>
 
75
                      space <> "xxx" <> space <>
 
76
                      emph "xxx" <> space <> strong (emph "xxx") <>
 
77
                      space <> "xxx")
59
78
          , "emph with spaced strong" =:
60
79
            "*x **xx** x*"
61
 
            =?> para (emph ("x" +++ space +++ strong "xx" +++ space +++ "x"))
 
80
            =?> para (emph ("x" <> space <> strong "xx" <> space <> "x"))
62
81
          ]
63
82
        , testGroup "footnotes"
64
83
          [ "indent followed by newline and flush-left text" =:
65
84
            "[^1]\n\n[^1]: my note\n\n     \nnot in note\n"
66
 
            =?> para (note (para "my note")) +++ para "not in note"
 
85
            =?> para (note (para "my note")) <> para "not in note"
67
86
          , "indent followed by newline and indented text" =:
68
87
            "[^1]\n\n[^1]: my note\n     \n    in note\n"
69
 
            =?> para (note (para "my note" +++ para "in note"))
 
88
            =?> para (note (para "my note" <> para "in note"))
70
89
          , "recursive note" =:
71
90
            "[^1]\n\n[^1]: See [^1]\n"
72
91
            =?> para (note (para "See [^1]"))
76
95
              "inverse bird tracks and html" $
77
96
              "> a\n\n< b\n\n<div>\n"
78
97
              =?> codeBlockWith ("",["sourceCode","literate","haskell"],[]) "a"
79
 
                  +++
 
98
                  <>
80
99
                  codeBlockWith ("",["sourceCode","haskell"],[]) "b"
81
 
                  +++
 
100
                  <>
82
101
                  rawBlock "html" "<div>\n\n"
83
102
          ]
84
103
-- the round-trip properties frequently fail