aboutsummaryrefslogtreecommitdiff
path: root/test/writer.ms
AgeCommit message (Collapse)Author
2025-03-29ms template: put PDF-specific things under a conditional.John MacFarlane
Don't inculde them if `pdf-engine` isn't set.
2025-03-29ms template: use T rather than P as default font family.John MacFarlane
This is more reliable; see #10738.
2025-03-23Use the most compatible form for roff escapes.John MacFarlane
This affects T.P.RoffChar, T.P.Writers.Roff, and the Man and Ms writers. That is, `\(xy` instead of `\[xy]`. This was the original AT&T troff form and is the most widely supported. The bracketed form causes problem for some tools, e.g. `makewhatis` on macOS. Closes #10716.
2025-02-25Use latest dev texmath.John MacFarlane
2025-01-14Fix escaping of `-` in ms writer.John MacFarlane
In 5132f1ef330d3eb2a0bf87037035beaeaf19d3f3 we added `-` to the list of characters needing backslash escaping, to accommodate a change in groff man's behavior, described here: https://lwn.net/Articles/947941/ This change also led `-` to be escaped in ms output, but that is wrong; `\-` in ms is a unicode minus sign. To fix this, we add a Boolean parameter to `escapeString` in Text.Pandoc.Writers.Roff that determines whether `-` is to be escaped. (NB: This is not an exported function in the API.) The list `standardEscapes` in Text.Pandoc.RoffChar no longer contains `-`. Closes #10536.
2023-11-02T.P.RoffChar: escape `-` as `\-`.John MacFarlane
The groff_man (7)` man page indicates that `-` characters will be treated as typographic hyphens and are not appropriate for cases where the output should be copy-pasteable as an ASCII hyphen-minus character. (E.g. in command line options.) However, until a recent update groff man did not actually do this; it treated `-` and `\-` the same. With the new update (1.23.0) the two are distinguished (see https://lwn.net/Articles/947941/ for background), so now it is important that pandoc escape `-`. This reverts ee60ba5252360d2efbf9cf30197236a21a15a924. That change was motivated by a problem with backslash-escaping `-` in a filename for .PSPIC. That's simply a separate issue; we shouldn't do the normal escapes in such a context. It has been addressed in the previous commit.
2023-10-05T.P.Shared.splitSentences: don't split after initials.John MacFarlane
This improves the man and ms writer output, preventing sentence breaks after initials.
2023-09-14Ms writer: improvements in image handling.John MacFarlane
See #4475. + PDFPIC is now used for PDF images in figures. + Inline images that are postscript or PDF are rendered using PSPIC or PDFPIC. This isn't ideal, because they will still be rendered as if in a separate paragraph, but it's probably better than just printing the image name. + Units are included in height. For further improvement, we might consider in Text.Pandoc.PDF using something like `convertImages` (which we currently use for converting to PDF via LaTeX) to convert SVG (and other?) images to PDF so they can be rendered in this way.
2023-08-25Man writer: improvements to code and code blocks.John MacFarlane
The aim here (see #9020) is to produce more standard and more portable man pages. To that end: - We revert the fanciness introduced in #7506, which employs a custom font name V and a macro that makes this act like boldface in a terminal and monospace in other formats. Unfortunately, this code uses a mechanism that is not portable (and does not work in mandoc). - Instead of using V for inline code, we simply use CR. Note that `\f[CR]` is emitted instead of plain `\f[C]`, because there is no C font in man. (This produces warnings in recent versions of groff.) - For code blocks, we now use the `.EX` and `.EE` macros, together with `.IP` for spacing and indentation. This gives more standard code that can be better interpreted e.g. by mandoc.
2023-01-25Ensure that automatically set variables ...John MacFarlane
`pandoc-version`, `outputfile`, `title-prefix`, `epub-cover-image`, `curdir`, `dzslides-core` can be overridden by `--variable` on the command line. Previously they would create lists in the template Context, which is not desirable.
2023-01-13Support complex figures. [API change]Albert Krewinkel
Thanks and credit go to Aner Lucero, who laid the groundwork for this feature in the 2021 GSoC project. He contributed many changes, including modifications to the readers for HTML, JATS, and LaTeX, and to the HTML and JATS writers. Shared (Albert Krewinkel): - The new function `figureDiv`, exported from `Text.Pandoc.Shared`, offers a standardized way to convert a figure into a Div element. Readers (Aner Lucero): - HTML reader: `<figure>` elements are parsed as figures, with the caption taken from the respective `<figcaption>` elements. - JATS reader: The `<fig>` and `<caption>` elements are parsed into figure elements, even if the contents is more complex. - LaTeX reader: support for figures with non-image contents and for subfigures. - Markdown reader: paragraphs containing just an image are treated as figures if the `implicit_figures` extension is enabled. The identifier is used as the figure's identifier and the image description is also used as figure caption; all other attributes are treated as belonging to the image. Writers (Aner Lucero, Albert Krewinkel): - DokuWiki, Haddock, Jira, Man, MediaWiki, Ms, Muse, PPTX, RTF, TEI, ZimWiki writers: Figures are rendered like Div elements. - Asciidoc writer: The figure contents is unwrapped; each image in the the figure becomes a separate figure. - Classic custom writers: Figures are passed to the global function `Figure(caption, contents, attr)`, where `caption` and `contents` are strings and `attr` is a table of key-value pairs. - ConTeXt writer: Figures are wrapped in a "placefigure" environment with `\startplacefigure`/`\endplacefigure`, adding the features caption and listing title as properties. Subfigures are place in a single row with the `\startfloatcombination` environment. - DocBook writer: Uses `mediaobject` elements, unless the figure contains subfigures or tables, in which case the figure content is unwrapped. - Docx writer: figures with multiple content blocks are rendered as tables with style `FigureTable`; like before, single-image figures are still output as paragraphs with style `Figure` or `Captioned Figure`, depending on whether a caption is attached. - DokuWiki writer: Caption and "alt-text" are no longer combined. The alt text of a figure will now be lost in the conversion. - FB2 writer: The figure caption is added as alt text to the images in the figure; pre-existing alt texts are kept. - ICML writer: Only single-image figures are supported. The contents of figures with additional elements gets unwrapped. - HTML writer: the alt text is no longer constructed from the caption, as was the case with implicit figures. This reduces duplication, but comes at the risk of images that are missing alt texts. Authors should take care to provide alt texts for all images. Some readers, most notably the Markdown reader with the `implicit_figures` extension, add a caption that's identical to the image description. The writer checks for this and adds an `aria-hidden` attribute to the `<figcaption>` element in that case. - JATS writer: The `<fig>` and `<caption>` elements are used write figures. - LaTeX writer: complex figures, e.g. with non-image contents and subfigures, are supported. The `subfigure` template variable is set if the document contains subfigures, triggering the conditional loading of the *subcaption* package. Contants of figures that contain tables are become unwrapped, as longtable environments are not allowed within figures. - Markdown writer: figures are output as implicit figures if possible, via HTML if the `raw_html` extension is enabled, and as Div elements otherwise. - OpenDocument writer: A separate paragraph is generated for each block element in a figure, each with style `FigureWithCaption`. Behavior for single-image figures therefore remains unchanged. - Org writer: Only the first element in a figure is given a caption; additional block elements in the figure are appended without any caption being added. - RST writer: Single-image figures are supported as before; the contents of more complex images become nested in a container of type `float`. - Texinfo writer: Figures are rendered as float with type `figure`. - Textile writer: Figures are rendered with the help of HTML elements. - XWiki: Figures are placed in a group. Co-authored-by: Aner Lucero <[email protected]>
2022-10-19Split Text.Pandoc.Version from Text.Pandoc.Shared.John MacFarlane
This new module exports `pandocVersion` and `pandocVersionText`, which are no longer exported from Text.Pandoc.Shared. [API change] Also, we now set the `pandoc-version` variable centrally rather than in the writers. One effect is the man writer now emits a comment with the pandoc version (this was intended before, judging from the template, but it didn't happen because the vairable wasn't set).
2022-10-08Use texmath 0.12.5.4.John MacFarlane
2022-09-20Ms writer: properly format display equations.John MacFarlane
Previously they were being translated to eqn as inline equations. Closes #8308.
2022-07-12ms template: redefine rather than removing .CH macro.John MacFarlane
This responds to feedback in #8175.
2021-09-21Use pretty-simple to format native output.John MacFarlane
Previously we used our own homespun formatting. But this produces over-long lines that aren't ideal for diffs in tests. Easier to use something off-the-shelf and standard. Closes #7580. Performance is slower by about a factor of 10, but this isn't really a problem because native isn't suitable as a serialization format. (For serialization you should use json, because the reader is so much faster than native.)
2021-03-15Update tests for new texmath.John MacFarlane
2020-03-07Ms writer: fix definition lists so indent even when...John MacFarlane
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 MacFarlane
2019-11-16Ms template: Use Palatino for default font.John MacFarlane
This is less ugly than Times.
2019-11-16Updaet ms writer test.John MacFarlane
2019-11-16Ms writer: boldface definition terms in DefinitionLists.John MacFarlane
Like LaTeX, ConTeXt.
2019-11-16ms template: default to page numbers on bottom, no paragaraph indent.John MacFarlane
To be more like the default LaTeX output.
2018-12-13Man/Ms writers: don't escape `-` as `\-`.John MacFarlane
For discussion see https://groups.google.com/forum/#!msg/pandoc-discuss/B-oiCXcQOVo/WO-BXVpICAAJ The `\-` gets rendered in HTML and PDF as a unicode minus sign.
2018-10-24GroffChar: added @ to list of standard escapes.John MacFarlane
Because we use it as a delimiter for tables (in man) and for math (in ms).
2018-10-23Groff writer character escaping changes.John MacFarlane
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-22Groff writers escaping changes.John MacFarlane
- Improve escaping of accented characters with `--ascii`. Combining accents are now handled properly. - Don't escape spaces and tabs in code blocks. This doesn't seem to be necessary.
2018-10-18GroffChar: fixed interpretation of `\-`.John MacFarlane
It is the ascii - sign, not the unicode hyphen.
2018-10-18Groff escaping changes.John MacFarlane
- `--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-17man/ms writers: use `\[at]` for escaped `@`.John MacFarlane
2018-10-17Move common groff functions to Text.Pandoc.Writers.GroffJohn MacFarlane
(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-04-25Ms template: Fix date.John MacFarlane
Previously .ND was used, but this only works if you have a title page, which we don't. Thanks to @teoric.
2018-04-15Ms writer: font improvements.John MacFarlane
* 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-14Man writer: Don't escape U+2019 as '.John MacFarlane
Closes #4550.
2018-03-18Ms writer: don't escape hyphens.John MacFarlane
Previously we escaped hyphens as `\-`, but that's a minus sign. Closes #4467. Updated changelog.
2017-05-25Added `spaced_reference_links` extension.John MacFarlane
This is now the default for pandoc's Markdown. It allows whitespace between the two parts of a reference link: e.g. [a] [b] [b]: url This is now forbidden by default. Closes #2602.
2017-04-06Ms writer: wider indents for lists.John MacFarlane
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 MacFarlane
2017-04-04Ms writer improvements:John MacFarlane
- 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 MacFarlane
Otherwise we may get unescaped @s that give eqn fits, with @ as the delimiter character.
2017-04-01Ms writer: added syntax highlighting.John MacFarlane
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: Hyperlink table of contents and other improvements.John MacFarlane
2017-03-26Ms writer: Add PDF outline bookmarks.John MacFarlane
2017-03-26Fixed a test not updated on last commit.John MacFarlane
2017-03-26Ms writer: Use @ instead of | for inline math delimiter.John MacFarlane
The `|` delimiter had a bad interaction with tbl. See discussion in #1839.
2017-03-26Ms writer: Support external links.John MacFarlane
Also add config options for link color.
2017-03-26Ms writer: better placement of header anchors.John MacFarlane
2017-03-25Ms writer: Implement header identifiers and internal links.John MacFarlane
2017-03-25Ms writer: use light gray for strikeout.John MacFarlane
Pending groff definitions for striking out an arbitrary section of text (not just a few words).
2017-03-25Ms writer: improved pdf metadata.John MacFarlane