git.iko.soy/typeable/pandoc
on master help sign in
Remove stray <div> and </div> from DokuWiki output (#386)
commit244c4eee7487e386e3e6ff7cf78146385eef9d1f authorClare Macrae <github@cfmacrae.fastmail.co.uk> dateTue 1 Jul 2014, 21:42 (12 years ago) parent0727579
2 files changed+11−23
src/Text/Pandoc/Writers/DokuWiki.hs+2−5 tests/writer.dokuwiki+9−18
src/Text/Pandoc/Writers/DokuWiki.hs+2−5
@@ -34,7 +34,6 @@ DokuWiki: <https://www.dokuwiki.org/dokuwiki>
3434 [ ] Correct handling of Span
3535 [ ] Don't generate <blockquote>...
3636 [ ] Don't generate lists using <ol> and <ul>
37− [ ] Don't generate <div>
3837 [ ] Implement alignment of text in tables
3938 [ ] Implement comments
4039 [ ] Work through the Dokuwiki spec, and check I've not missed anything out
@@ -47,7 +46,6 @@ import Text.Pandoc.Definition
4746import Text.Pandoc.Options
4847import Text.Pandoc.Shared
4948import Text.Pandoc.Writers.Shared
50−import Text.Pandoc.Pretty (render)
5149import Text.Pandoc.Templates (renderTemplate')
5250import Data.List ( intersect, intercalate )
5351import Network.URI ( isURI )
@@ -97,10 +95,9 @@ blockToDokuWiki :: WriterOptions -- ^ Options
9795
9896blockToDokuWiki _ Null = return ""
9997
100−blockToDokuWiki opts (Div attrs bs) = do
98+blockToDokuWiki opts (Div _attrs bs) = do
10199 contents <- blockListToDokuWiki opts bs
102− return $ render Nothing (tagWithAttrs "div" attrs) ++ "\n" ++
103− contents ++ "\n" ++ "</div>"
100+ return $ contents ++ "\n"
104101
105102blockToDokuWiki opts (Plain inlines) =
106103 inlineListToDokuWiki opts inlines
tests/writer.dokuwiki+9−18
@@ -274,21 +274,16 @@ Blank line after term, indented marker, alternate markers:
274274
275275Simple block on one line:
276276
277−<div>
278277foo
279−</div>
278+
280279And nested without indentation:
281280
282−<div>
283−<div>
284−<div>
285281foo
286−</div>
287−</div>
288−<div>
282+
283+
289284bar
290−</div>
291−</div>
285+
286+
292287Interpreted markdown in a table:
293288
294289<html>
@@ -309,9 +304,8 @@ And this is **strong**
309304</html>
310305Here’s a simple block:
311306
312−<div>
313307foo
314−</div>
308+
315309This should be a code block, though:
316310
317311<code><div>
@@ -322,13 +316,10 @@ As should this:
322316<code><div>foo</div></code>
323317Now, nested:
324318
325−<div>
326−<div>
327−<div>
328319foo
329−</div>
330−</div>
331−</div>
320+
321+
322+
332323This should just be an HTML comment:
333324
334325<html>