aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
AgeCommit message (Collapse)AuthorFilesLines
2020-02-08Org reader: simplify parsing of sub- and superscriptsAlbert Krewinkel1-11/+11
Speeds up parsing of single-word, markup-less sub- and superscripts. Fixes: #6127
2020-02-08Use <$> instead of >>= and return (#6128)Joseph C. Sible1-1/+1
2020-02-08Clean up after "hlint --refactor" (#6129)Joseph C. Sible1-2/+2
HLint's automatic refactoring isn't quite perfect, so some of its changes were overcomplicated, wrong, or created new findings. Clean these up.
2020-02-08More cleanup (#6130)Joseph C. Sible1-1/+1
* Use an infix operator normally instead of immediately applying an operator section * Use M.fromList
2020-02-07Apply linter suggestions. Add fix_spacing to lint target in Makefile.John MacFarlane13-43/+35
2020-02-07Resolve HLint warningsAlbert Krewinkel14-43/+32
All warnings are either fixed or, if more appropriate, HLint is configured to ignore them. HLint suggestions remain. * Ignore "Use camelCase" warnings in Lua and legacy code * Fix or ignore remaining HLint warnings * Remove redundant brackets * Remove redundant `return`s * Remove redundant as-pattern * Fuse mapM_/map * Use `.` to shorten code * Remove redundant `fmap` * Remove unused LANGUAGE pragmas * Hoist `not` in Text.Pandoc.App * Use fewer imports for `Text.DocTemplates` * Remove redundant `do`s * Remove redundant `$`s * Jira reader: remove unnecessary parentheses
2020-02-07Various minor cleanups and refactoring (#6117)Joseph C. Sible9-32/+31
* Use concatMap instead of reimplementing it * Replace an unnecessary multi-way if with a regular if * Use sortOn instead of sortBy and comparing * Use guards instead of lots of indents for if and else * Remove redundant do blocks * Extract common functions from both branches of maybe Whenever both the Nothing and the Just branch of maybe do the same function, do that function on the result of maybe instead. * Use fmap instead of reimplementing it from maybe * Use negative forms instead of negating the positive forms * Use mapMaybe instead of mapping and then using catMaybes * Use zipWith instead of mapping over the result of zip * Use unwords instead of reimplementing it * Use <$ instead of <$> and const * Replace case of Bool with if and else * Use find instead of listToMaybe and filter * Use zipWithM instead of mapM and zip * Inline lambda wrappers into the real functions * We get zipWithM from Text.Pandoc.Writers.Shared * Use maybe instead of fromMaybe and fmap I'm not sure how this one slipped past me. * Increase a bit of indentation
2020-02-06Use traverse instead of reimplementing it (#6124)Joseph C. Sible1-3/+1
2020-02-05Simplify an overcomplicated filtering function (#6115)Joseph C. Sible1-1/+1
There's no need to use `catMaybes`, `uncurry`, `bool`, etc., just to get elements where the second element of a tuple is True.
2020-02-05LaTeX reader: skip comments in more places where this is needed.John MacFarlane2-19/+21
Closes #6114.
2020-02-04Remove our bool function (#6116)Joseph C. Sible2-9/+1
Data.Bool already provides a bool function identical to this one.
2020-02-03Allow & in LaTeX citation keys.John MacFarlane1-1/+1
Closes #6110.
2020-02-03Swap suboptimal uses of maybe and fromMaybe (#6111)Joseph C. Sible2-3/+3
Anywhere "maybe" is used with "id" as its second argument, using "fromMaybe" instead will simplify the code. Conversely, anywhere "fromMaybe" is used with the result of "fmap" or "<$>" as its second argument, using "maybe" instead will simplify the code.
2020-02-03Clean up a confusing triple negative (#6102)Joseph C. Sible1-5/+5
There's currently `unless`, `not`, and `notParaOrPlain` in the same expression, which is a rather confusing triple negative. Replace `notParaOrPlain` with `paraOrPlain` and switch to `all` from `any` to clean this up.
2020-02-01Text.Pandoc.Readers.CSV - reuse CSV parser from Text.Pandoc.CSV.John MacFarlane1-65/+5
2020-01-31csv reader: allow empty cells.John MacFarlane1-7/+5
2020-01-31Add Text.Pandoc.Readers.CSV (readCSV).John MacFarlane1-0/+108
This adds csv as an input format. The CSV table is converted into a pandoc simple table. Closes #6100.
2020-01-28Added a try that was needed for the commit fc78be1.John MacFarlane1-1/+1
The intent of that commit was to parse unknown LaTeX enivronments as verbatim if they can't be parsed normally, avoiding crashes on environments that allow unescaped underscores and the like. But the fix didn't completely work: it worked for raw TeX in markdown but not when reading LaTeX. This change fixes that. See #6034. Closes #6093.
2020-01-10LaTeX reader: allow beamer overlays for all commands in all raw tex.John MacFarlane1-10/+10
This affecs parsing of raw tex in LaTeX and in Markdown and other formats. Closes #6043.
2020-01-08LaTeX reader: improve parsing of raw environments.John MacFarlane1-1/+1
If parsing fails in a raw environment (e.g. due to special characters like unescaped `_`), try again as a verbatim environment, which is less sensitive to special characters. This allows us to capture special environments that change catcodes as raw tex when `-f latex+raw_tex` is used. Closes #6034.
2019-12-27Fix parsing bug affected indented code after raw HTML.John MacFarlane1-8/+10
Closes #6009, #5360.
2019-12-27Add a needed try.John MacFarlane1-2/+3
2019-12-19Org reader: report errors properlyAlbert Krewinkel1-2/+1
Errors during parsing are now returned in full and no longer replaced by a custom message.
2019-12-19Org reader: fix parsing problem for colons in headlineAlbert Krewinkel2-11/+27
Fixed a problem where words surrounded by colons could causing parse failures in some cases when they occurred in headers. Fixes: #5993
2019-12-18Org reader: wrap named table in div, using name as idAlbert Krewinkel1-12/+10
Closes: #5984
2019-12-17Add jira reader (#5913)Albert Krewinkel1-0/+173
Closes #5556
2019-12-17HTML reader: Add "nav" to list of block-level tags.John MacFarlane1-1/+2
2019-12-13Org reader: add table labels to caption if both are presentAlbert Krewinkel1-3/+11
The table `#+NAME:` or `#+LABEL:` is added to the table's caption in the form of an empty span with the label set as the span's ID. Closes: #5984
2019-12-05Avoid deprecation warning for minimumDef using CPP.John MacFarlane1-1/+6
2019-11-24Add unexported Text.Pandoc.Readers.Metadata.John MacFarlane2-104/+161
For YAML metadata parsing. A step in the direction of #5914. No API change.
2019-11-21LaTeX reader: parse \micro siunitx unit command (#5921)Jose Luis Duran1-0/+1
This was somehow missed in 884aef31c55e375cd62fcb55a71829d005087cae.
2019-11-20Fix typos (#5919)Brian Wignall1-1/+1
2019-11-18DokuWiki reader: parse markup inside monospace ('') (#5917)Alexander Krotov1-2/+2
Fixes #5916
2019-11-15LaTeX Reader: Add KOMA-Script metadata commands (#5910)Andrew Dunning1-1/+8
Add all titling commands to existing definition for `\dedication`.
2019-11-14Markdown reader: use take1WhileP for table row.John MacFarlane1-1/+1
2019-11-14Markdown reader: Use take1WhileP for str.John MacFarlane1-1/+3
This yields a small but measurable performance improvement.
2019-11-13Fix regression introduced by last commit.John MacFarlane1-1/+2
2019-11-13Markdown reader: don't parse footnote body unless extension enabled.John MacFarlane1-18/+20
2019-11-12Switch to new pandoc-types and use Text instead of String [API change].despresc47-2307/+2427
PR #5884. + Use pandoc-types 1.20 and texmath 0.12. + Text is now used instead of String, with a few exceptions. + In the MediaBag module, some of the types using Strings were switched to use FilePath instead (not Text). + In the Parsing module, new parsers `manyChar`, `many1Char`, `manyTillChar`, `many1TillChar`, `many1Till`, `manyUntil`, `mantyUntilChar` have been added: these are like their unsuffixed counterparts but pack some or all of their output. + `glob` in Text.Pandoc.Class still takes String since it seems to be intended as an interface to Glob, which uses strings. It seems to be used only once in the package, in the EPUB writer, so that is not hard to change.
2019-11-11Markdown reader: fix small super/subscript issue.John MacFarlane1-2/+6
Superscripts and subscripts cannot contain spaces, but newlines were previously allowed (unintentionally). This led to bad interactions in some cases with footnotes. E.g. ``` foo^[note] bar^[note] ``` With this change newlines are also not allowed inside super/subscripts. Closes #5878.
2019-11-11Change the implementation of `htmlSpanLikeElements` and implement `<dfn>` ↵Florian Beeres1-4/+11
(#5882) * Add HTML Reader support for `<dfn>`, parsing this as a Span with class `dfn`. * Change `htmlSpanLikeElements` implementation to retain classes, attributes and inline content.
2019-11-07DocBook reader: Fix bug with entities in mathphrase element.John MacFarlane1-4/+2
Closes #5885.
2019-11-07Change merge behavior for metadata.John MacFarlane1-1/+3
Previously, if a document contained two YAML metadata blocks that set the same field, the conflict would be resolved in favor of the first. Now it is resolved in favor of the second (due to a change in pandoc-types). This makes the behavior more uniform with other things in pandoc (such as reference links and `--metadata-file`).
2019-11-04Removed an unnecessary unpack.John MacFarlane1-1/+1
2019-11-04HTML Reader/Writer - Add support for <var> and <samp> (#5861)Amogh Rathore1-5/+7
Closes #5799
2019-11-03Docx reader: Only use LTR when it is overriding BiDi settingJesse Rosenthal3-2/+14
The left-to-right direction setting in docx is used in the spec only for overriding an explicit right-to-left setting. We only process it when it happens in a paragraph set with BiDi. This is especially important for docs exported from Google Docs, which explicitly (and unnecessarily) set "rtl=0" for every paragraph. Closes: #5723
2019-11-03Docx reader: fix list number resumption for sublists. Closes #4324.John MacFarlane1-1/+8
The first list item of a sublist should not resume numbering from the number of the last sublist item of the same level, if that sublist was a sublist of a different list item. That is, we should not get: ``` 1. one 1. sub one 2. sub two 2. two 3. sub one ```
2019-11-02RST reader: avoid spurious warning...John MacFarlane1-1/+1
when resolving links to internal anchors ending with `_`. Closes #5763.
2019-11-02LaTeX reader: Fixed dollar-math parsing...John MacFarlane1-9/+9
...to ensure that space is left between a control seq and a following word that would otherwise change its meaning. Closes #5836.
2019-11-02LaTeX untokenize: Ensure space between control sequence and following letter.John MacFarlane2-2/+15
Closes #5836.