aboutsummaryrefslogtreecommitdiff
path: root/Text/Pandoc/Readers
AgeCommit message (Collapse)AuthorFilesLines
2008-09-12Changed list parser so that only the starting list marker matters:fiddlosopher1-45/+34
1. one - two (b) three produces an ordered list with 1., 2., 3. This is the behavior of Markdown.pl. Modified README to document the new behavior. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1438 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-09-08Use Data.List's 'intercalate' instead of custom 'joinWithSep'.fiddlosopher3-12/+12
+ Removed joinWithSep definition from Text.Pandoc.Shared. + Replaced joinWithSep with intercalate + Depend on base >= 3, since in base < 3 intercalate is not included. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1428 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-09-06LaTeX reader: Refactored math parsers, limited support for eqnarray.fiddlosopher1-3/+10
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1426 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-09-06LaTeX reader: Removed specialEnvironment parser.fiddlosopher1-7/+0
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1425 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-09-06LaTeX reader: minor improvements.fiddlosopher1-7/+9
+ parse '{}', if present, after \textless, \textgreater, \textbar, \textbackslash, \ldots. + Parse unescaped special characters verbatim rather than changing them to spaces. This way arguments of unknown commands will appear in braces. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1424 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-09-06LaTeX reader: Fixed regression in list parsingfiddlosopher1-3/+3
(introduced by recent changes to unknownCommand). git-svn-id: https://pandoc.googlecode.com/svn/trunk@1423 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-09-06LaTeX reader: improvements in raw LaTeX parsing.fiddlosopher1-20/+41
+ "loose punctuation" (like {}) parsed as Space + Para elements must contain more than Str "" and Space elements + Added parser for "\ignore" command used in literate haskell. + Reworked unknownCommand and rawLaTeXInline: when not in "parse raw" mode, these parsers simply strip off the command part and allow the arguments to be parsed normally. So, for example, \blorg{\emph{hi}} will be parsed as Emph "hi" rather than Str "{\\emph{hi}}". git-svn-id: https://pandoc.googlecode.com/svn/trunk@1420 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-09-06Changed Float to Double in definition of Table element.fiddlosopher1-3/+3
(Double is more efficient in GHC.) Truncate width in opendocument output to 2 decimal places. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1418 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-08-26LaTeX reader: Parse "code" environments as verbatim (lhs).fiddlosopher1-15/+9
Refactored parsers for verbatim environments. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1414 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-08-13Support for display math; changed ASCIIMathML -> LaTeXMathML:fiddlosopher2-38/+34
Resolves Issue #47. + Added a DisplayMath/InlineMath selector to Math inlines. + Markdown parser yields DisplayMath for $$...$$. + LaTeX parser yields DisplayMath when appropriate. Removed mathBlock parsers, since the same effect is achieved by the math inline parsers, now that they handle display math. + Writers handle DisplayMath as appropriate for the format. + Changed -m option to use LaTeXMathML rather than ASCIIMathML. LaTeXMathML is closer to LaTeX in its display of math, and supports many non-math LaTeX environments. + Modified HTML writer to print raw TeX when LaTeXMathML is being used instead of suppressing it. + Removed ASCIIMathML files from data/ and added LaTeXMathML. + Replaced ASCIIMathML with LaTeXMathML in source files. + Modified README and pandoc man page source. + Modified web page. + Added --latexmathml option (kept --asciimathml as a synonym for backwards compatibility) + Modified tests accordingly; added new tests for display math. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1409 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-08-11Parse raw ConTeXt environments as TeX in markdown reader.fiddlosopher2-13/+37
Resolves Issue #73. Also made some structural changes to parsing of raw LaTeX environments. Previously there was a special block parser for LaTeX environments. It returned a Para element containing the raw TeX inline. This has been removed, and the raw LaTeX environment parser is now used in the rawLaTeXInline parser. The effect is exactly the same, except that we can now handle consecutive LaTeX and ConTeXt environments not separated by spaces. This new flexibility is required by the example in Issue #73: \placeformula \startformula L_{1} = L_{2} \stopformula API change: The LaTeX reader now exports rawLaTeXEnvironment' (which returns a string) rather than rawLaTeXEnvironment (which returns a block element). This is more likely to be useful in other applications. Added test cases for raw ConTeXt environments to markdown-reader-more.txt. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1405 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-08-10Allow newline before URL in markdown link references. Resolves Issue #81.fiddlosopher1-6/+4
Added tests for this issue in new "markdown-reader-more" tests. Changed RunTests.hs to run these tests. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1401 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-08-06Small improvements to citation parsing in markdown reader.fiddlosopher1-4/+4
(Don't allow blank lines inside citations.) git-svn-id: https://pandoc.googlecode.com/svn/trunk@1382 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-08-05Allow parsing of multiline citations.fiddlosopher1-2/+2
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1381 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-08-04Added support for Cite to Markdown reader, and conditional support for ↵fiddlosopher1-2/+41
citeproc module. + The citeproc cabal configuration option sets the _CITEPROC macro, which conditionally includes code for handling citations. + Added Text.Pandoc.Biblio module. + Made highlighting option default to False. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1376 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-07-23Markdown reader: Parse setext headers before atx headers.fiddlosopher1-1/+1
Test case: # hi ==== parsed by Markdown.pl as an H1 header with contents "# hi". git-svn-id: https://pandoc.googlecode.com/svn/trunk@1334 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-07-15Fixed bug in Markdown parser: regular $s triggering math mode.fiddlosopher1-1/+2
For example: "shoes ($20) and socks ($5)." The fix consists in two new restrictions: + the $ that ends a math span may not be directly followed by a digit. + no blank lines may be included within a math span. Thanks to Joseph Reagle for noticing the bug. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1326 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-07-15Commented out some unneeded code in HTML reader.fiddlosopher1-0/+4
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1325 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-07-15Code cleanup - RST reader.fiddlosopher1-23/+93
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1324 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-07-15LaTeX reader - Code cleanup.fiddlosopher1-16/+76
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1322 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-07-14Code cleanup in LaTeX reader.fiddlosopher1-14/+50
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1320 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-07-13Code cleanup in TexMath reader.fiddlosopher1-1/+14
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1318 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-07-11Added type signatures and fixed other -Wall warnings in Markdown reader.fiddlosopher1-35/+182
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1301 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-07-11Added a few more recognized abbreviations to 'abbrev' parser.fiddlosopher1-1/+2
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1300 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-07-11In smart mode, use nonbreaking spaces after abbreviations in markdown parser.fiddlosopher1-2/+23
Thus, for example, "Mr. Brown" comes out as "Mr.~Brown" in LaTeX, and does not produce a sentence-separating space. Resolves Issue #75. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1298 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-07-11Treat '\ ' in (extended) markdown as nonbreaking space.fiddlosopher1-1/+4
Print nonbreaking space appropriately in each writer (e.g. ~ in LaTeX). git-svn-id: https://pandoc.googlecode.com/svn/trunk@1297 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-06-17Added type signatures, etc., to eliminate -Wall warnings.fiddlosopher1-16/+86
(except for two warnings about unneeded functions, which might come in handy some day...) git-svn-id: https://pandoc.googlecode.com/svn/trunk@1291 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-06-08Markdown smart typography: Em dashes no longer eat surrounding whitespace.fiddlosopher1-2/+1
Resolves Issue #69. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1279 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-04-20Count anything that isn't a known block (HTML) tag as an inline tagfiddlosopher1-4/+4
(rather than the other way around). Added "html", "head", and "body" to list of block tags. Resolves Issue #66, allowing <lj> to count as an inline tag. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1276 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-03-22The '--sanitize-html' option now examines URIs in markdown linksfiddlosopher2-13/+35
and images, and in HTML href and src attributes. If the URI scheme is not on a whitelist of safe schemes, it is rejected. The main point is to prevent cross-site scripting attacks using 'javascript:' URIs. See http://www.mail-archive.com/markdown-discuss@six.pairlist.net/msg01186.html and http://ha.ckers.org/xss.html. Resolves Issue #62. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1262 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-02-09Factored codeBlock into separate codeBlockIndented and codeBlockDelimited.fiddlosopher1-5/+4
Do not use codeBlockDelimited in strict mode. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1211 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-02-09Use generic attributes type, not a string, for CodeBlocks.fiddlosopher4-15/+38
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1209 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-02-09Fixed delimited code blocks: eat blank lines afterwards, and allow end linefiddlosopher1-1/+2
to contain more tildes than beginning line. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1206 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-02-09Added a needed try to {} attribute parser.fiddlosopher1-4/+4
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1205 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-02-09Added support for multiple classes in delimited code block.fiddlosopher1-7/+8
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1204 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-02-09Initial support for delimited code blocks in markdown reader.fiddlosopher1-1/+27
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1203 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-02-09Modified readers for new parameter in CodeBlock.fiddlosopher4-6/+6
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1199 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-01-17Fixed bug in RST reader, which would choke on: "p. one\ntwo\n".fiddlosopher1-2/+2
Added some try's in ordered list parsers. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1191 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-01-16Removed unnecessary imports.fiddlosopher2-5/+2
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1189 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-01-08Changed copyright dates where appropriate to include 2008.fiddlosopher4-8/+8
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1181 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-01-08Changed comment used to replace unsafe HTML if sanitize-html optionfiddlosopher1-4/+4
selected. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1178 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-01-06RST reader: Fixed bug in parsing explicit links (resolves Issue #44).fiddlosopher1-2/+3
The problem was that we were looking for inlines until a '<' character signaled the start of the URL. So if you hit a reference-style link, it would keep looking til the end of the document. Fix: change inline => (notFollowedBy (char '`') >> inline). Note that this won't allow code inlines in links, but these aren't allowed in resT anyway. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1175 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-01-06RST reader: cleaned up parsing of reference names in key blocks and links.fiddlosopher1-24/+25
Allow nonquoted reference links to contain isolated '.', '-', '_', so so that strings like 'a_b_' count as links. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1174 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-01-06RST reader: Removed unnecessary check for following link in str.fiddlosopher1-2/+1
This is unnecessary now that link is above str in the definition of 'inline'. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1173 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-01-06Fixed markdown reader to handle "*hi **there***" as a strong nested in an emph.fiddlosopher1-2/+3
(A '*' is only recognized as the end of the emphasis if it's not the beginning of a strong emphasis.) git-svn-id: https://pandoc.googlecode.com/svn/trunk@1172 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-01-06Markdown reader: Moved blockQuote parser before list parsers.fiddlosopher1-2/+2
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1171 788f1e2b-df1e-0410-8736-df70ead52e1b
2008-01-03Added optional HTML sanitization using a whitelist.fiddlosopher2-23/+87
When this option is specified (--sanitize-html on the command line), unsafe HTML tags will be replaced by HTML comments, and unsafe HTML attributes will be removed. This option should be especially useful for those who want to use pandoc libraries in web applications, where users will provide the input. + Main.hs: Added --sanitize-html option. + Text.Pandoc.Shared: Added stateSanitizeHTML to ParserState. + Text.Pandoc.Readers.HTML: - Added whitelists of sanitaryTags and sanitaryAttributes. - Added parsers to check these lists (and state) to see if a given tag or attribute should be counted unsafe. - Modified anyHtmlTag and anyHtmlEndTag to replace unsafe tags with comments. - Modified htmlAttribute to remove unsafe attributes. - Modified htmlScript and htmlStyle to remove these elements if unsafe. - Modified rawHtmlBlock to use anyHtmlBlockTag instead of anyHtmlTag and anyHtmlEndTag. This fixes a bug in markdown parsing, where inline tags would be included in raw HTML blocks. - Modified anyHtmlBlockTag to test for (not inline) rather than directly for block. This allows us to handle e.g. docbook in the markdown reader. - Minor tweaks in nonTitleNonHead and parseTitle. + Text.Pandoc.Readers.Markdown: - In non-strict mode use rawHtmlBlocks instead of htmlBlock. Simplified htmlBlock, since we know it's only called in strict mode. + Modified README and man pages to document new option. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1166 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-12-31Fixed bug in the markdown reader: HTML preceding a code blockfiddlosopher2-7/+13
could cause it to be parsed as a paragraph. (The problem is that the HTML parser used to eat all blank space after an HTML block, including the indentation of the code block.) Resolves Issue #39. + In Text.Pandoc.Readers.HTML, removed parsing of following space from rawHtmlBlock. + In Text.Pandoc.Readers.Markdown, modified rawHtmlBlocks so that indentation is eaten *only* on the first line after the HTML block. This means that in <div> foo <div> the foo won't be treated as a code block, but in <div> foo </div> it will. This seems the right approach for least suprise. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1164 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-12-31HTML reader: Finished fixing Issue #40.fiddlosopher1-2/+2
Contents of script tags were still being treated as markdown when the script tags were parsed as inline. Fixed by moving "script" from the list of tags that can be either block or inline to the list of block tags. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1163 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-12-31HTML reader: Don't interpret contents of style tags as markdown.fiddlosopher1-2/+9
Resolves Issue #40. + Added htmlStyle, analagous to htmlScript. + Use htmlStyle in htmlBlockElement and rawHtmlInline. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1162 788f1e2b-df1e-0410-8736-df70ead52e1b