aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/Ms.hs
AgeCommit message (Collapse)AuthorFilesLines
2021-12-06Ms writer: properly encode strings for PDF contents.John MacFarlane1-2/+19
Closes #7731.
2021-10-12Revert "Depend on pandoc-types 1.23, remove Null constructor on Block."John MacFarlane1-0/+1
This reverts commit fb0d6c7cb63a791fa72becf21ed493282e65ea91.
2021-10-11T.P.Writers.Shared: Export splitSentences as a Doc Text transform.John MacFarlane1-3/+4
[API change] Use this in man/ms.
2021-10-11Remove splitSentences from T.P.Shared [API change].John MacFarlane1-3/+2
We used to attempt automatic sentence splitting in man and ms output, since sentence-ending periods need to be followed by two spaces or a newline in these formats. But it's difficult to do this reliably at the level of `[Inline]`.
2021-10-01Depend on pandoc-types 1.23, remove Null constructor on Block.John MacFarlane1-1/+0
2021-05-20Ms writer: handle tables with multiple paragraphs.John MacFarlane1-6/+22
Previously they overflowed the table cell width. We now set line lengths per-cell and restore them after the table has been written. Closes #7288.
2021-03-19Protect partial uses of maximum with NonEmpty.John MacFarlane1-2/+2
2021-01-08Update copyright notices for 2021 (#7012)Albert Krewinkel1-1/+1
2020-12-30Ms writer: don't justify inside table cells.John MacFarlane1-1/+3
2020-11-07Lint code in PRs and when committing to master (#6790)Albert Krewinkel1-2/+2
* Remove unused LANGUAGE pragmata * Apply HLint suggestions * Configure HLint to ignore some warnings * Lint code when committing to master
2020-09-21Add built-in citation support using new citeproc library.John MacFarlane1-5/+59
This deprecates the use of the external pandoc-citeproc filter; citation processing is now built in to pandoc. * Add dependency on citeproc library. * Add Text.Pandoc.Citeproc module (and some associated unexported modules under Text.Pandoc.Citeproc). Exports `processCitations`. [API change] * Add data files needed for Text.Pandoc.Citeproc: default.csl in the data directory, and a citeproc directory that is just used at compile-time. Note that we've added file-embed as a mandatory rather than a conditional depedency, because of the biblatex localization files. We might eventually want to use readDataFile for this, but it would take some code reorganization. * Text.Pandoc.Loging: Add `CiteprocWarning` to `LogMessage` and use it in `processCitations`. [API change] * Add tests from the pandoc-citeproc package as command tests (including some tests pandoc-citeproc did not pass). * Remove instructions for building pandoc-citeproc from CI and release binary build instructions. We will no longer distribute pandoc-citeproc. * Markdown reader: tweak abbreviation support. Don't insert a nonbreaking space after a potential abbreviation if it comes right before a note or citation. This messes up several things, including citeproc's moving of note citations. * Add `csljson` as and input and output format. This allows pandoc to convert between `csljson` and other bibliography formats, and to generate formatted versions of CSL JSON bibliographies. * Add module Text.Pandoc.Writers.CslJson, exporting `writeCslJson`. [API change] * Add module Text.Pandoc.Readers.CslJson, exporting `readCslJson`. [API change] * Added `bibtex`, `biblatex` as input formats. This allows pandoc to convert between BibLaTeX and BibTeX and other bibliography formats, and to generated formatted versions of BibTeX/BibLaTeX bibliographies. * Add module Text.Pandoc.Readers.BibTeX, exporting `readBibTeX` and `readBibLaTeX`. [API change] * Make "standalone" implicit if output format is a bibliography format. This is needed because pandoc readers for bibliography formats put the bibliographic information in the `references` field of metadata; and unless standalone is specified, metadata gets ignored. (TODO: This needs improvement. We should trigger standalone for the reader when the input format is bibliographic, and for the writer when the output format is markdown.) * Carry over `citationNoteNum` to `citationNoteNumber`. This was just ignored in pandoc-citeproc. * Text.Pandoc.Filter: Add `CiteprocFilter` constructor to Filter. [API change] This runs the processCitations transformation. We need to treat it like a filter so it can be placed in the sequence of filter runs (after some, before others). In FromYAML, this is parsed from `citeproc` or `{type: citeproc}`, so this special filter may be specified either way in a defaults file (or by `citeproc: true`, though this gives no control of positioning relative to other filters). TODO: we need to add something to the manual section on defaults files for this. * Add deprecation warning if `upandoc-citeproc` filter is used. * Add `--citeproc/-C` option to trigger citation processing. This behaves like a filter and will be positioned relative to filters as they appear on the command line. * Rewrote the manual on citatations, adding a dedicated Citations section which also includes some information formerly found in the pandoc-citeproc man page. * Look for CSL styles in the `csl` subdirectory of the pandoc user data directory. This changes the old pandoc-citeproc behavior, which looked in `~/.csl`. Users can simply symlink `~/.csl` to the `csl` subdirectory of their pandoc user data directory if they want the old behavior. * Add support for CSL bibliography entry formatting to LaTeX, HTML, Ms writers. Added CSL-related CSS to styles.html.
2020-09-13Fix hlint suggestions, update hlint.yaml (#6680)Christian Despres1-4/+2
* 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-12Merge pull request #6513 from brisad/masterJohn MacFarlane1-1/+3
Escape starting periods in ms writer code blocks
2020-07-12Ms writer: fix code highlighting with blank lines.John MacFarlane1-5/+5
Previously blank lines were simply omitted from highligted code.
2020-07-08Escape starting periods in ms writer code blocksMichael Hoffmann1-1/+3
If a line of ms code block output starts with a period (.), it should be prepended by '\&' so that it is not interpreted as a roff command. Fixes #6505
2020-04-28Support new Underline element in readers and writers (#6277)Vaibhav Sagar1-0/+2
Deprecate `underlineSpan` in Shared in favor of `Text.Pandoc.Builder.underline`.
2020-04-15Adapt to the newest Table type, fix some previous adaptation issuesdespresc1-1/+1
- 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-2/+3
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-03-07Ms writer: fix definition lists so indent even when...John MacFarlane1-3/+4
paragraph indent is set to 0 (as is the default). Also ensure indent for display math that falls back to TeX.
2020-03-06Ms writer: use .QS/.QE instead of .RS/.RE for block quotes.John MacFarlane1-1/+1
2020-02-03Swap suboptimal uses of maybe and fromMaybe (#6111)Joseph C. Sible1-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.
2019-11-16Ms writer: boldface definition terms in DefinitionLists.John MacFarlane1-1/+2
Like LaTeX, ConTeXt.
2019-11-12Switch to new pandoc-types and use Text instead of String [API change].despresc1-125/+128
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-08-25Use new doctemplates, doclayout.John MacFarlane1-29/+26
+ Remove Text.Pandoc.Pretty; use doclayout instead. [API change] + Text.Pandoc.Writers.Shared: remove metaToJSON, metaToJSON' [API change]. + Text.Pandoc.Writers.Shared: modify `addVariablesToContext`, `defField`, `setField`, `getField`, `resetField` to work with Context rather than JSON values. [API change] + Text.Pandoc.Writers.Shared: export new function `endsWithPlain` [API change]. + Use new templates and doclayout in writers. + Use Doc-based templates in all writers. + Adjust three tests for minor template rendering differences. + Added indentation to body in docbook4, docbook5 templates. The main impact of this change is better reflowing of content interpolated into templates. Previously, interpolated variables were rendered independently and intepolated as strings, which could lead to overly long lines. Now the templates interpolated as Doc values which may include breaking spaces, and reflowing occurs after template interpolation rather than before.
2019-07-28Use doctemplates 0.3, change type of writerTemplate.John MacFarlane1-3/+4
* Require recent doctemplates. It is more flexible and supports partials. * Changed type of writerTemplate to Maybe Template instead of Maybe String. * Remove code from the LaTeX, Docbook, and JATS writers that looked in the template for strings to determine whether it is a book or an article, or whether csquotes is used. This was always kludgy and unreliable. To use csquotes for LaTeX, set `csquotes` in your variables or metadata. It is no longer sufficient to put `\usepackage{csquotes}` in your template or header includes. To specify a book style, use the `documentclass` variable or `--top-level-division`. * Change template code to use new API for doctemplates.
2019-07-16Ms writer: Use .LP instead of .PP for line block.John MacFarlane1-1/+1
Closes #5588.
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-24Ms writer: ensure we have a newline after .EN in disply math.John MacFarlane1-1/+1
Closes #5251.
2018-11-01Change 'groff' -> 'roff'.John MacFarlane1-4/+4
These formats (man, ms) are not groff-specific.
2018-10-26Rename Groff -> Roff.John MacFarlane1-1/+1
Module T.P.Readers.Groff -> T.P.Readers.Roff Module T.P.Writers.Groff -> T.P.Writers.Roff Module T.P.GroffChar -> T.P.RoffChar GroffTokens -> RoffTokens GroffToken -> RoffToken.
2018-10-24Ms writer - removed old escapeBar.John MacFarlane1-8/+2
We don't need this now that we use @ for delim.
2018-10-23Groff writer character escaping changes.John MacFarlane1-15/+15
T.P.GroffChar: replaced `essentialEscapes` with `manEscapes`, which includes all the escapes mentioned in the groff_man manual. T.P.Writers.Groff: removed escapeCode; changed parameter on escapeString from Bool to new type `EscapeMode`. Rewrote `escapeString`.
2018-10-22T.P.Writers.Groff - don't export escapeChar.John MacFarlane1-1/+1
2018-10-18Groff escaping changes.John MacFarlane1-24/+28
- `--ascii` is now turned on automatically for man output, for portability. All man output will be escaped to ASCII. - In T.P.Writers.Groff, `escapeChar`, `escapeString`, and `escapeCode` now take a boolean parameter that selects ascii-only output. This is used by the Ms writer for `--ascii`, instead of doing an extra pass after writing the document. - In ms output without `--ascii`, unicode is used whenever possible (e.g. for double quotes). - A few escapes are changed: e.g. `\[rs]` instead of `\\` for backslash, and `\ga]` instead of `` \` `` for backtick.
2018-10-17Move common groff functions to Text.Pandoc.Writers.GroffJohn MacFarlane1-85/+3
(unexported module). These are used in both the man and ms writers. Moved groffEscape out of Text.Pandoc.Writers.Shared [cancels earlier API change from adding it, which was after last release]. This fixes strong/code combination on man (should be `\f[CB]` not `\f[BC]`), mentioned in #4973. Updated tests. Closes #4975.
2018-10-02Removed Text.Pandoc.Groff.John MacFarlane1-1/+0
Moved groffEscape function to Text.Pandoc.Writers.Shared. [API change, since T.P.W.S is exported.]
2018-10-01Shared: new export `splitSentences` [API change].John MacFarlane1-26/+0
This was duplicated in the Man and Ms writers, and really belongs in Shared.
2018-09-30Implement `--ascii` (`writerPreferAscii`) in writers, not App.John MacFarlane1-1/+3
Now the `write*` functions for Docbook, HTML, ICML, JATS, Man, Ms, OPML are sensitive to `writerPreferAscii`. Previously the to-ascii translation was done in Text.Pandoc.App, and thus not available to those using the writer functions directly. In addition, the LaTeX writer is now sensitive to `writerPreferAscii` and to `--ascii`. 100% ASCII output can't be guaranteed, but the writer will use commands like `\"{a}` and `\l` whenever possible, to avoid emiting a non-ASCII character. A new unexported module, Text.Pandoc.Groff, has been added to store functions used in the different groff-based writers.
2018-09-04hlint some writersAlexander Krotov1-1/+1
2018-04-15Ms writer: font improvements.John MacFarlane1-3/+14
* Use `\f[R]` rather than `\f[]` to reset. The latter returns to the previous font, which gives unintended results in some cases. * Use `\f[BI]` and `\f[CB]` in headers, instead of `\f[I]` and `\f[C]`, since the header font is automatically bold. * Use `\f[CB]` rather than `\f[BC]` for monospace bold. Closes #4552.
2018-04-14Ms writer link improvements.John MacFarlane1-5/+13
+ Create pdf anchor for a Div with an identifier. + Escape `/` character in anchor ids. + Improve escaping for anchor ids: we now use _uNNN_ instead of uNNN to avoid ambiguity. This is intended to help with #4515; however, in my tests, the link to the reference does not seem to work. I'm not sure why.
2018-04-14Man writer: Don't escape U+2019 as '.John MacFarlane1-1/+0
Closes #4550.
2018-03-18Ms writer: don't escape hyphens.John MacFarlane1-1/+0
Previously we escaped hyphens as `\-`, but that's a minus sign. Closes #4467. Updated changelog.
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-09Ms writer: asciify pdf anchors, since unicode anchors don't work.John MacFarlane1-4/+11
Closes #4436. Internal links should be converted automatically, so this shouldn't affect users directly.
2018-01-05Update copyright notices to include 2018Albert Krewinkel1-2/+2