aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/RST.hs
AgeCommit message (Collapse)AuthorFilesLines
2020-09-13Fix hlint suggestions, update hlint.yaml (#6680)Christian Despres1-4/+4
* Fix hlint suggestions, update hlint.yaml Most suggestions were redundant brackets. Some required LambdaCase. The .hlint.yaml file had a small typo, and didn't ignore camelCase suggestions in certain modules.
2020-07-21RST reader: fix csv tables with multiline cells.John MacFarlane1-1/+6
Closes #6549.
2020-07-12RST reader: fix spurious newlines in some attributes from directives.John MacFarlane1-1/+2
2020-07-12RST reader: avoid extra newline in included code blocks.John MacFarlane1-2/+2
2020-06-17RST reader: pass arbitrary attributes through in code blocks.John MacFarlane1-12/+12
Exceptions: name (which becomes the id), class (which becomes the classes), and number-lines (which is treated specially to fit with pandoc highlighting). Closes #6465.
2020-04-15Use the new builders, modify readers to preserve empty headersdespresc1-7/+13
The Builder.simpleTable now only adds a row to the TableHead when the given header row is not null. This uncovered an inconsistency in the readers: some would unconditionally emit a header filled with empty cells, even if the header was not present. Now every reader has the conditional behaviour. Only the XWiki writer depended on the header row being always present; it now pads its head as necessary.
2020-04-15Adapt to the removal of the RowSpan, ColSpan, RowHeadColumns accessorsdespresc1-1/+1
2020-04-15Adapt to the newest Table type, fix some previous adaptation issuesdespresc1-22/+19
- Writers.Native is now adapted to the new Table type. - Inline captions should now be conditionally wrapped in a Plain, not a Para block. - The toLegacyTable function now lives in Writers.Shared.
2020-04-15Implement the new Table typedespresc1-15/+35
2020-04-12RST reader: handle "date::" directive.John MacFarlane1-1/+10
Closes #6276.
2020-03-22Finer grained imports of Text.Pandoc.Class submodules (#6203)Albert Krewinkel1-1/+1
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 Krewinkel1-2/+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 Krewinkel1-1/+1
* Update copyright year * Copyright: add notes for Lua and Jira modules
2020-02-13Add highlight directive to the rST reader (#6140)Lucas Escot1-4/+11
2020-02-07Apply linter suggestions. Add fix_spacing to lint target in Makefile.John MacFarlane1-8/+6
2020-02-07Various minor cleanups and refactoring (#6117)Joseph C. Sible1-1/+1
* 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
2019-11-12Switch to new pandoc-types and use Text instead of String [API change].despresc1-242/+244
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-02RST reader: avoid spurious warning...John MacFarlane1-1/+1
when resolving links to internal anchors ending with `_`. Closes #5763.
2019-09-29RST reader: don't strip final underscore from absolute URI.John MacFarlane1-3/+7
Partially addresses #5763.
2019-09-28Use Prelude.fail to avoid ambiguity with fail from GHC.Base.John MacFarlane1-1/+1
2019-09-22RST reader: Fixed parsing of indented blocks.John MacFarlane1-6/+9
We were requiring consistent indentation, but this isn't required by RST, as long as each nonblank line of the block has *some* indentation. Closes #5753.
2019-08-23RST reader: use title, not admonition-title, for admonition title.John MacFarlane1-1/+1
This puts RST reader into alignment with docbook reader.
2019-07-10RST reader: keep `name` property in `imgAttr`. (#5637)Brian Leung1-1/+1
Closes #5619.
2019-03-01Remove license boilerplate.John MacFarlane1-18/+0
The haddock module header contains essentially the same information, so the boilerplate is redundant and just one more thing to get out of sync.
2019-02-04Add missing copyright notices and remove license boilerplate (#5112)Albert Krewinkel1-2/+2
Quite a few modules were missing copyright notices. This commit adds copyright notices everywhere via haddock module headers. The old license boilerplate comment is redundant with this and has been removed. Update copyright years to 2019. Closes #4592.
2019-01-09RST reader: change treatment of `number-lines` directives. (#5207)Brian Leung1-15/+15
Directives of this type without numeric inputs should not have a `startFrom` attribute; with a blank value, the writers can produce extra whitespace.
2019-01-08Removed superfluous sourceCode class on code blocks.John MacFarlane1-7/+4
* These were added by the RST reader and, for literate Haskell, by the Markdown and LaTeX readers. There is no point to this class, and it is not applied consistently by all readers. See #5047. * Reverse order of `literate` and `haskell` classes on code blocks when parsing literate Haskell. Better if `haskell` comes first.
2019-01-08RST reader: handle sourcecode directive as synonynm for code.John MacFarlane1-1/+1
Closes #5204.
2018-12-31Remove unused HasHeaderMap (#5175)Alexander1-1/+0
It is updated by some readers, but never actually used.
2018-10-07RST reader: don't allow single-dash separator in headerless table.John MacFarlane1-1/+3
Closes #4382.
2018-10-07RST reader: pass through fields in unknown directives as div attributes.John MacFarlane1-17/+20
This commit also adds support for `class` and `name` attributes to directives in general. Closes #4715.
2018-09-20RST reader: fix bug with internal link targets.John MacFarlane1-1/+1
They were gobbling up indented content underneath. Closes #4919.
2018-09-18parse rST inlines containing newlines closing #4912danse1-1/+1
this eliminates a regression error introduced after pandoc 2.1.1, affecting rST inline parsing. see the issue for details
2018-08-29RSTR reader: don't skip link definitions after comments.John MacFarlane1-0/+1
Closes #4860.
2018-08-05RST reader: improve parsing of inline interpreted text roles.John MacFarlane1-12/+28
* Use a Span with class "title-reference" for the default title-reference role. * Use B.text to split up contents into Spaces, SoftBreaks, and Strs for title-reference. * Use Code with class "interpreted-text" instead of Span and Str for unknown roles. (The RST writer has also been modified to round-trip this properly.) * Disallow blank lines in interpreted text. * Backslash-escape now works in interpreted text. * Backticks followed by alphanumerics no longer end interpreted text. Closes #4811.
2018-07-24RST reader: remove support for nested inlines.danse1-17/+15
RST does not allow nested emphasis, links, or other inline constructs. Closes #4581, double parsing of links with URLs as link text. This supersedes the earlier fix for #4581 in 6419819b46c0d69c7024ba8aa4a6381cb311341c. Fixes #4561, a bug parsing with URLs inside emphasis. Closes #4792.
2018-07-21RST reader: fix double-link bug.John MacFarlane1-1/+8
Link labels containing raw URLs were parsed as autolinks, but links within links are not allowed. Closes #4581.
2018-04-26RST reader: fix anonymous redirects with backticks.John MacFarlane1-3/+8
Closes #4598.
2018-04-22RST reader: allow < 3 spaces indent under directives.John MacFarlane1-3/+7
Closes #4579.
2018-03-18Use NoImplicitPrelude and explicitly import Prelude.John MacFarlane1-0/+2
This seems to be necessary if we are to use our custom Prelude with ghci. Closes #4464.
2018-03-16Monoid/Semiground cleanup relying on custom Prelude.John MacFarlane1-1/+0
2018-03-14RST reader: Allow unicode bullet characters.John MacFarlane1-1/+1
Closes #4454.
2018-01-20RST reader: fix parsing of headers with trailing space.John MacFarlane1-1/+1
This was a regression in pandoc 2.0. Closes #4280.
2018-01-19hlint code improvements.John MacFarlane1-4/+4
2018-01-14RST reader: add aligned environment when needed in math.John MacFarlane1-2/+7
rst2latex.py uses an align* environment for math in `.. math::` blocks, so this math may contain line breaks. If it does, we put the math in an `aligned` environment to simulate rst2latex.py's behavior. Closes #4254.
2018-01-10RST reader: better handling for headers with an anchor.John MacFarlane1-2/+12
Instead of creating a div containing the header, we put the id directly on the header. This way header promotion will work properly. Closes #4240.
2018-01-05Update copyright notices to include 2018Albert Krewinkel1-2/+2
2017-12-24RST reader: allow empty list items (as docutils does).John MacFarlane1-2/+2
Closes #4193.
2017-12-14RST reader: more accurate parsing of references.John MacFarlane1-36/+24
Previously we erroneously included the enclosing backticks in a reference ID (closes #4156). This change also disables interpretation of syntax inside references, as in docutils. So, there is no emphasis in `my *link*`_
2017-11-14RST reader: better support for 'container' directive.John MacFarlane1-1/+3
Create a div, incorporate name attribute and classes. Closes #4066.