aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
AgeCommit message (Collapse)AuthorFilesLines
2020-04-09Jira reader: improve icon conversionAlbert Krewinkel1-12/+12
Icons are now converted as follows: `(/)` to ✔, `(x)` to ❌, `(!)` to ❗, `(+)` to ➕, `(-)` to ➖, `(off)` to 🌙, and `(*)` to ☆. The new icons render well in most fonts. Furthermore, the UTF-8 characters all fit into 4-bytes. Closes: #6264
2020-04-07LaTeX reader: better handling of `\lettrine`.John MacFarlane1-1/+8
- SmallCaps instead of Span for the part after the initial capital. - Ensure that both arguments are parsed, so that in Markdown both are treated as raw LateX. (Closes #6258.)
2020-04-06Vimwiki reader: Add nested syntax highlighting (#6257)Vlad Hanciuta1-1/+5
Nested syntaxes are specified like this: {{{sql SELECT * FROM table }}} The preformatted code block parser has been extended to check if the first attribute of the block is not a `key=value` pair, and in that case it will be considered as a class. Closes #6256.
2020-04-04Jira: support citations, attachment links, and user linksAlbert Krewinkel1-1/+15
Closes: #6231 Closes: #6238 Closes: #6239
2020-04-02HTML reader: fix parsing unclosed th elements in a table.John MacFarlane1-0/+1
Closes #6247.
2020-03-31Jira reader: use span with class `underline` for inserted textAlbert Krewinkel1-1/+1
Jira text which is marked as `+inserted+` is converted into pandoc's default representation for underlined text: a span with class `underline`. Previously, the span was marked with the non-standard class `inserted`. Closes: #6237
2020-03-30Jira reader: retain image attributesAlbert Krewinkel1-1/+13
Jira images attributes as in `!image.jpg|align=right!` are retained as key-value pairs. Thumbnail images, such as `!example.gif|thumbnail!`, are marked by a `thumbnail` class in their attributes. Related to #6234.
2020-03-30Jira reader: read `(?)` icon as "small questionmark" characterAlbert Krewinkel1-1/+1
Closes: #6236
2020-03-29Clean up and simplify Text.Pandoc.Readers.Docx (#6225)Joseph C. Sible1-61/+43
* Simplify resolveDependentRunStyle * Simplify runToInlines * Simplify isAnchorSpan * Simplify parStyleToTransform * Only call getStyleName once * Simplify ils'' * Use case matching to simplify bodyPartToBlocks * Simplify key expiration
2020-03-29Clean up some fmaps (#6226)Joseph C. Sible4-16/+16
* Avoid fmapping when we're just binding right after anyway * Clean up unnecessary fmaps in the LaTeX reader
2020-03-29Docx reader: better error messages.John MacFarlane1-8/+12
Distinguish between docx parsing and docx container unpacking errors.
2020-03-28More cleanup (#6209)Joseph C. Sible1-4/+3
* Simplify by collapsing a do block into a single <$> * Remove an unnecessary variable: `all` takes any Foldable, so only blocksToInlines needs toList.
2020-03-28Simplify fixAuthors (#6223)Joseph C. Sible1-6/+1
2020-03-22Finer grained imports of Text.Pandoc.Class submodules (#6203)Albert Krewinkel35-41/+43
This should speed-up recompilation after changes in `Text.Pandoc.Class`, as the number of modules affected by a change will be smaller in general. It also offers faster insights into the parts of `T.P.Class` used within a module.
2020-03-15Use implicit Prelude (#6187)Albert Krewinkel58-113/+0
* Use implicit Prelude The previous behavior was introduced as a fix for #4464. It seems that this change alone did not fix the issue, and `stack ghci` and `cabal repl` only work with GHC 8.4.1 or newer, as no custom Prelude is loaded for these versions. Given this, it seems cleaner to revert to the implicit Prelude. * PandocMonad: remove outdated check for base version Only base versions 4.9 and later are supported, the check for `MIN_VERSION_base(4,8,0)` is therefore unnecessary. * Always use custom prelude Previously, the custom prelude was used only with older GHC versions, as a workaround for problems with ghci. The ghci problems are resolved by replacing package `base` with `base-noprelude`, allowing for consistent use of the custom prelude across all GHC versions.
2020-03-13Update copyright year (#6186)Albert Krewinkel42-44/+44
* Update copyright year * Copyright: add notes for Lua and Jira modules
2020-03-13Jira reader: support colored inline text, indented listsAlbert Krewinkel1-0/+2
* Support for colored inlines has been added. * Lists are now allowed to be indented; i.e., lists are still recognized if list markers are preceded by spaces. Closes: #6183, #6184
2020-03-05Fix parsing of `\'` in man/ms readers.John MacFarlane1-1/+1
It was being parsed as a backtick. Closes #6175.
2020-03-05Fix parsing of `\.` in man/ms readers.John MacFarlane1-1/+1
Previously due to a typo it was being parsed as `` ` ``. Closes #6175.
2020-02-21Fix table alignment when heading begins with t.John MacFarlane1-1/+1
Due to a typo (`t` instead of `\t`) we were center aligning column headings that begin with a lowercase t! Closes #6153.
2020-02-17Revert "Allow specifying string value in metadata using `!!literal` tag."John MacFarlane1-6/+4
This reverts commit 3493d6afaa6586c46898cf8bdb0c45bb70d31f28. This might be worth considering in the future, but let's not do it yet...the additional complexity needs a better justification.
2020-02-17Allow specifying string value in metadata using `!!literal` tag.John MacFarlane1-4/+6
This is experimental. Normally metadata values are interpreted as markdown, but if the !!literal tag is used they will be interpreted as plain strings. We need to consider whether this can still be implemented if we switch back from HsYAML to yaml for performance reasons.
2020-02-13A bit more cleanup (#6141)Joseph C. Sible2-27/+25
* Remove unnecessary fmaps and only do toMilliseconds once * Share the input tuple intead of making a new one * Lift return out of if * Simplify case statements * Lift DottedNum out of the case statements * Use st instead of mbs * Use setState instead of updateState now that we have the whole state around
2020-02-13Add highlight directive to the rST reader (#6140)Lucas Escot1-4/+11
2020-02-12LaTeX reader: improve caption and label parsing.John MacFarlane2-23/+36
- Don't emit empty Span elements for labels. - Put tables with labels in a surrounding Div.
2020-02-12HTML reader: don't parse `data-id` as `id` attribute.John MacFarlane1-1/+9
And similarly don't parse any `data-X` as `X` when `X` is a valid HTML attribute. Reported in comment on #5415.
2020-02-11LaTeX reader: resolve `\ref` to table numbers.John MacFarlane2-25/+43
Closes #6137.
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.