git.iko.soy/typeable/pandoc
on master help sign in
Rewrote test suite so it doesn't depend on perl or unix tools.

+ Replaced old runtests.pl with a Haskell script RunTests.hs. + Added Diff.hs module to be used by RunTests.hs instead of unix 'diff'. + Added test hook to Setup.hs, so tests may be run from cabal. + Changed Makefile's 'test' target to run tests via cabal. + Removed old generate.sh. + Since we no longer have 'sed' to filter out raw HTML sections from the docbook writer test, or raw LaTeX sections from the context writer test, we now just include these sections. They can be taken out if it is necessary to process the files. + Updated latex and context writer tests to remove extra spaces after '\\item' + Added a markdown table reader test. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1385 788f1e2b-df1e-0410-8736-df70ead52e1b

commit5d3d2d79b3e217e3b420e3d56c5e844e5cae5cf1 authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateSat 9 Aug 2008, 16:51 (18 years ago) parentf1914c2
11 files changed+577−293
Makefile+1−1 Setup.hs+11−1 debian/copyright+31 pandoc.cabal+1−1 tests/Diff.hs+76 tests/RunTests.hs+115 tests/generate.sh−15 tests/runtests.pl−110 tests/writer.context+124−76 tests/writer.docbook+129 tests/writer.latex+89−89
Makefile+1−1
@@ -267,7 +267,7 @@ $(win_pkg_name): $(PKG).exe $(win_docs)
267267
268268.PHONY: test test-markdown
269269test: $(MAIN)
270− @cd $(TESTDIR) && perl runtests.pl -s $(PWD)/$(MAIN)
270+ $(BUILDCMD) test
271271compat:=$(PWD)/hsmarkdown
272272markdown_test_dirs:=$(wildcard $(TESTDIR)/MarkdownTest_*)
273273test-markdown: $(MAIN) $(compat)
Setup.hs+11−1
@@ -1,3 +1,13 @@
11import Distribution.Simple
2−main = defaultMain
2+import System.Process ( runCommand, waitForProcess )
3+import System.Directory ( setCurrentDirectory )
4+
5+main = defaultMainWithHooks (simpleUserHooks {runTests = runTestSuite})
6+
7+testDir = "tests"
8+
9+runTestSuite _ _ _ _ = do
10+ setCurrentDirectory testDir
11+ runCommand "runhaskell RunTests.hs" >>= waitForProcess
12+ return ()
313
debian/copyright+31
@@ -124,3 +124,34 @@ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
124124STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
125125ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
126126POSSIBILITY OF SUCH DAMAGE.
127+
128+------------------------------------------------------------------------
129+Diff.hs in tests/
130+from the Diff package v 0.1.2 (Data.Algorithm.Diff)
131+Copyright (c) Stering Clover 2008
132+
133+All rights reserved.
134+
135+Redistribution and use in source and binary forms, with or without
136+modification, are permitted provided that the following conditions
137+are met:
138+1. Redistributions of source code must retain the above copyright
139+ notice, this list of conditions and the following disclaimer.
140+2. Redistributions in binary form must reproduce the above copyright
141+ notice, this list of conditions and the following disclaimer in the
142+ documentation and/or other materials provided with the distribution.
143+3. Neither the name of the author nor the names of his contributors
144+ may be used to endorse or promote products derived from this software
145+ without specific prior written permission.
146+
147+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
148+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
149+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
150+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
151+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
152+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
153+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
154+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
155+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
156+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
157+SUCH DAMAGE.
pandoc.cabal+1−1
@@ -1,7 +1,7 @@
11Name: pandoc
22Version: 0.47
33Cabal-Version: >= 1.2
4−Build-Type: Simple
4+Build-Type: Custom
55License: GPL
66License-File: COPYING
77Copyright: (c) 2006-2008 John MacFarlane
tests/Diff.hsnew file+76
@@ -0,0 +1,76 @@
1+-----------------------------------------------------------------------------
2+-- |
3+-- Module : Data.Algorithm.Diff
4+-- Copyright : (c) Sterling Clover 2008
5+-- License : BSD 3 Clause
6+-- Maintainer : s.clover@gmail.com
7+-- Stability : experimental
8+-- Portability : portable
9+--
10+-- This is an implementation of the O(ND) diff algorithm as described in
11+-- \"An O(ND) Difference Algorithm and Its Variations (1986)\"
12+-- <http://citeseer.ist.psu.edu/myers86ond.html>. It is O(mn) in space.
13+-- The algorithm is the same one used by standared Unix diff.
14+-- The assumption is that users of this library will want to diff over
15+-- interesting things or peform interesting tasks with the results
16+-- (given that, otherwise, they would simply use the standard Unix diff
17+-- utility). Thus no attempt is made to present a fancier API to aid
18+-- in doing standard and uninteresting things with the results.
19+-----------------------------------------------------------------------------
20+
21+module Diff (DI(..), getDiff, getGroupedDiff) where
22+import Data.Array
23+import Data.List
24+
25+-- | Difference Indicator. A value is either from the First list, the Second
26+-- or from Both.
27+data DI = F | S | B deriving (Show, Eq)
28+
29+data DL = DL {poi::Int, poj::Int, path::[DI]} deriving (Show, Eq)
30+
31+instance Ord DL where x <= y = poi x <= poi y
32+
33+canDiag :: (Eq a) => [a] -> [a] -> Int -> Int -> (Int, Int) -> Bool
34+canDiag as bs lena lenb = \(i,j) ->
35+ if i < lena && j < lenb then arAs ! i == arBs ! j else False
36+ where arAs = listArray (0,lena - 1) as
37+ arBs = listArray (0,lenb - 1) bs
38+
39+chunk :: Int -> [a] -> [[a]]
40+chunk x = unfoldr (\a -> case splitAt x a of ([],[]) -> Nothing; a' -> Just a')
41+
42+dstep :: ((Int,Int)->Bool) -> [DL] -> [DL]
43+dstep cd dls = map maximum $ [hd]:(chunk 2 rst)
44+ where (hd:rst) = concatMap extend dls
45+ extend dl = let pdl = path dl
46+ in [addsnake cd $ dl {poi=poi dl + 1, path=(F : pdl)},
47+ addsnake cd $ dl {poj=poj dl + 1, path=(S : pdl)}]
48+
49+addsnake :: ((Int,Int)->Bool) -> DL -> DL
50+addsnake cd dl
51+ | cd (pi, pj) = addsnake cd $
52+ dl {poi = pi + 1, poj = pj + 1, path=(B : path dl)}
53+ | otherwise = dl
54+ where pi = poi dl; pj = poj dl
55+
56+lcs :: (Eq a) => [a] -> [a] -> [DI]
57+lcs as bs = path . head . dropWhile (\dl -> poi dl /= lena || poj dl /= lenb) .
58+ concat . iterate (dstep cd) . (:[]) . addsnake cd $
59+ DL {poi=0,poj=0,path=[]}
60+ where cd = canDiag as bs lena lenb
61+ lena = length as; lenb = length bs
62+
63+-- | Takes two lists and returns a list indicating the differences
64+-- between them.
65+getDiff :: (Eq t) => [t] -> [t] -> [(DI, t)]
66+getDiff a b = markup a b . reverse $ lcs a b
67+ where markup (x:xs) ys (F:ds) = (F, x) : markup xs ys ds
68+ markup xs (y:ys) (S:ds) = (S, y) : markup xs ys ds
69+ markup (x:xs) (_:ys) (B:ds) = (B, x) : markup xs ys ds
70+ markup _ _ _ = []
71+
72+-- | Takes two lists and returns a list indicating the differences
73+-- between them, grouped into chunks.
74+getGroupedDiff :: (Eq t) => [t] -> [t] -> [(DI, [t])]
75+getGroupedDiff a b = map go . groupBy (\x y -> fst x == fst y) $ getDiff a b
76+ where go ((d,x) : xs) = (d, x : map snd xs)
tests/RunTests.hsnew file+115
@@ -0,0 +1,115 @@
1+{-# OPTIONS_GHC -Wall #-}
2+-- RunTests.hs - run test suite for pandoc
3+-- This script is designed to be run from the tests directory.
4+-- It assumes the pandoc executable is in dist/build/pandoc.
5+
6+module Main where
7+import System.Exit
8+import System.IO.UTF8
9+import System.IO ( openTempFile, stderr )
10+import Prelude hiding ( putStrLn, putStr, readFile )
11+import System.Process ( runProcess, waitForProcess )
12+import System.FilePath ( (</>), (<.>) )
13+import System.Directory
14+import System.Exit
15+import Text.Printf
16+import Diff
17+
18+pandocPath :: FilePath
19+pandocPath = ".." </> "dist" </> "build" </> "pandoc" </> "pandoc"
20+
21+data TestResult = TestPassed
22+ | TestError ExitCode
23+ | TestFailed [(DI, String)]
24+ deriving (Eq)
25+
26+instance Show TestResult where
27+ show TestPassed = "PASSED"
28+ show (TestError ec) = "ERROR " ++ show ec
29+ show (TestFailed d) = "FAILED\n" ++ showDiff d
30+
31+showDiff :: [(DI, String)] -> String
32+showDiff [] = ""
33+showDiff ((F, ln) : ds) = "|TEST| " ++ ln ++ "\n" ++ showDiff ds
34+showDiff ((S, ln) : ds) = "|NORM| " ++ ln ++ "\n" ++ showDiff ds
35+showDiff ((B, _ ) : ds) = showDiff ds
36+
37+writerFormats :: [String]
38+writerFormats = [ "native"
39+ , "html"
40+ , "docbook"
41+ , "opendocument"
42+ , "latex"
43+ , "context"
44+ , "texinfo"
45+ , "man"
46+ , "markdown"
47+ , "rst"
48+ , "mediawiki"
49+ , "rtf"
50+ ]
51+
52+main :: IO ()
53+main = do
54+ r1s <- mapM runWriterTest writerFormats
55+ r2 <- runS5WriterTest "basic" ["-s"] "s5"
56+ r3 <- runS5WriterTest "fancy" ["-s","-m","-i"] "s5"
57+ r4 <- runS5WriterTest "fragment" [] "html"
58+ r5 <- runS5WriterTest "inserts" ["-s", "-H", "insert",
59+ "-B", "insert", "-A", "insert", "-c", "main.css"] "html"
60+ r6 <- runTest "markdown reader" ["-r", "markdown", "-w", "native", "-s", "-S"]
61+ "testsuite.txt" "testsuite.native"
62+ r7 <- runTest "markdown reader (tables)" ["-r", "markdown", "-w", "native"]
63+ "tables.txt" "tables.native"
64+ r8 <- runTest "rst reader" ["-r", "rst", "-w", "native", "-s", "-S"]
65+ "rst-reader.rst" "rst-reader.native"
66+ r9 <- runTest "html reader" ["-r", "html", "-w", "native", "-s"]
67+ "html-reader.html" "html-reader.native"
68+ r10 <- runTest "latex reader" ["-r", "latex", "-w", "native", "-s", "-R"]
69+ "latex-reader.latex" "latex-reader.native"
70+ r11 <- runTest "native reader" ["-r", "native", "-w", "native", "-s"]
71+ "testsuite.native" "testsuite.native"
72+ let results = r1s ++ [r2, r3, r4, r5, r6, r7, r8, r9, r10, r11]
73+ if all id results
74+ then do
75+ putStrLn "\nAll tests passed."
76+ exitWith ExitSuccess
77+ else do
78+ let failures = length $ filter not results
79+ putStrLn $ "\n" ++ show failures ++ " tests failed."
80+ exitWith (ExitFailure failures)
81+
82+runWriterTest :: String -> IO Bool
83+runWriterTest format = do
84+ r1 <- runTest (format ++ " writer") ["-r", "native", "-s", "-w", format] "testsuite.native" ("writer" <.> format)
85+ r2 <- runTest (format ++ " writer (tables)") ["-r", "native", "-w", format] "tables.native" ("tables" <.> format)
86+ return (r1 && r2)
87+
88+runS5WriterTest :: String -> [String] -> String -> IO Bool
89+runS5WriterTest modifier opts format = runTest (format ++ " writer (" ++ modifier ++ ")")
90+ (["-r", "native", "-w", format] ++ opts) "s5.native" ("s5." ++ modifier <.> "html")
91+
92+-- | Run a test, return True if test passed.
93+runTest :: String -- ^ Title of test
94+ -> [String] -- ^ Options to pass to pandoc
95+ -> String -- ^ Input filepath
96+ -> FilePath -- ^ Norm (for test results) filepath
97+ -> IO Bool
98+runTest testname opts inp norm = do
99+ (outputPath, hOut) <- openTempFile "" "pandoc-test"
100+ let inpPath = inp
101+ let normPath = norm
102+ -- Note: COLUMNS must be set for markdown table reader
103+ ph <- runProcess pandocPath (opts ++ [inpPath]) Nothing (Just [("COLUMNS", "80")]) Nothing (Just hOut) (Just stderr)
104+ ec <- waitForProcess ph
105+ result <- if ec == ExitSuccess
106+ then do
107+ outputContents <- readFile outputPath
108+ normContents <- readFile normPath
109+ if outputContents == normContents
110+ then return TestPassed
111+ else return $ TestFailed $ getDiff (lines outputContents) (lines normContents)
112+ else return $ TestError ec
113+ removeFile outputPath
114+ putStrLn $ printf "%-28s ---> %s" testname (show result)
115+ return (result == TestPassed)
tests/generate.shdeleted−15
@@ -1,15 +0,0 @@
1−#!/bin/sh
2−
3−../pandoc -r native -s -w native testsuite.native > writer.native
4−../pandoc -r native -s -w markdown testsuite.native > writer.markdown
5−../pandoc -r native -s -w rst testsuite.native > writer.rst
6−../pandoc -r native -s -w html testsuite.native > writer.html
7−../pandoc -r native -s -w latex testsuite.native > writer.latex
8−../pandoc -r native -s -w texinfo testsuite.native > writer.texinfo
9−../pandoc -r native -s -w rtf testsuite.native > writer.rtf
10−../pandoc -r native -s -w man testsuite.native > writer.man
11−../pandoc -r native -s -w mediawiki testsuite.native > writer.mediawiki
12−../pandoc -r native -s -w opendocument testsuite.native > writer.opendocument
13−sed -e '/^, Header 1 \[Str "HTML",Space,Str "Blocks"\]/,/^, HorizontalRule/d' testsuite.native | ../pandoc -r native -w docbook -s > writer.docbook
14−sed -e '/^, Header 1 \[Str "LaTeX"\]/,/^, HorizontalRule/d' testsuite.native | ../pandoc -r native -w context -s > writer.context
15−
tests/runtests.pldeleted−110
@@ -1,110 +0,0 @@
1−#!/bin/perl -w
2−
3−$verbose = 1;
4−my $diffexists = `which diff`;
5−if ($diffexists eq "") { die "diff not found in path.\n"; }
6−
7−my $script = "COLUMNS=78 ./pandoc";
8−
9−use Getopt::Long;
10−GetOptions("script=s" => \$script);
11−
12−unless (-f $script) { die "$script does not exist.\n"; }
13−unless (-x $script) { die "$script is not executable.\n"; }
14−
15−print "Writer tests:\n";
16−
17−my @writeformats = ("html", "latex", "texinfo", "rst", "rtf", "markdown", "mediawiki", "opendocument", "man", "native"); # docbook, context, and s5 handled separately
18−my $source = "testsuite.native";
19−
20−sub test_results
21−{
22− my $testname = $_[0];
23− my $output = $_[1];
24− my $norm = $_[2];
25− my $diffoutput = `diff --strip-trailing-cr $output $norm`;
26− if ($diffoutput eq "")
27− {
28− print "passed\n";
29− }
30− else
31− {
32− print "FAILED\n";
33− if ($verbose) { print $diffoutput; }
34− }
35−}
36−
37−foreach my $format (@writeformats)
38−{
39− $options = "";
40−
41− my $extension = $format;
42− print "Testing $format writer...";
43−
44− `$script -r native -w $extension $options -s $source > tmp.$extension`;
45−
46− test_results("$format writer", "tmp.$extension", "writer.$format");
47−
48− print " $format tables...";
49−
50− `$script -r native -w $extension tables.native > tmp.$extension`;
51−
52− test_results("$format writer", "tmp.$extension", "tables.$format");
53−}
54−
55−print "Testing docbook writer...";
56−# remove HTML block tests, as this produces invalid docbook...
57−`sed -e '/^, Header 1 \\[Str "HTML",Space,Str "Blocks"\\]/,/^, HorizontalRule/d' testsuite.native | $script -r native -w docbook -s > tmp.docbook`;
58−test_results("docbook writer", "tmp.docbook", "writer.docbook");
59−`$script -r native -w docbook tables.native > tmp.docbook`;
60−print " docbook tables...";
61−test_results("docbook tables", "tmp.docbook", "tables.docbook");
62−
63−print "Testing context writer...";
64−# remove LaTeX tests, as this produces invalid docbook...
65−`sed -e '/^, Header 1 \\[Str "LaTeX"\\]/,/^, HorizontalRule/d' testsuite.native | $script -r native -w context -s > tmp.context`;
66−test_results("context writer", "tmp.context", "writer.context");
67−`$script -r native -w context tables.native > tmp.context`;
68−print " context tables...";
69−test_results("context tables", "tmp.context", "tables.context");
70−
71−print "Testing s5 writer (basic)...";
72−`$script -r native -w s5 -s s5.native > tmp.html`;
73−test_results("s5 writer (basic)", "tmp.html", "s5.basic.html");
74−
75−print "Testing s5 writer (fancy)...";
76−`$script -r native -w s5 -s -m -i s5.native > tmp.html`;
77−test_results("s5 writer (fancy)", "tmp.html", "s5.fancy.html");
78−
79−print "Testing html fragment...";
80−`$script -r native -w html s5.native > tmp.html`;
81−test_results("html fragment", "tmp.html", "s5.fragment.html");
82−
83−print "Testing -H -B -A -c options...";
84−`$script -r native -s -w html -H insert -B insert -A insert -c main.css s5.native > tmp.html`;
85−test_results("-B, -A, -H, -c options", "tmp.html", "s5.inserts.html");
86−
87−print "\nReader tests:\n";
88−
89−print "Testing markdown reader...";
90−`$script -r markdown -w native -s -S testsuite.txt > tmp.native`;
91−test_results("markdown reader", "tmp.native", "testsuite.native");
92−
93−print "Testing rst reader...";
94−`$script -r rst -w native -s rst-reader.rst > tmp.native`;
95−test_results("rst reader", "tmp.native", "rst-reader.native");
96−
97−print "Testing html reader...";
98−`$script -r html -w native -s html-reader.html > tmp.native`;
99−test_results("html reader", "tmp.native", "html-reader.native");
100−
101−print "Testing latex reader...";
102−`$script -r latex -w native -R -s latex-reader.latex > tmp.native`;
103−test_results("latex reader", "tmp.native", "latex-reader.native");
104−
105−print "Testing native reader...";
106−`$script -r native -w native -s testsuite.native > tmp.native`;
107−test_results("native reader", "tmp.native", "testsuite.native");
108−
109−`rm tmp.*`;
110−
tests/writer.context+124−76
@@ -139,9 +139,9 @@ sub status {
139139A list:
140140
141141\startitemize[n][stopper=.]
142−\item
142+\item
143143 item one
144−\item
144+\item
145145 item two
146146\stopitemize
147147
@@ -193,66 +193,66 @@ These should not be escaped: \$ \\ \> \[ \{
193193Asterisks tight:
194194
195195\startitemize
196−\item
196+\item
197197 asterisk 1
198−\item
198+\item
199199 asterisk 2
200−\item
200+\item
201201 asterisk 3
202202\stopitemize
203203
204204Asterisks loose:
205205
206206\startitemize
207−\item
207+\item
208208 asterisk 1
209−\item
209+\item
210210 asterisk 2
211−\item
211+\item
212212 asterisk 3
213213\stopitemize
214214
215215Pluses tight:
216216
217217\startitemize
218−\item
218+\item
219219 Plus 1
220−\item
220+\item
221221 Plus 2
222−\item
222+\item
223223 Plus 3
224224\stopitemize
225225
226226Pluses loose:
227227
228228\startitemize
229−\item
229+\item
230230 Plus 1
231−\item
231+\item
232232 Plus 2
233−\item
233+\item
234234 Plus 3
235235\stopitemize
236236
237237Minuses tight:
238238
239239\startitemize
240−\item
240+\item
241241 Minus 1
242−\item
242+\item
243243 Minus 2
244−\item
244+\item
245245 Minus 3
246246\stopitemize
247247
248248Minuses loose:
249249
250250\startitemize
251−\item
251+\item
252252 Minus 1
253−\item
253+\item
254254 Minus 2
255−\item
255+\item
256256 Minus 3
257257\stopitemize
258258
@@ -261,71 +261,71 @@ Minuses loose:
261261Tight:
262262
263263\startitemize[n][stopper=.]
264−\item
264+\item
265265 First
266−\item
266+\item
267267 Second
268−\item
268+\item
269269 Third
270270\stopitemize
271271
272272and:
273273
274274\startitemize[n][stopper=.]
275−\item
275+\item
276276 One
277−\item
277+\item
278278 Two
279−\item
279+\item
280280 Three
281281\stopitemize
282282
283283Loose using tabs:
284284
285285\startitemize[n][stopper=.]
286−\item
286+\item
287287 First
288−\item
288+\item
289289 Second
290−\item
290+\item
291291 Third
292292\stopitemize
293293
294294and using spaces:
295295
296296\startitemize[n][stopper=.]
297−\item
297+\item
298298 One
299−\item
299+\item
300300 Two
301−\item
301+\item
302302 Three
303303\stopitemize
304304
305305Multiple paragraphs:
306306
307307\startitemize[n][stopper=.]
308−\item
308+\item
309309 Item 1, graf one.
310310
311311 Item 1. graf two. The quick brown fox jumped over the lazy dog's
312312 back.
313−\item
313+\item
314314 Item 2.
315−\item
315+\item
316316 Item 3.
317317\stopitemize
318318
319319\subsubject{Nested}
320320
321321\startitemize
322−\item
322+\item
323323 Tab
324324 \startitemize
325− \item
325+ \item
326326 Tab
327327 \startitemize
328− \item
328+ \item
329329 Tab
330330 \stopitemize
331331 \stopitemize
@@ -334,54 +334,54 @@ Multiple paragraphs:
334334Here's another:
335335
336336\startitemize[n][stopper=.]
337−\item
337+\item
338338 First
339−\item
339+\item
340340 Second:
341341 \startitemize
342− \item
342+ \item
343343 Fee
344− \item
344+ \item
345345 Fie
346− \item
346+ \item
347347 Foe
348348 \stopitemize
349−\item
349+\item
350350 Third
351351\stopitemize
352352
353353Same thing but with paragraphs:
354354
355355\startitemize[n][stopper=.]
356−\item
356+\item
357357 First
358−\item
358+\item
359359 Second:
360360
361361 \startitemize
362− \item
362+ \item
363363 Fee
364− \item
364+ \item
365365 Fie
366− \item
366+ \item
367367 Foe
368368 \stopitemize
369−\item
369+\item
370370 Third
371371\stopitemize
372372
373373\subsubject{Tabs and spaces}
374374
375375\startitemize
376−\item
376+\item
377377 this is a list item indented with tabs
378−\item
378+\item
379379 this is a list item indented with spaces
380380
381381 \startitemize
382− \item
382+ \item
383383 this is an example list item indented with tabs
384− \item
384+ \item
385385 this is an example list item indented with spaces
386386 \stopitemize
387387\stopitemize
@@ -389,22 +389,22 @@ Same thing but with paragraphs:
389389\subsubject{Fancy list markers}
390390
391391\startitemize[n][start=2,left=(,stopper=),width=2.0em]
392−\item
392+\item
393393 begins with 2
394−\item
394+\item
395395 and now 3
396396
397397 with a continuation
398398
399399 \startitemize[r][start=4,stopper=.,width=2.0em]
400− \item
400+ \item
401401 sublist with roman numerals, starting with 4
402− \item
402+ \item
403403 more items
404404 \startitemize[A][left=(,stopper=),width=2.0em]
405− \item
405+ \item
406406 a subsublist
407− \item
407+ \item
408408 a subsublist
409409 \stopitemize
410410 \stopitemize
@@ -413,16 +413,16 @@ Same thing but with paragraphs:
413413Nesting:
414414
415415\startitemize[A][stopper=.]
416−\item
416+\item
417417 Upper Alpha
418418 \startitemize[R][stopper=.]
419− \item
419+ \item
420420 Upper Roman.
421421 \startitemize[n][start=6,left=(,stopper=),width=2.0em]
422− \item
422+ \item
423423 Decimal start with 6
424424 \startitemize[a][start=3,stopper=)]
425− \item
425+ \item
426426 Lower alpha with paren
427427 \stopitemize
428428 \stopitemize
@@ -432,12 +432,12 @@ Nesting:
432432Autonumbering:
433433
434434\startitemize[n]
435−\item
435+\item
436436 Autonumber.
437−\item
437+\item
438438 More.
439439 \startitemize[a]
440− \item
440+ \item
441441 Nested.
442442 \stopitemize
443443\stopitemize
@@ -624,20 +624,68 @@ Ellipses\ldots{}and\ldots{}and\ldots{}.
624624
625625\thinrule
626626
627+\subject{LaTeX}
628+
629+\startitemize
630+\item
631+ \cite[22-23]{smith.1899}
632+\item
633+ \doublespacing
634+\item
635+ $2+2=4$
636+\item
637+ $x \in y$
638+\item
639+ $\alpha \wedge \omega$
640+\item
641+ $223$
642+\item
643+ $p$-Tree
644+\item
645+ $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$
646+\item
647+ Here's one that has a line break in it:
648+ $\alpha + \omega \times x^2$.
649+\stopitemize
650+
651+These shouldn't be math:
652+
653+\startitemize
654+\item
655+ To get the famous equation, write \type{$e = mc^2$}.
656+\item
657+ \$22,000 is a {\em lot} of money. So is \$34,000. (It worked if
658+ \quotation{lot} is emphasized.)
659+\item
660+ Shoes (\$20) and socks (\$5).
661+\item
662+ Escaped \type{$}: \$73 {\em this should be emphasized} 23\$.
663+\stopitemize
664+
665+Here's a LaTeX table:
666+
667+\begin{tabular}{|l|l|}\hline
668+Animal & Number \\ \hline
669+Dog & 2 \\
670+Cat & 1 \\ \hline
671+\end{tabular}
672+
673+\thinrule
674+
627675\subject{Special Characters}
628676
629677Here is some unicode:
630678
631679\startitemize
632−\item
680+\item
633681 I hat: Î
634−\item
682+\item
635683 o umlaut: ö
636−\item
684+\item
637685 section: §
638−\item
686+\item
639687 set membership: ∈
640−\item
688+\item
641689 copyright: ©
642690\stopitemize
643691
@@ -754,11 +802,11 @@ With an ampersand:
754802\useURL[27][http://example.com/?foo=1&bar=2][][http://example.com/?foo=1\&bar=2]\from[27]
755803
756804\startitemize
757−\item
805+\item
758806 In a list?
759−\item
807+\item
760808 \useURL[28][http://example.com/][][http://example.com/]\from[28]
761−\item
809+\item
762810 It should.
763811\stopitemize
764812
@@ -826,7 +874,7 @@ Notes can go in quotes.
826874\stopblockquote
827875
828876\startitemize[n][stopper=.]
829−\item
877+\item
830878 And in list items.
831879 \footnote{In list.}
832880\stopitemize
tests/writer.docbook+129
@@ -757,6 +757,135 @@ These should not be escaped: \$ \\ \&gt; \[ \{
757757 </varlistentry>
758758 </variablelist>
759759 </section>
760+ <section>
761+ <title>HTML Blocks</title>
762+ <para>
763+ Simple block on one line:
764+ </para>
765+ <div>
766+ foo
767+ </div>
768+
769+ <para>
770+ And nested without indentation:
771+ </para>
772+ <div>
773+<div>
774+<div>
775+ foo
776+ </div>
777+</div>
778+<div>
779+ bar
780+ </div>
781+</div>
782+
783+ <para>
784+ Interpreted markdown in a table:
785+ </para>
786+ <table>
787+<tr>
788+<td>
789+ This is <emphasis>emphasized</emphasis>
790+ </td>
791+<td>
792+ And this is <emphasis role="strong">strong</emphasis>
793+ </td>
794+</tr>
795+</table>
796+
797+<script type="text/javascript">document.write('This *should not* be interpreted as markdown');</script>
798+
799+ <para>
800+ Here's a simple block:
801+ </para>
802+ <div>
803+
804+ foo
805+ </div>
806+
807+ <para>
808+ This should be a code block, though:
809+ </para>
810+ <screen>
811+&lt;div&gt;
812+ foo
813+&lt;/div&gt;
814+</screen>
815+ <para>
816+ As should this:
817+ </para>
818+ <screen>
819+&lt;div&gt;foo&lt;/div&gt;
820+</screen>
821+ <para>
822+ Now, nested:
823+ </para>
824+ <div>
825+ <div>
826+ <div>
827+
828+ foo
829+ </div>
830+ </div>
831+</div>
832+
833+ <para>
834+ This should just be an HTML comment:
835+ </para>
836+ <!-- Comment -->
837+
838+ <para>
839+ Multiline:
840+ </para>
841+ <!--
842+Blah
843+Blah
844+-->
845+
846+<!--
847+ This is another comment.
848+-->
849+
850+ <para>
851+ Code block:
852+ </para>
853+ <screen>
854+&lt;!-- Comment --&gt;
855+</screen>
856+ <para>
857+ Just plain comment, with trailing spaces on the line:
858+ </para>
859+ <!-- foo -->
860+
861+ <para>
862+ Code:
863+ </para>
864+ <screen>
865+&lt;hr /&gt;
866+</screen>
867+ <para>
868+ Hr's:
869+ </para>
870+ <hr>
871+
872+<hr />
873+
874+<hr />
875+
876+<hr>
877+
878+<hr />
879+
880+<hr />
881+
882+<hr class="foo" id="bar" />
883+
884+<hr class="foo" id="bar" />
885+
886+<hr class="foo" id="bar">
887+
888+ </section>
760889 <section>
761890 <title>Inline Markup</title>
762891 <para>
tests/writer.latex+89−89
@@ -83,9 +83,9 @@ sub status {
8383A list:
8484
8585\begin{enumerate}[1.]
86−\item
86+\item
8787 item one
88−\item
88+\item
8989 item two
9090\end{enumerate}
9191Nested block quotes:
@@ -134,69 +134,69 @@ These should not be escaped: \$ \\ \> \[ \{
134134Asterisks tight:
135135
136136\begin{itemize}
137−\item
137+\item
138138 asterisk 1
139−\item
139+\item
140140 asterisk 2
141−\item
141+\item
142142 asterisk 3
143143\end{itemize}
144144Asterisks loose:
145145
146146\begin{itemize}
147−\item
147+\item
148148 asterisk 1
149149
150−\item
150+\item
151151 asterisk 2
152152
153−\item
153+\item
154154 asterisk 3
155155
156156\end{itemize}
157157Pluses tight:
158158
159159\begin{itemize}
160−\item
160+\item
161161 Plus 1
162−\item
162+\item
163163 Plus 2
164−\item
164+\item
165165 Plus 3
166166\end{itemize}
167167Pluses loose:
168168
169169\begin{itemize}
170−\item
170+\item
171171 Plus 1
172172
173−\item
173+\item
174174 Plus 2
175175
176−\item
176+\item
177177 Plus 3
178178
179179\end{itemize}
180180Minuses tight:
181181
182182\begin{itemize}
183−\item
183+\item
184184 Minus 1
185−\item
185+\item
186186 Minus 2
187−\item
187+\item
188188 Minus 3
189189\end{itemize}
190190Minuses loose:
191191
192192\begin{itemize}
193−\item
193+\item
194194 Minus 1
195195
196−\item
196+\item
197197 Minus 2
198198
199−\item
199+\item
200200 Minus 3
201201
202202\end{itemize}
@@ -205,75 +205,75 @@ Minuses loose:
205205Tight:
206206
207207\begin{enumerate}[1.]
208−\item
208+\item
209209 First
210−\item
210+\item
211211 Second
212−\item
212+\item
213213 Third
214214\end{enumerate}
215215and:
216216
217217\begin{enumerate}[1.]
218−\item
218+\item
219219 One
220−\item
220+\item
221221 Two
222−\item
222+\item
223223 Three
224224\end{enumerate}
225225Loose using tabs:
226226
227227\begin{enumerate}[1.]
228−\item
228+\item
229229 First
230230
231−\item
231+\item
232232 Second
233233
234−\item
234+\item
235235 Third
236236
237237\end{enumerate}
238238and using spaces:
239239
240240\begin{enumerate}[1.]
241−\item
241+\item
242242 One
243243
244−\item
244+\item
245245 Two
246246
247−\item
247+\item
248248 Three
249249
250250\end{enumerate}
251251Multiple paragraphs:
252252
253253\begin{enumerate}[1.]
254−\item
254+\item
255255 Item 1, graf one.
256256
257257 Item 1. graf two. The quick brown fox jumped over the lazy dog's
258258 back.
259259
260−\item
260+\item
261261 Item 2.
262262
263−\item
263+\item
264264 Item 3.
265265
266266\end{enumerate}
267267\subsection{Nested}
268268
269269\begin{itemize}
270−\item
270+\item
271271 Tab
272272 \begin{itemize}
273− \item
273+ \item
274274 Tab
275275 \begin{itemize}
276− \item
276+ \item
277277 Tab
278278 \end{itemize}
279279 \end{itemize}
@@ -281,56 +281,56 @@ Multiple paragraphs:
281281Here's another:
282282
283283\begin{enumerate}[1.]
284−\item
284+\item
285285 First
286−\item
286+\item
287287 Second:
288288 \begin{itemize}
289− \item
289+ \item
290290 Fee
291− \item
291+ \item
292292 Fie
293− \item
293+ \item
294294 Foe
295295 \end{itemize}
296−\item
296+\item
297297 Third
298298\end{enumerate}
299299Same thing but with paragraphs:
300300
301301\begin{enumerate}[1.]
302−\item
302+\item
303303 First
304304
305−\item
305+\item
306306 Second:
307307
308308 \begin{itemize}
309− \item
309+ \item
310310 Fee
311− \item
311+ \item
312312 Fie
313− \item
313+ \item
314314 Foe
315315 \end{itemize}
316−\item
316+\item
317317 Third
318318
319319\end{enumerate}
320320\subsection{Tabs and spaces}
321321
322322\begin{itemize}
323−\item
323+\item
324324 this is a list item indented with tabs
325325
326−\item
326+\item
327327 this is a list item indented with spaces
328328
329329 \begin{itemize}
330− \item
330+ \item
331331 this is an example list item indented with tabs
332332
333− \item
333+ \item
334334 this is an example list item indented with spaces
335335
336336 \end{itemize}
@@ -339,23 +339,23 @@ Same thing but with paragraphs:
339339
340340\begin{enumerate}[(1)]
341341\setcounter{enumi}{1}
342−\item
342+\item
343343 begins with 2
344−\item
344+\item
345345 and now 3
346346
347347 with a continuation
348348
349349 \begin{enumerate}[i.]
350350 \setcounter{enumii}{3}
351− \item
351+ \item
352352 sublist with roman numerals, starting with 4
353− \item
353+ \item
354354 more items
355355 \begin{enumerate}[(A)]
356− \item
356+ \item
357357 a subsublist
358− \item
358+ \item
359359 a subsublist
360360 \end{enumerate}
361361 \end{enumerate}
@@ -363,18 +363,18 @@ Same thing but with paragraphs:
363363Nesting:
364364
365365\begin{enumerate}[A.]
366−\item
366+\item
367367 Upper Alpha
368368 \begin{enumerate}[I.]
369− \item
369+ \item
370370 Upper Roman.
371371 \begin{enumerate}[(1)]
372372 \setcounter{enumiii}{5}
373− \item
373+ \item
374374 Decimal start with 6
375375 \begin{enumerate}[a)]
376376 \setcounter{enumiv}{2}
377− \item
377+ \item
378378 Lower alpha with paren
379379 \end{enumerate}
380380 \end{enumerate}
@@ -383,12 +383,12 @@ Nesting:
383383Autonumbering:
384384
385385\begin{enumerate}
386−\item
386+\item
387387 Autonumber.
388−\item
388+\item
389389 More.
390390 \begin{enumerate}
391− \item
391+ \item
392392 Nested.
393393 \end{enumerate}
394394\end{enumerate}
@@ -562,37 +562,37 @@ Ellipses\ldots{}and\ldots{}and\ldots{}.
562562\section{LaTeX}
563563
564564\begin{itemize}
565−\item
565+\item
566566 \cite[22-23]{smith.1899}
567−\item
567+\item
568568 \doublespacing
569−\item
569+\item
570570 $2+2=4$
571−\item
571+\item
572572 $x \in y$
573−\item
573+\item
574574 $\alpha \wedge \omega$
575−\item
575+\item
576576 $223$
577−\item
577+\item
578578 $p$-Tree
579−\item
579+\item
580580 $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$
581−\item
581+\item
582582 Here's one that has a line break in it:
583583 $\alpha + \omega \times x^2$.
584584\end{itemize}
585585These shouldn't be math:
586586
587587\begin{itemize}
588−\item
588+\item
589589 To get the famous equation, write \verb!$e = mc^2$!.
590−\item
590+\item
591591 \$22,000 is a \emph{lot} of money. So is \$34,000. (It worked if
592592 ``lot'' is emphasized.)
593−\item
593+\item
594594 Shoes (\$20) and socks (\$5).
595−\item
595+\item
596596 Escaped \verb!$!: \$73 \emph{this should be emphasized} 23\$.
597597\end{itemize}
598598Here's a LaTeX table:
@@ -610,15 +610,15 @@ Cat & 1 \\ \hline
610610Here is some unicode:
611611
612612\begin{itemize}
613−\item
613+\item
614614 I hat: Î
615−\item
615+\item
616616 o umlaut: ö
617−\item
617+\item
618618 section: §
619−\item
619+\item
620620 set membership: ∈
621−\item
621+\item
622622 copyright: ©
623623\end{itemize}
624624AT\&T has an ampersand in their name.
@@ -732,11 +732,11 @@ Here's an
732732With an ampersand: \url{http://example.com/?foo=1&bar=2}
733733
734734\begin{itemize}
735−\item
735+\item
736736 In a list?
737−\item
737+\item
738738 \url{http://example.com/}
739−\item
739+\item
740740 It should.
741741\end{itemize}
742742An e-mail address:
@@ -791,7 +791,7 @@ Notes can go in quotes.%
791791
792792\end{quote}
793793\begin{enumerate}[1.]
794−\item
794+\item
795795 And in list items.%
796796 \footnote{In list.}
797797\end{enumerate}