aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/Roff.hs
AgeCommit message (Collapse)AuthorFilesLines
2021-05-09Change reader types, allowing better tracking of source positions.John MacFarlane1-18/+16
Previously, when multiple file arguments were provided, pandoc simply concatenated them and passed the contents to the readers, which took a Text argument. As a result, the readers had no way of knowing which file was the source of any particular bit of text. This meant that we couldn't report accurate source positions on errors or include accurate source positions as attributes in the AST. More seriously, it meant that we couldn't resolve resource paths relative to the files containing them (see e.g. #5501, #6632, #6384, #3752). Add Text.Pandoc.Sources (exported module), with a `Sources` type and a `ToSources` class. A `Sources` wraps a list of `(SourcePos, Text)` pairs. [API change] A parsec `Stream` instance is provided for `Sources`. The module also exports versions of parsec's `satisfy` and other Char parsers that track source positions accurately from a `Sources` stream (or any instance of the new `UpdateSourcePos` class). Text.Pandoc.Parsing now exports these modified Char parsers instead of the ones parsec provides. Modified parsers to use a `Sources` as stream [API change]. The readers that previously took a `Text` argument have been modified to take any instance of `ToSources`. So, they may still be used with a `Text`, but they can also be used with a `Sources` object. In Text.Pandoc.Error, modified the constructor PandocParsecError to take a `Sources` rather than a `Text` as first argument, so parse error locations can be accurately reported. T.P.Error: showPos, do not print "-" as source name.
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-1/+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-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.
2019-11-12Switch to new pandoc-types and use Text instead of String [API change].despresc1-93/+92
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-09-28Use Prelude.fail to avoid ambiguity with fail from GHC.Base.John MacFarlane1-3/+3
2019-09-05Roff reader: Better support for 'while'.John MacFarlane1-0/+3
2019-09-05Roff reader: improve handling of groups.John MacFarlane1-4/+2
2019-09-04Roff reader: Fix problem parsing comments before macro.John MacFarlane1-2/+0
2019-09-04Roff reader: more improvements in parsing conditionals.John MacFarlane1-3/+4
2019-09-04Roff readers: better parsing of groups.John MacFarlane1-9/+5
We now allow groups where the closing `\\}` isn't at the beginning of a line. Closes #5410.
2019-03-01Remove license boilerplate.John MacFarlane1-20/+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.
2018-11-02Man reader: table improvements.John MacFarlane1-6/+7
2018-11-02Roff reader: Don't require global table options.John MacFarlane1-2/+2
2018-11-02Roff reader: tbl improvements.John MacFarlane1-1/+2
2018-11-02Roff reader: Handle 'H' modifier after '.TS'.John MacFarlane1-3/+2
2018-11-02Roff reader: conditionals: allow .\} to end group.John MacFarlane1-3/+4
2018-11-02Roff reader: reinstate column check for macros.John MacFarlane1-10/+16
If .TS occurs in a table cell, this shouldn't start a table. We make an exception for the line after .if or .ie.
2018-11-02Roff reader: another fix for conditionals.John MacFarlane1-1/+1
2018-11-02Roff reader: fixed small issue with conditionals.John MacFarlane1-3/+1
2018-11-02Roff reader: Improved handling of custom strings as arguments.John MacFarlane1-6/+6
Added test.
2018-11-02Roff reader: expand strings in font commands.John MacFarlane1-12/+26
Closes #5039.
2018-11-02Revert "Revert "Revert "Roff reader: custom Stream type."""John MacFarlane1-51/+27
This reverts commit 9a0333e48917308f15d5ccda246dd31525501f79.
2018-11-02Fix readWithM with Stream.John MacFarlane1-1/+1
2018-11-02Revert "Revert "Roff reader: custom Stream type.""John MacFarlane1-27/+51
This reverts commit a64063af62351cc31006a855a59df884e0892834.
2018-11-02Revert "Roff reader: custom Stream type."John MacFarlane1-51/+27
This reverts commit 211f7ffc78ea1df49a685ac1160fa3942b3a3569. We were getting stack overflows. Not sure why.
2018-11-02Roff reader: custom Stream type.John MacFarlane1-27/+51
So far, this is just a shell. But it will allow us to expand macro strings while getting tokens, when we add a custom uncons instance.
2018-11-02Roff reader: improve lexing of conditionals.John MacFarlane1-28/+49
Partially addreses #5039.
2018-11-01Change 'groff' -> 'roff'.John MacFarlane1-2/+2
These formats (man, ms) are not groff-specific.
2018-10-30Roff reader: rename RoffToken constructors so they're shorter.John MacFarlane1-14/+14
2018-10-30Roff reader: renamed constructors for RoffToken...John MacFarlane1-14/+14
to more closely match nomenclature from man 7 groff.
2018-10-30Roff reader: removed MacroKind alias.John MacFarlane1-5/+2
2018-10-30Roff reader: properly handle unknown backslash escapes.John MacFarlane1-1/+4
They are treated as regular characters, according to groff 7. Cloess #5034.
2018-10-29Roff reader: improved escape parsing.John MacFarlane1-59/+68
Closes #5032. This also removes the FontSize constructor from LinePart. We don't need this yet.
2018-10-28Roff tokenizer: allow `\*~` etc.John MacFarlane1-1/+1
2018-10-28Roff tokenizer: handle e.g. `\*n`.John MacFarlane1-1/+1
2018-10-28Roff tokenizer: better handling of escapes.John MacFarlane1-10/+39
2018-10-28Roff reader: introduce normal/copy mode distinction.John MacFarlane1-4/+33
2018-10-28Roff reader: use escapeArg in macroArg.John MacFarlane1-3/+8
2018-10-28Roff tokenizer: refactor escString.John MacFarlane1-15/+6
2018-10-28Roff tokenizer: revamped font parsing using escapeArg.John MacFarlane1-62/+59
Add support for \C'...' escapes.
2018-10-28Roff tokenizer: abstract out patterns: escapeArg, quoteArg.John MacFarlane1-27/+27
2018-10-28Roff tokenizer: allow space before ( in table options.John MacFarlane1-1/+2
2018-10-28Hlint changes.John MacFarlane1-4/+4
2018-10-28Roff tokenizer: better handling of table format strings.John MacFarlane1-8/+10
Particularly f and m, which require a space after their argument. Also, allow space before numerical arguments, as in his example from stty.1: ``` .TS center tab(@) box; cB cB | cB cB | cB cB lf5 2 l 6 | lf5 2 l 6 | lf5 2 l. \&^c@Value@^c@Value@^c@Value ```
2018-10-27Revert "Roff tokenizer: use Seq for lineparts rather than lists."John MacFarlane1-44/+42
This reverts commit 3a5726b2cf9cdb511635209d412ccb8c50f14d6d.
2018-10-27Revert "Roff reader: use LineParts abstraction."John MacFarlane1-65/+57
This reverts commit 42ba3c0a0b15fddd51e6a4b79882ddaeccf0eb3d.