aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Parsing.hs
AgeCommit message (Collapse)AuthorFilesLines
2015-05-13Markdown reader: Made implicit header references case-insensitive.John MacFarlane1-1/+3
Added `stateHeaderKeys` to `ParserState`; this is a `KeyTable` like `stateKeys`, but it only gets consulted if we don't find a match in `stateKeys`, and if `Ext_implicit_header_references` is enabled. Closes #1606.
2015-05-11HTML reader: Fixed detection of self-closing tags.John MacFarlane1-1/+1
Earlier versions had a bug and would wrongly think opening tags containing attributes with slashes in them were self-closing. Closes #2146.
2015-04-26Updated copyright notices to -2015. Closes #2111.John MacFarlane1-2/+2
2015-04-18Revert "Merge pull request #1947 from mpickering/Fmonad"John MacFarlane1-22/+33
Closes #2062. This reverts commit c302bdcdbe97b38721015fe82403b2a8f488a702, reversing changes made to b983adf0d0cbc98d2da1e2751f46ae1f93352be6. Conflicts: src/Text/Pandoc/Parsing.hs src/Text/Pandoc/Readers/Markdown.hs src/Text/Pandoc/Readers/Org.hs src/Text/Pandoc/Readers/RST.hs
2015-04-17Merge pull request #1954 from mcmtroffaes/feature/citekey-firstchar-alphanumJohn MacFarlane1-1/+1
Allow digit as first character of a citation key.
2015-04-18MD Reader: Smart `'` after inline mathNikolay Yakimov1-1/+6
Closes #1909. Adds new parser combinator to Parsing.hs `a <+?> b` : if a succeeds, applies b and mappends output (if any) to result of a. If b fails, it's just a, if a fails, whole expression fails.
2015-02-18Add Text.Pandoc.Error module with PandocError typeMatthew Pickering1-13/+6
2015-02-18Allow digit as first character of a citation key.Matthias C. M. Troffaes1-1/+1
* Update parser to recognize citation keys starting with a digit. * Update documentation accordingly. * Test case added. See https://github.com/jgm/pandoc-citeproc/issues/97
2015-02-18Factor out "returnState" into Parsing moduleMatthew Pickering1-0/+5
2015-02-18Generalise signature of addWarningMatthew Pickering1-1/+1
2015-02-18Add check to see whether in a footnote to ParserState (to avoid circular ↵Matthew Pickering1-2/+4
footnotes)
2015-02-18Remove F monad from ParsingMatthew Pickering1-24/+2
2015-02-18Changed parseWithWarnings to the more general returnWarnings parser transformerMatthew Pickering1-6/+5
2015-02-18Added generalize function which can be used to lift specialised parsers.Matthew Pickering1-0/+4
Monad m => Parsec s st a -> Parsec T s st m a
2014-12-15Text.Pandoc.Parsing: Change parseFromString to fail if not all input isMatthew Pickering1-1/+3
consumed.
2014-12-15Merge pull request #1805 from bergey/rstJohn MacFarlane1-3/+20
RST Reader - Improved Role Support
2014-12-14Fixe autolinks with following punctuation.John MacFarlane1-1/+1
Closes #1811. The price of this is that autolinked bare URIs can no longer contain `>` characters, but this is not a big issue.
2014-12-12RST Reader: compute Attrs when role is definedDaniel Bergey1-3/+2
Move recursive role lookup from renderRole to addNewRole. The Attr value will be the same for every occurance of this role, so there's no reason to compute it every time. This allows simplifying the stateRstCustomRoles map considerably. We could go even further, and remove the fmt and attr arguments to renderRole, which are null except for custom roles.
2014-12-12expose warnings from RST reader; refactorDaniel Bergey1-0/+10
This commit moves some code which was only used for the Markdown Reader into a generic form which can be used for any Reader. Otherwise, it takes naming and interface cues from the preexisting Markdown code.
2014-12-08RST Reader: Warn about skipped directivesDaniel Bergey1-0/+8
move `addWarning` to Parsing.hs, so it can be used by Markdown & RST readers.
2014-10-19Parsing: fixed `inlineMath` so it handles `\text{..}` containing `$`.John MacFarlane1-1/+23
For example: `$x = \text{the $n$th root of $y$}`. Closes #1677.
2014-08-04Use texmath 0.7 interface.John MacFarlane1-1/+2
2014-07-27Parsing: Added isbn and pmid schemesMatthew Pickering1-2/+2
2014-07-26Generalised more in Parsing.hs to enable the use of custom stateMatthew Pickering1-40/+53
2014-07-22Exported runParserT and StreamMatthew Pickering1-0/+2
2014-07-22Generalised readWith to readWithMMatthew Pickering1-10/+19
2014-07-20Fix behavior of `markdown_attribute` extension.John MacFarlane1-0/+2
It now works as in PHP markdown extra. Setting `markdown="1"` on an outer tag affects all contained tags until it is reversed with `markdown="0"`. Closes #1378. Added `stateMarkdownAttribute` to `ParserState`.
2014-07-20readWith: reverted generalization from f201bdcb.John MacFarlane1-8/+8
We need input to be a string so we can print the offending line on an error.
2014-07-12Parsing: Simplified dash and ellipsis.John MacFarlane1-40/+13
This originated with @dubiousjim's observation in #1419 that there was a typo in the definition of enDash. It returned an em dash character instead of an en dash. I thought about why this had not been noticed before, and realized that en dashes were just being parsed as regular symbols. That made me realize that, now that we no longer have dedicate EnDash, EmDash, and Ellipses inline elements, as we used to in pandoc, we no longer need to parse the unicode characters specially. This allowed a considerable simplification of the code. Partially resolves #1419.
2014-07-12Removed space at ends of lines in source.John MacFarlane1-37/+37
2014-07-11Removed inline fmap from Parsing.hsMatthew Pickering1-8/+8
Replaced all inline occurences of fmap with the more idiomatic (<$>).
2014-07-11Removed (>>~) functionMatthew Pickering1-9/+4
This function is equivalent to the more general (<*) which is defined in Control.Applicative. This change makes pandoc code easier to understand for those not familar with the codebase.
2014-07-11Generalised all functions in Parsing.hsMatthew Pickering1-128/+168
Before it wasn't possible to use these general combinators with the ParsecT transformer but with the more general types this is now possible.
2014-07-07`Parsing`: Added `stateInHtmlBlock` to `ParserState`.John MacFarlane1-0/+2
This is used to keep track of the ending tag we're waiting for when we're parsing inside HTML block tags.
2014-05-27Markdown reader: inline math must have nonspace before final `$`.John MacFarlane1-4/+6
Closes #1313.
2014-05-14Move `citeKey` from Readers.Markdown to ParsingAlbert Krewinkel1-0/+13
The function can be used by other readers, so it is made accessible for all parsers.
2014-05-14Introduce class HasLastStrPosition, generalize functionsAlbert Krewinkel1-9/+23
Both `ParserState` and `OrgParserState` keep track of the parser position at which the last string ended. This patch introduces a new class `HasLastStrPosition` and makes the above types instances of that class. This enables the generalization of functions updating the state or checking if one is right after a string.
2014-05-09Update copyright notices for 2014, add missing noticesAlbert Krewinkel1-2/+2
2014-05-03LaTeX reader: Better error messages with include files.John MacFarlane1-1/+1
Closes #1274. Rewrote handleIncludes. We now report the actual source file and position where the error occurs, even if it is included. We do this by inserting special commands, `\PandocStartInclude` and `\PandocEndInclude`, that encode this information in the preprocessing phase. Also generalized the types of a couple functions from `Text.Pandoc.Parsing`.
2014-04-01Changed the smart punctuation parser to return Inlines rather than an Inline ↵Matthew Pickering1-22/+21
element and updated files accordingly
2014-03-25Parsing: Added stateCaption.John MacFarlane1-1/+2
This is primarily for use in the LaTeX reader, so far.
2014-03-25Parsing: Added HasMacros, simplified other typeclasses.John MacFarlane1-28/+22
Removed updateHeaderMap, setHeaderMap, getHeaderMap, updateIdentifierList, setIdentifierList, getIdentifierList.
2014-03-25Whitespace change, and note:John MacFarlane1-0/+1
Contrary to the previous commit message, there was no API change, since Text.Pandoc.Parsing is not an exposed module.
2014-03-25API changes to HasReaderOptions, HasHeaderMap, HasIdentifierList.John MacFarlane1-31/+39
Previously these were typeclasses of monads. They've been changed to be typeclasses of states. This ismplifies the instance definitions and provides more flexibility. This is an API change! However, it should be backwards compatible unless you're defining instances of HasReaderOptions, HasHeaderMap, or HasIdentifierList. The old getOption function should work as before (albeit with a more general type). The function askReaderOption has been removed. extractReaderOptions has been added. getOption has been given a default definition. In HasHeaderMap, extractHeaderMap and updateHeaderMap have been added. Default definitions have been given for getHeaderMap, putHeaderMap, and modifyHeaderMap. In HasIdentifierList, extractIdentifierList and updateIdentifierList have been added. Default definitions have been given for getIdentifierList, putIdentifierList, and modifyIdentifierList. The ultimate goal here is to allow different parsers to use their own, tailored parser states (instead of ParserState) while still using shared functions.
2014-03-24Parsing: Make F an instance of Applicative. Closes #1138.John MacFarlane1-2/+2
2014-02-15Clarified field values in RstCustomRoles.Merijn Verstraaten1-0/+4
2014-02-15Enhanced Pandoc's support for rST roles.Merijn Verstraaten1-0/+2
rST parser now supports: - All built-in rST roles - New role definition - Role inheritance Issues/TODO: - Silently ignores illegal fields on roles - Silently drops class annotations for roles - Only supports :format: fields with a single format for :raw: roles, requires a change to Text.Pandoc.Definition.Format to support multiple formats. - Allows direct use of :raw: role, rST only allows indirect (i.e., inherited use of :raw:).
2013-12-19HLint: use `elem` and `notElem`Henry de Valence1-2/+2
Replaces long conditional chains with calls to `elem` and `notElem`.
2013-12-06HTML reader: Parse LaTeX math if appropriate options are set.John MacFarlane1-0/+35
* Moved inlineMath, displayMath from Markdown reader to Parsing. * Export them from Parsing. (API change.) * Generalize their types.
2013-11-17Parsing: Generalized type of registerHeader, using new typeclasses.John MacFarlane1-12/+42
New type classes HasReadeOptions, HasIdentifierList, HasHeaderMap. These allow certain common functions to be reused even in parsers that use custom state (instead of ParserState), such as the MediaWiki reader. Minor API bump.