git.iko.soy/typeable/pandoc
on master help sign in
Weak implementation of hyperlinks for dokuwiki (#386)

TODO Simplify the code

commitb2a8731e32c27a230a970b747df13ad84d473b5d authorClare Macrae <clare.macrae@googlemail.com> dateMon 15 Jul 2013, 09:35 (13 years ago) parent660fb24
2 files changed+7−7
src/Text/Pandoc/Writers/DokuWiki.hs+1−1 tests/writer.dokuwiki+6−6
src/Text/Pandoc/Writers/DokuWiki.hs+1−1
@@ -386,7 +386,7 @@ inlineToDokuWiki opts (Link txt (src, _)) = do
386386 case txt of
387387 [Str s] | escapeURI s == src -> return src
388388 _ -> if isURI src
389− then return $ "[" ++ src ++ " " ++ label ++ "]"
389+ then return $ "[[" ++ src ++ "|" ++ label ++ "]]"
390390 else return $ "[[" ++ src' ++ "|" ++ label ++ "]]"
391391 where src' = case src of
392392 '/':xs -> xs -- with leading / it's a
tests/writer.dokuwiki+6−6
@@ -455,7 +455,7 @@ These should not be superscripts or subscripts, because of the unescaped spaces:
455455
456456‘He said, “I want to go.”’ Were you alive in the 70’s?
457457
458−Here is some quoted ‘<code>code</code>’ and a “[http://example.com/?foo=1&bar=2 quoted link]”.
458+Here is some quoted ‘<code>code</code>’ and a “[[http://example.com/?foo=1&bar=2|quoted link]]”.
459459
460460Some dashes: one—two — three—four — five.
461461
@@ -563,7 +563,7 @@ Just a [[url/|URL]].
563563
564564[[url/with_underscore|with_underscore]]
565565
566−[mailto:nobody@nowhere.net Email link]
566+[[mailto:nobody@nowhere.net|Email link]]
567567
568568[[|Empty]].
569569
@@ -594,9 +594,9 @@ Foo [[url/|biz]].
594594
595595===== With ampersands =====
596596
597−Here’s a [http://example.com/?foo=1&bar=2 link with an ampersand in the URL].
597+Here’s a [[http://example.com/?foo=1&bar=2|link with an ampersand in the URL]].
598598
599−Here’s a link with an amersand in the link text: [http://att.com/ AT&amp;T].
599+Here’s a link with an amersand in the link text: [[http://att.com/|AT&amp;T]].
600600
601601Here’s an [[script?foo=1&bar=2|inline link]].
602602
@@ -610,7 +610,7 @@ With an ampersand: http://example.com/?foo=1&bar=2
610610* http://example.com/
611611* It should.
612612
613−An e-mail address: [mailto:nobody@nowhere.net nobody@nowhere.net]
613+An e-mail address: [[mailto:nobody@nowhere.net|nobody@nowhere.net]]
614614
615615<blockquote>Blockquoted: http://example.com/
616616</blockquote>
@@ -640,7 +640,7 @@ Subsequent blocks are indented to show that they belong to the footnote (as with
640640
641641<pre> { &lt;code&gt; }</pre>
642642If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.
643−</ref> This should //not// be a footnote reference, because it contains a space.[^my note] Here is an inline note.<ref>This is //easier// to type. Inline notes may contain [http://google.com links] and <code>]</code> verbatim characters, as well as [bracketed text].
643+</ref> This should //not// be a footnote reference, because it contains a space.[^my note] Here is an inline note.<ref>This is //easier// to type. Inline notes may contain [[http://google.com|links]] and <code>]</code> verbatim characters, as well as [bracketed text].
644644</ref>
645645
646646<blockquote>Notes can go in quotes.<ref>In quote.