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
This commit is contained in:
fiddlosopher 2006-12-16 05:05:02 +00:00
parent 61ec2c0d4a
commit fe66a90a2a
18 changed files with 25 additions and 65 deletions

61
TODO
View file

@ -1,8 +1,19 @@
# TODO # TODO
* Fix bug in latex reader? "... gets converted the wrong way.
* Use XHTML library for HTML writer?
* Revisions for building with windows under cygwin: * Revisions for building with windows under cygwin:
Cabal under windows produces 'pandoc.exe', and some of the scripts Cabal under windows produces 'pandoc.exe', and some of the scripts
expect 'pandoc'. expect 'pandoc'. (See if this has now been fixed by Makefile change.)
* Windows binary distribution: pandoc.exe. Work this into the website
target.
* Consider allowing 'a.', 'b.', etc. to mark ordered lists. Perhaps
also '(a)', '(1)', 'a)', '1)', etc., as in rst. This does depart from
markdown syntax.
* Consider making section headers block titles rather than blocks. * Consider making section headers block titles rather than blocks.
Instead of: [Header 1 "My title", Block1, Block2, Block3], Instead of: [Header 1 "My title", Block1, Block2, Block3],
@ -10,6 +21,10 @@
This seems cleaner and would facilitate a docbook writer. This seems cleaner and would facilitate a docbook writer.
It might also simplify the rst reader. It might also simplify the rst reader.
* Consider merging changes in pandoc-wrappers (symlinks rather than
wrapper scripts, except web2markdown and markdown2pdf). This also
needs documentation.
* pandoc's HTML output fails to validate completely (w3c). * pandoc's HTML output fails to validate completely (w3c).
There are a few quirks: There are a few quirks:
+ HTML doesn't like the \> at the end of <meta tags. + HTML doesn't like the \> at the end of <meta tags.
@ -41,47 +56,3 @@
Disadvantage: Perhaps slightly harder to read. (But HTML and LaTeX Disadvantage: Perhaps slightly harder to read. (But HTML and LaTeX
output will still be easy to read.) output will still be easy to read.)
* Consider scrapping most of the wrapper scripts in favor of having
symlinks to pandoc. Modify pandoc so that it changes its defaults
depending on the name of the calling program (getProgName).
This would eliminate a lot of complexity and allow better handling
of options (eliminating the need for a separation between wrapper
and pandoc options, for example).
If we do this, we should change option parsing in pandoc to allow
options after arguments. This will preserve backward-compatibility
with the present wrapper system. We'd also want to add an -o
option to pandoc (output file). When -o foo is specified, pandoc
should print "Created foo" to stderr on success (unless --quiet
is specified).
A disadvantage is that we'd lose iconv conversion. But maybe this
isn't needed anymore; UTF-8 seems to be standard on most systems now.
The tricky wrappers to replace are markdown2pdf and html2markdown.
markdown2pdf:
save working_directory
create tempdir
if markdown2latex "$@" >tempdir/output 2>tempdir/logfile; then
extract output-file from logfile (this will be foo.pdf)
if output-file found:
mv foo.pdf tempdir/foo.tex
else:
mv tempdir/output tempdir/foo.tex
cd tempdir
run pdflatex on foo.tex to produce foo.pdf
mv foo.pdf working_directory/foo.pdf
else:
display logfile to inform user
on exit:
get rid of tempdir
html2markdown: needs to run the HTML through tidy (mainly because
pandoc's html parser requires closing tags, etc.) So we probably
need something like the existing wrapper script here. roktas
suggests perhaps keeping html2markdown simple and using a separate
script, web2markdown. note: we also need iconv here, since web
pages may not be in UTF8.

View file

@ -19,7 +19,7 @@ import Text.Pandoc.Shared
import System ( exitWith, getArgs, getProgName ) import System ( exitWith, getArgs, getProgName )
import System.Exit import System.Exit
import System.Console.GetOpt import System.Console.GetOpt
import IO ( stdout, stderr, hPutStrLn ) import System.IO
import Data.Maybe ( fromMaybe ) import Data.Maybe ( fromMaybe )
import Data.List ( isPrefixOf ) import Data.List ( isPrefixOf )
import Char ( toLower ) import Char ( toLower )
@ -286,7 +286,7 @@ main = do
writerIncludeBefore = includeBefore, writerIncludeBefore = includeBefore,
writerIncludeAfter = includeAfter } writerIncludeAfter = includeAfter }
(readSources sources) >>= (putStrLn . encodeUTF8 . (writer writerOptions) . (readSources sources) >>= (putStr . encodeUTF8 . (writer writerOptions) .
(reader startParserState) . filter . (reader startParserState) . filter .
decodeUTF8 . (joinWithSep "\n")) decodeUTF8 . (joinWithSep "\n"))

View file

@ -140,7 +140,7 @@ prettyBlock block = show block
-- | Prettyprint Pandoc document. -- | Prettyprint Pandoc document.
prettyPandoc :: Pandoc -> String prettyPandoc :: Pandoc -> String
prettyPandoc (Pandoc meta blocks) = "Pandoc " ++ "(" ++ (show meta) ++ ")\n" ++ (prettyBlockList 0 blocks) prettyPandoc (Pandoc meta blocks) = "Pandoc " ++ "(" ++ (show meta) ++ ")\n" ++ (prettyBlockList 0 blocks) ++ "\n"
-- | Convert tabs to spaces (with adjustable tab stop). -- | Convert tabs to spaces (with adjustable tab stop).
tabsToSpaces :: Int -- ^ Tabstop tabsToSpaces :: Int -- ^ Tabstop

View file

@ -11,8 +11,7 @@ import Text.PrettyPrint.HughesPJ hiding ( Str )
writeMarkdown :: WriterOptions -> Pandoc -> String writeMarkdown :: WriterOptions -> Pandoc -> String
writeMarkdown options (Pandoc meta blocks) = writeMarkdown options (Pandoc meta blocks) =
let body = text (writerIncludeBefore options) <> let body = text (writerIncludeBefore options) <>
vcat (map (blockToMarkdown (writerTabStop options)) (formatKeys blocks)) $$ vcat (map (blockToMarkdown (writerTabStop options)) (formatKeys blocks)) $$ text (writerIncludeAfter options) in
text (writerIncludeAfter options) in
let head = if (writerStandalone options) then let head = if (writerStandalone options) then
((metaToMarkdown meta) $$ text (writerHeader options)) ((metaToMarkdown meta) $$ text (writerHeader options))
else else

View file

@ -16,10 +16,11 @@ writeRST options (Pandoc meta blocks) =
(metaToRST meta) $$ text (writerHeader options) (metaToRST meta) $$ text (writerHeader options)
else else
empty in empty in
let refs' = nubBy (\x y -> (render x) == (render y)) refs in -- remove duplicate keys -- remove duplicate keys
let refs' = nubBy (\x y -> (render x) == (render y)) refs in
let body = text (writerIncludeBefore options) <> let body = text (writerIncludeBefore options) <>
vcat main $$ text (writerIncludeAfter options) in vcat main $$ text (writerIncludeAfter options) in
render $ top <> body $$ vcat refs' render $ top <> body $$ vcat refs' $$ text "\n"
-- | Escape special RST characters. -- | Escape special RST characters.
escapeString :: String -> String escapeString :: String -> String

View file

@ -396,4 +396,3 @@ An e-mail address: nobody [at] nowhere.net<blockquote>
<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> <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>
</body> </body>
</html> </html>

View file

@ -338,4 +338,3 @@ From "Voyage dans la Lune" by Georges Melies (1902):
Here is a movie |movie| icon. Here is a movie |movie| icon.
.. |movie| image:: movie.jpg .. |movie| image:: movie.jpg

View file

@ -758,4 +758,3 @@ window.onresize = function(){setTimeout('fontScale()', 50);}</script>
</div> </div>
</body> </body>
</html> </html>

View file

@ -1670,4 +1670,3 @@ else
</div> </div>
</body> </body>
</html> </html>

View file

@ -15,4 +15,3 @@
<ul> <ul>
<li>$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</li> <li>$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</li>
</ul> </ul>

View file

@ -38,4 +38,3 @@ STUFF INSERTED
STUFF INSERTED STUFF INSERTED
</body> </body>
</html> </html>

View file

@ -609,4 +609,3 @@ to a single footnote (as with block quotes).
^ as with blockquotes, but all that you need is a caret at the ^ as with blockquotes, but all that you need is a caret at the
^ beginning of the first line of the block and any preceding ^ beginning of the first line of the block and any preceding
^ blank lines. ^ blank lines.

View file

@ -453,4 +453,3 @@ Cat &amp; 1 \\ \hline
</div> </div>
</body> </body>
</html> </html>

View file

@ -578,4 +578,3 @@ If you want, you can use a caret at the beginning of every line, as with blockqu
\end{document} \end{document}

View file

@ -625,4 +625,3 @@ space\^(my note).
^ with blockquotes, but all that you need is a caret at the beginning ^ 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. ^ of the first line of the block and any preceding blank lines.

View file

@ -741,3 +741,4 @@ space^(my note).
.. _nobody@nowhere.net: mailto:nobody@nowhere.net .. _nobody@nowhere.net: mailto:nobody@nowhere.net
.. |lalune| image:: lalune.jpg .. |lalune| image:: lalune.jpg
.. |movie| image:: movie.jpg .. |movie| image:: movie.jpg

View file

@ -375,4 +375,3 @@ http://example.com/
}. This should {\i not} be a footnote reference, because it contains a space^(my note).\par} }. This should {\i not} be a footnote reference, because it contains a space^(my note).\par}
} }

View file

@ -453,4 +453,3 @@ Cat &amp; 1 \\ \hline
</div> </div>
</body> </body>
</html> </html>