From 9089e5488054f42441c77c286224dc63081f0e8c Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Sat, 27 Feb 2010 03:57:11 +0000 Subject: [PATCH] Promoted mediawiki headers. = head = is now level 1, == head == level 2, etc. This seems to be correct; it's only by convention that wikipedia articles have level 2 headers at most. Patch due to Eric Kow. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1849 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/Text/Pandoc/Writers/MediaWiki.hs | 2 +- tests/writer.mediawiki | 62 ++++++++++++++-------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/Text/Pandoc/Writers/MediaWiki.hs b/src/Text/Pandoc/Writers/MediaWiki.hs index 572308820..bde5cc9e1 100644 --- a/src/Text/Pandoc/Writers/MediaWiki.hs +++ b/src/Text/Pandoc/Writers/MediaWiki.hs @@ -96,7 +96,7 @@ blockToMediaWiki _ HorizontalRule = return "\n-----\n" blockToMediaWiki opts (Header level inlines) = do contents <- inlineListToMediaWiki opts inlines - let eqs = replicate (level + 1) '=' + let eqs = replicate level '=' return $ eqs ++ " " ++ contents ++ " " ++ eqs ++ "\n" blockToMediaWiki _ (CodeBlock (_,classes,_) str) = do diff --git a/tests/writer.mediawiki b/tests/writer.mediawiki index 6c016bba3..398ff2123 100644 --- a/tests/writer.mediawiki +++ b/tests/writer.mediawiki @@ -3,32 +3,32 @@ This is a set of tests for pandoc. Most of them are adapted from John Gruber&rsq ----- -== Headers == += Headers = -=== Level 2 with an [http://{{SERVERNAME}}/url embedded link] === +== Level 2 with an [http://{{SERVERNAME}}/url embedded link] == -==== Level 3 with ''emphasis'' ==== +=== Level 3 with ''emphasis'' === -===== Level 4 ===== +==== Level 4 ==== -====== Level 5 ====== +===== Level 5 ===== -== Level 1 == += Level 1 = -=== Level 2 with ''emphasis'' === +== Level 2 with ''emphasis'' == -==== Level 3 ==== +=== Level 3 === with no blank line -=== Level 2 === +== Level 2 == with no blank line ----- -== Paragraphs == += Paragraphs = Here’s a regular paragraph. @@ -42,7 +42,7 @@ here. ----- -== Block Quotes == += Block Quotes = E-mail style: @@ -71,7 +71,7 @@ And a following paragraph. ----- -== Code Blocks == += Code Blocks = Code: @@ -90,9 +90,9 @@ These should not be escaped: \$ \\ \> \[ \{ ----- -== Lists == += Lists = -=== Unordered === +== Unordered == Asterisks tight: @@ -130,7 +130,7 @@ Minuses loose: * Minus 2 * Minus 3 -=== Ordered === +== Ordered == Tight: @@ -164,7 +164,7 @@ Multiple paragraphs:
  • Item 2.

  • Item 3.

  • -=== Nested === +== Nested == * Tab ** Tab @@ -192,7 +192,7 @@ Same thing but with paragraphs: # Third -=== Tabs and spaces === +== Tabs and spaces == * this is a list item indented with tabs * this is a list item indented with spaces @@ -200,7 +200,7 @@ Same thing but with paragraphs: ** this is an example list item indented with spaces -=== Fancy list markers === +== Fancy list markers ==
    1. begins with 2
    2. @@ -245,7 +245,7 @@ B. Williams ----- -== Definition Lists == += Definition Lists = Tight using spaces: @@ -314,7 +314,7 @@ Blank line after term, indented marker, alternate markers: ;# sublist -== HTML Blocks == += HTML Blocks = Simple block on one line: @@ -424,7 +424,7 @@ Hr’s: ----- -== Inline Markup == += Inline Markup = This is ''emphasized'', and so ''is this''. @@ -453,7 +453,7 @@ These should not be superscripts or subscripts, because of the unescaped spaces: ----- -== Smart quotes, ellipses, dashes == += Smart quotes, ellipses, dashes = “Hello,” said the spider. “‘Shelob’ is my name.” @@ -474,7 +474,7 @@ Ellipses…and…and…. ----- -== LaTeX == += LaTeX = * * 2+2=4 @@ -499,7 +499,7 @@ Here’s a LaTeX table: ----- -== Special Characters == += Special Characters = Here is some unicode: @@ -554,9 +554,9 @@ Minus: - ----- -== Links == += Links = -=== Explicit === +== Explicit == Just a [http://{{SERVERNAME}}/url/ URL]. @@ -576,7 +576,7 @@ Just a [http://{{SERVERNAME}}/url/ URL]. [http://{{SERVERNAME}}/ Empty]. -=== Reference === +== Reference == Foo [http://{{SERVERNAME}}/url/ bar]. @@ -601,7 +601,7 @@ Foo [http://{{SERVERNAME}}/url/ bar]. Foo [http://{{SERVERNAME}}/url/ biz]. -=== With ampersands === +== With ampersands == Here’s a [http://example.com/?foo=1&bar=2 link with an ampersand in the URL]. @@ -611,7 +611,7 @@ Here’s an [http://{{SERVERNAME}}/script?foo=1&bar=2 inline link]. Here’s an [http://{{SERVERNAME}}/script?foo=1&bar=2 inline link in pointy braces]. -=== Autolinks === +== Autolinks == With an ampersand: http://example.com/?foo=1&bar=2 @@ -629,7 +629,7 @@ Auto-links should not occur here: <http://example.com/> ----- -== Images == += Images = From “Voyage dans la Lune” by Georges Melies (1902): @@ -640,7 +640,7 @@ Here is a movie [[Image:movie.jpg|movie]] icon. ----- -== Footnotes == += Footnotes = Here is a footnote reference,Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document. and another.Here’s the long note. This one contains multiple blocks.