aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/Vimwiki.hs
AgeCommit message (Collapse)AuthorFilesLines
2021-05-09Change reader types, allowing better tracking of source positions.John MacFarlane1-7/+12
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-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-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-07Apply linter suggestions. Add fix_spacing to lint target in Makefile.John MacFarlane1-1/+1
2020-02-07Various minor cleanups and refactoring (#6117)Joseph C. Sible1-9/+9
* 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-62/+65
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-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-04-05Vimwiki reader: improve handling of internal links.John MacFarlane1-5/+12
1) Don't append `.html` 2) Add `wikilink` title This mirrors behavior of other wiki readers. Generally the `.html` extension is not wanted. It may be important for output to HTML in certain circumstances, but it can always be added using a filter that matches on links with title `wikilink`. Note that if you have a workflow that uses pandoc to convert vimwiki to readable HTML pages, you may need to add such a filter to reproduce current behavior. Here is a filter that does the job: ```lua function Link(el) if el.title == 'wikilink' then el.target = el.target .. ".html" end return el end ``` Save this as `fixlinks.lua` and use with `--lua-filter fixlinks.lua`. Closes #5414.
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.
2018-11-03Vimwiki reader: parse Text without converting to [Char]Alexander Krotov1-4/+3
2018-10-10Vimwiki reader: get rid of F, runF and stateMeta' in favor of stateMetaAlexander Krotov1-6/+6
2018-10-04Vimwiki reader: code cleanupAlexander Krotov1-11/+7
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-13Require pandoc-types 1.17.4.John MacFarlane1-1/+2
And a few tweaks related to the Semigroups/Monoid change. Closes #4448.
2018-01-19hlint code improvements.John MacFarlane1-3/+1
2018-01-05Update copyright notices to include 2018Albert Krewinkel1-2/+2
2017-11-10Vimwiki reader: hlintAlexander Krotov1-17/+17
2017-10-29Source code reformatting.John MacFarlane1-6/+4
2017-10-27hlint suggestions.John MacFarlane1-65/+64
2017-10-27Automatic reformating by stylish-haskell.John MacFarlane1-34/+39
2017-07-12Fixed #3760. (#3784)Yuchen Pei1-6/+26
Using the same solution as in the LaTeX reader: equation -> displaymath align -> displaymath \begin{aligned} ... \end{aligned} etc..
2017-06-26minor updates to vimwiki reader. (#3759)Yuchen Pei1-7/+6
- updated comments in Vimwiki.hs to reflect current status of implementation - added vimwiki to trypandoc
2017-06-20Move CR filtering from tabFilter to the readers.John MacFarlane1-75/+76
The readers previously assumed that CRs had been filtered from the input. Now we strip the CRs in the readers themselves, before parsing. (The point of this is just to simplify the parsers.) Shared now exports a new function `crFilter`. [API change] And `tabFilter` no longer filters CRs.
2017-06-19Vimwiki reader: adjusted for changes in trace.John MacFarlane1-5/+3
2017-06-19Added Vimwiki reader (#3705).Yuchen Pei1-0/+655
* New module Text.Pandoc.Readers.Vimwiki, exporting readVimwiki [API change]. * New input format `vimwiki`. * New data file, `data/vimwiki.css`, for displaying the HTML produced by this reader and pandoc's HTML writer in the style of vimwiki's own HTML export.