aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/Ms.hs
AgeCommit message (Collapse)AuthorFilesLines
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
2017-12-10Changes for skylighting-0.5.John MacFarlane1-2/+2
This fixes a bug in 2.0.4, whereby pandoc could not read the theme files generated with `--print-highlight-style`. It also fixes some CSS issues involving line numbers. Highlighted code blocks are now enclosed in a div with class sourceCode. Highlighting CSS no longer sets a generic color for pre and code; we only set these for class `sourceCode`. This will close #4133 and #4128.
2017-10-29Source code reformatting.John MacFarlane1-3/+3
2017-10-29hlint suggestions.John MacFarlane1-23/+20
2017-10-27Automatic reformating by stylish-haskell.John MacFarlane1-25/+25
2017-06-20Writers: adjusted for renderTemplate' changes.John MacFarlane1-2/+3
Now we raise a proper error on template failure.
2017-06-17Use Control.Monad.State.Strict throughout.John MacFarlane1-1/+1
This gives 20-30% speedup and reduction of memory usage in most of the writers.
2017-06-11Switched Writer types to use Text.John MacFarlane1-5/+7
* XML.toEntities: changed type to Text -> Text. * Shared.tabFilter -- fixed so it strips out CRs as before. * Modified writers to take Text. * Updated tests, benchmarks, trypandoc. [API change] Closes #3731.
2017-05-13Update dates in copyright noticesAlbert Krewinkel1-2/+2
This follows the suggestions given by the FSF for GPL licensed software. <https://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html>
2017-04-28Ms writer: make use of already defined render' (#3613)Alexander Krotov1-2/+2
2017-04-06Ms writer: wider indents for lists.John MacFarlane1-5/+6
Previously some indents weren't wide enough, leading the list item to start on a line after the marker.
2017-04-05Ms writer: respect text wrapping options.John MacFarlane1-1/+6
2017-04-04Ms writer improvements:John MacFarlane1-4/+3
- added some variables to the default template. - cleaner output for images (stringify alt text).
2017-04-04Ms writer: ensure that @ is escaped in URIs.John MacFarlane1-1/+5
Otherwise we may get unescaped @s that give eqn fits, with @ as the delimiter character.
2017-04-01Ms writer: added syntax highlighting.John MacFarlane1-5/+84
Closes #3547. Macro definitions are inserted in the template when there is highlighted code. Limitations: background colors and underline currently not supported.
2017-03-26Ms writer: update TODO comments.John MacFarlane1-3/+0
2017-03-26Ms writer: Hyperlink table of contents and other improvements.John MacFarlane1-9/+21
2017-03-26Ms writer: Add PDF outline bookmarks.John MacFarlane1-0/+3
2017-03-26Ms writer: Use @ instead of | for inline math delimiter.John MacFarlane1-3/+3
The `|` delimiter had a bad interaction with tbl. See discussion in #1839.
2017-03-26Ms writre: Added some escapes.John MacFarlane1-2/+4
2017-03-26Removed unused imports.John MacFarlane1-3/+3
2017-03-26Ms writer: Support external links.John MacFarlane1-21/+7
Also add config options for link color.
2017-03-26Ms writer: better placement of header anchors.John MacFarlane1-9/+5
2017-03-26Ms writer: more spacing fixes for internal links.John MacFarlane1-4/+9