git.iko.soy/typeable/pandoc
on master help sign in
Changed 'putStrLn' to 'putStr' in Main.hs, and modified some

of the readers to make spacing at end of output more consistent. Modified tests accordingly. git-svn-id: https://pandoc.googlecode.com/svn/trunk@201 788f1e2b-df1e-0410-8736-df70ead52e1b

commitfe66a90a2a88c66b1d518a932f29d9225e31ab8f authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateSat 16 Dec 2006, 05:05 (20 years ago) parent61ec2c0
18 files changed+25−65
TODO+16−45 src/Main.hs+2−2 src/Text/Pandoc/Shared.hs+1−1 src/Text/Pandoc/Writers/Markdown.hs+1−2 src/Text/Pandoc/Writers/RST.hs+4−3 tests/html-reader.html−1 tests/rst-reader.rst−1 tests/s5.basic.html−1 tests/s5.fancy.html−1 tests/s5.fragment.html−1 tests/s5.inserts.html−1 tests/testsuite.txt−1 tests/writer.html−1 tests/writer.latex−1 tests/writer.markdown−1 tests/writer.rst+1 tests/writer.rtf−1 tests/writer.smart.html−1
TODO+16−45
@@ -1,8 +1,19 @@
11# TODO
22
3+* Fix bug in latex reader? "... gets converted the wrong way.
4+
5+* Use XHTML library for HTML writer?
6+
37* Revisions for building with windows under cygwin:
48 Cabal under windows produces 'pandoc.exe', and some of the scripts
5− expect 'pandoc'.
9+ expect 'pandoc'. (See if this has now been fixed by Makefile change.)
10+
11+* Windows binary distribution: pandoc.exe. Work this into the website
12+ target.
13+
14+* Consider allowing 'a.', 'b.', etc. to mark ordered lists. Perhaps
15+ also '(a)', '(1)', 'a)', '1)', etc., as in rst. This does depart from
16+ markdown syntax.
617
718* Consider making section headers block titles rather than blocks.
819 Instead of: [Header 1 "My title", Block1, Block2, Block3],
@@ -10,6 +21,10 @@
1021 This seems cleaner and would facilitate a docbook writer.
1122 It might also simplify the rst reader.
1223
24+* Consider merging changes in pandoc-wrappers (symlinks rather than
25+ wrapper scripts, except web2markdown and markdown2pdf). This also
26+ needs documentation.
27+
1328* pandoc's HTML output fails to validate completely (w3c).
1429 There are a few quirks:
1530 + HTML doesn't like the \> at the end of <meta tags.
@@ -41,47 +56,3 @@
4156 Disadvantage: Perhaps slightly harder to read. (But HTML and LaTeX
4257 output will still be easy to read.)
4358
44−* Consider scrapping most of the wrapper scripts in favor of having
45− symlinks to pandoc. Modify pandoc so that it changes its defaults
46− depending on the name of the calling program (getProgName).
47− This would eliminate a lot of complexity and allow better handling
48− of options (eliminating the need for a separation between wrapper
49− and pandoc options, for example).
50−
51− If we do this, we should change option parsing in pandoc to allow
52− options after arguments. This will preserve backward-compatibility
53− with the present wrapper system. We'd also want to add an -o
54− option to pandoc (output file). When -o foo is specified, pandoc
55− should print "Created foo" to stderr on success (unless --quiet
56− is specified).
57−
58− A disadvantage is that we'd lose iconv conversion. But maybe this
59− isn't needed anymore; UTF-8 seems to be standard on most systems now.
60−
61− The tricky wrappers to replace are markdown2pdf and html2markdown.
62−
63− markdown2pdf:
64−
65− save working_directory
66− create tempdir
67− if markdown2latex "$@" >tempdir/output 2>tempdir/logfile; then
68− extract output-file from logfile (this will be foo.pdf)
69− if output-file found:
70− mv foo.pdf tempdir/foo.tex
71− else:
72− mv tempdir/output tempdir/foo.tex
73− cd tempdir
74− run pdflatex on foo.tex to produce foo.pdf
75− mv foo.pdf working_directory/foo.pdf
76− else:
77− display logfile to inform user
78− on exit:
79− get rid of tempdir
80−
81− html2markdown: needs to run the HTML through tidy (mainly because
82− pandoc's html parser requires closing tags, etc.) So we probably
83− need something like the existing wrapper script here. roktas
84− suggests perhaps keeping html2markdown simple and using a separate
85− script, web2markdown. note: we also need iconv here, since web
86− pages may not be in UTF8.
87−
src/Main.hs+2−2
@@ -19,7 +19,7 @@ import Text.Pandoc.Shared
1919import System ( exitWith, getArgs, getProgName )
2020import System.Exit
2121import System.Console.GetOpt
22−import IO ( stdout, stderr, hPutStrLn )
22+import System.IO
2323import Data.Maybe ( fromMaybe )
2424import Data.List ( isPrefixOf )
2525import Char ( toLower )
@@ -286,7 +286,7 @@ main = do
286286 writerIncludeBefore = includeBefore,
287287 writerIncludeAfter = includeAfter }
288288
289− (readSources sources) >>= (putStrLn . encodeUTF8 . (writer writerOptions) .
289+ (readSources sources) >>= (putStr . encodeUTF8 . (writer writerOptions) .
290290 (reader startParserState) . filter .
291291 decodeUTF8 . (joinWithSep "\n"))
292292
src/Text/Pandoc/Shared.hs+1−1
@@ -140,7 +140,7 @@ prettyBlock block = show block
140140
141141-- | Prettyprint Pandoc document.
142142prettyPandoc :: Pandoc -> String
143−prettyPandoc (Pandoc meta blocks) = "Pandoc " ++ "(" ++ (show meta) ++ ")\n" ++ (prettyBlockList 0 blocks)
143+prettyPandoc (Pandoc meta blocks) = "Pandoc " ++ "(" ++ (show meta) ++ ")\n" ++ (prettyBlockList 0 blocks) ++ "\n"
144144
145145-- | Convert tabs to spaces (with adjustable tab stop).
146146tabsToSpaces :: Int -- ^ Tabstop
src/Text/Pandoc/Writers/Markdown.hs+1−2
@@ -11,8 +11,7 @@ import Text.PrettyPrint.HughesPJ hiding ( Str )
1111writeMarkdown :: WriterOptions -> Pandoc -> String
1212writeMarkdown options (Pandoc meta blocks) =
1313 let body = text (writerIncludeBefore options) <>
14− vcat (map (blockToMarkdown (writerTabStop options)) (formatKeys blocks)) $$
15− text (writerIncludeAfter options) in
14+ vcat (map (blockToMarkdown (writerTabStop options)) (formatKeys blocks)) $$ text (writerIncludeAfter options) in
1615 let head = if (writerStandalone options) then
1716 ((metaToMarkdown meta) $$ text (writerHeader options))
1817 else
src/Text/Pandoc/Writers/RST.hs+4−3
@@ -16,14 +16,15 @@ writeRST options (Pandoc meta blocks) =
1616 (metaToRST meta) $$ text (writerHeader options)
1717 else
1818 empty in
19− let refs' = nubBy (\x y -> (render x) == (render y)) refs in -- remove duplicate keys
19+ -- remove duplicate keys
20+ let refs' = nubBy (\x y -> (render x) == (render y)) refs in
2021 let body = text (writerIncludeBefore options) <>
2122 vcat main $$ text (writerIncludeAfter options) in
22− render $ top <> body $$ vcat refs'
23+ render $ top <> body $$ vcat refs' $$ text "\n"
2324
2425-- | Escape special RST characters.
2526escapeString :: String -> String
26−escapeString = backslashEscape "`\\|*_"
27+escapeString = backslashEscape "`\\|*_"
2728
2829-- | Convert list of inline elements into one 'Doc' of wrapped text and another
2930-- containing references.
tests/html-reader.html−1
@@ -396,4 +396,3 @@ An e-mail address: nobody [at] nowhere.net<blockquote>
396396<p>If you want, you can use a caret at the beginning of every line, as with blockquotes, but all that you need is a caret at the beginning of the first line of the block and any preceding blank lines.</p>
397397</body>
398398</html>
399−
tests/rst-reader.rst−1
@@ -338,4 +338,3 @@ From "Voyage dans la Lune" by Georges Melies (1902):
338338Here is a movie |movie| icon.
339339
340340.. |movie| image:: movie.jpg
341−
tests/s5.basic.html−1
@@ -758,4 +758,3 @@ window.onresize = function(){setTimeout('fontScale()', 50);}</script>
758758</div>
759759</body>
760760</html>
761−
tests/s5.fancy.html−1
@@ -1670,4 +1670,3 @@ else
16701670</div>
16711671</body>
16721672</html>
1673−
tests/s5.fragment.html−1
@@ -15,4 +15,3 @@
1515<ul>
1616<li>$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</li>
1717</ul>
18−
tests/s5.inserts.html−1
@@ -38,4 +38,3 @@ STUFF INSERTED
3838STUFF INSERTED
3939</body>
4040</html>
41−
tests/testsuite.txt−1
@@ -609,4 +609,3 @@ to a single footnote (as with block quotes).
609609^ as with blockquotes, but all that you need is a caret at the
610610^ beginning of the first line of the block and any preceding
611611^ blank lines.
612−
tests/writer.html−1
@@ -453,4 +453,3 @@ Cat &amp; 1 \\ \hline
453453</div>
454454</body>
455455</html>
456−
tests/writer.latex−1
@@ -578,4 +578,3 @@ If you want, you can use a caret at the beginning of every line, as with blockqu
578578
579579
580580\end{document}
581−
tests/writer.markdown−1
@@ -625,4 +625,3 @@ space\^(my note).
625625^ with blockquotes, but all that you need is a caret at the beginning
626626^ of the first line of the block and any preceding blank lines.
627627
628−
tests/writer.rst+1
@@ -741,3 +741,4 @@ space^(my note).
741741.. _nobody@nowhere.net: mailto:nobody@nowhere.net
742742.. |lalune| image:: lalune.jpg
743743.. |movie| image:: movie.jpg
744+
tests/writer.rtf−1
@@ -375,4 +375,3 @@ http://example.com/
375375}. This should {\i not} be a footnote reference, because it contains a space^(my note).\par}
376376
377377}
378−
tests/writer.smart.html−1
@@ -453,4 +453,3 @@ Cat &amp; 1 \\ \hline
453453</div>
454454</body>
455455</html>
456−