aboutsummaryrefslogtreecommitdiff
path: root/test/command
AgeCommit message (Collapse)AuthorFilesLines
2021-10-27Switch back from HsYAML to yaml.John MacFarlane5-11/+9
Reasons: - Performance: HsYAML is around 20 times slower in parsing large YAML bibliographies (#6084). - An issue was submitted to HsYAML, but it hasn't gotten any attention. HsYAML seems borderline unmaintained; it hasn't had a commit in over a year. - Unfortunately this goes back on our attempts to free ourselves from C dependencies (#4535). But I don't see a better alternative until a better pure Haskell parser is available. Closes #6084. Notes: - We've removed the FromYAML instances for all types that had them, since this is a HsYAML-specific typeclass [API change]. (The yaml package just uses From/ToJSON.) - Unlike HsYAML (in the configuration we were using), yaml parses 'Y', 'N', 'Yes', 'No', 'On', 'Off' as boolean values. Users may need to quote these when they are meant to be interpreted as strings. Similarly, 'null' is parsed as a YAML null value (and will be treated as an empty string by pandoc rather than the string 'null'). Quoting it will force it to be interpreted as a string. - Some tests had to be adjusted accordingly. - Pandoc now behaves better when the YAML metadata contains escaping errors: instead of just falling back on treating the section as a table, it raises a YAML parsing error.
2021-10-22Org reader: allow an initial :PROPERTIES: drawer to add to metadata.John MacFarlane1-0/+22
Closes #7520.
2021-10-20Markdown reader: don't parse links or bracketed spans as citations.John MacFarlane1-0/+66
Previously pandoc would parse [link to (@a)](url) as a citation; similarly [(@a)]{#ident} This is undesirable. One should be able to use example references in citations, and even if `@a` is not defined as an example reference, `[@a](url)` should be a link containing an author-in-text citation rather than a normal citation followed by literal `(url)`. Closes #7632.
2021-10-13Fix markdown parsing bug for math in bracketed spans and links.John MacFarlane1-0/+12
This affects math with unbalanced brackets (e.g. `$(0,1]$`) inside links, images, bracketed spans. Closes #7623.
2021-10-10LaTeX reader: Properly handle `\^` followed by group closing.John MacFarlane1-0/+6
Closes #7615.
2021-09-29Further test updates for switch to pretty-show.John MacFarlane12-114/+114
2021-09-28Switch from pretty-simple to pretty-show for native output.John MacFarlane176-4414/+4580
Update tests. Reason: it turns out that the native output generated by pretty-simple isn't always readable by the native reader. According to https://github.com/cdepillabout/pretty-simple/issues/99 it is not a design goal of the library that the rendered values be readable using 'read'. This makes it unsuitable for our purposes. pretty-show is a bit slower and it uses 4-space indents (non-configurable), but it doesn't have this serious drawback.
2021-09-23BibTeX parser: fix expansion of special strings in series...John MacFarlane3-3/+3
e.g. `newseries` or `library`. Expansion should not happen when these strings are protected in braces, or when they're capitalized. Closes #7591.
2021-09-23HTML reader: handle empty tbody element in table.John MacFarlane1-0/+73
Closes #7589.
2021-09-21Use pretty-simple to format native output.John MacFarlane189-1321/+5146
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-09-21Add missing `%` on command tests.John MacFarlane35-52/+51
This prevented `--accept` from working properly.
2021-09-17Org writer: don't indent contents of code blocks.John MacFarlane1-4/+4
We previously indented them by two spaces, following a common convention. Since the convention is fading, and the indentation is inconvenient for copy/paste, we are discontinuing this practice. Closes #5440.
2021-09-16Fix code blocks using `--preserve-tabs`.John MacFarlane1-0/+11
Previously they did not behave as the equivalent input with spaces would. Closes #7573.
2021-09-13RST reader: handle escaped colons in reference definitions.John MacFarlane1-0/+11
Cloess #7568.
2021-09-10Fix command test for #7557.John MacFarlane1-1/+1
2021-09-10Org reader: don't parse a list as first item in a list item.John MacFarlane1-0/+7
Closes #7557.
2021-09-10Support `--reference-location` for HTML output (#7461)Francesco Mazzoli2-2/+2
The HTML writer now supports `EndOfBlock`, `EndOfSection`, and `EndOfDocument` for reference locations. EPUB and HTML slide show formats are also affected by this change. This works similarly to the markdown writer, but with special care taken to skipping section divs with what regards to the block level. The change also takes care to not modify the output if `EndOfDocument` is used.
2021-08-29Improve asciidoc escaping for `--` in URLs. Closes #7529.John MacFarlane1-0/+7
2021-08-24Fix test for #7521.John MacFarlane1-2/+2
2021-08-23Markdown reader: fix interaction of --strip-comments and listJohn MacFarlane1-0/+11
parsing. Use of `--strip-comments` was causing tight lists to be rendered as loose (as if the comment were a blank line). Closes #7521.
2021-08-21LaTeX-parser: restrict \endinput to current fileSimon Schuster2-0/+17
2021-08-20RST reader: Fix `:literal:` includes.John MacFarlane1-1/+1
These should create code blocks, not insert raw RST. Closes #7513.
2021-08-17Revise citeproc code to fit new citeproc 0.5 API.John MacFarlane4-8/+8
Linkification of URLs in the bibliography is now done in the citeproc library, depending on the setting of an option. We set that option depending on the value of the metadata field `link-bibliography` (defaulting to true, for consistency with earlier behavior, though the new behavior includes the CSL draft recommendation of hyperlinking the title or the whole entry if a DOI, PMID, PMCID, or URL field is present but not explicitly rendered). These changes implement the following recommendations from the draft CSL v1.0.2 spec (Appendix VI): > The CSL syntax does not have support for configuration of links. > However, processors should include links on bibliographic references, > using the following rules: > If the bibliography entry for an item renders any of the following > identifiers, the identifier should be anchored as a link, with the > target of the link as follows: > - url: output as is > - doi: prepend with "`https://doi.org/`" > - pmid: prepend with "`https://www.ncbi.nlm.nih.gov/pubmed/`" > - pmcid: prepend with "`https://www.ncbi.nlm.nih.gov/pmc/articles/`" > If the identifier is rendered as a URI, include rendered URI components > (e.g. "`https://doi.org/`") in the link anchor. Do not include any other > affix text in the link anchor (e.g. "Available from: ", "doi: ", "PMID: "). > If the bibliography entry for an item does not render any of > the above identifiers, then set the anchor of the link as the item > title. If title is not rendered, then set the anchor of the link as the > full bibliography entry for the item. Set the target of the link as one > of the following, in order of priority: > > - doi: prepend with "`https://doi.org/`" > - pmcid: prepend with "`https://www.ncbi.nlm.nih.gov/pmc/articles/`" > - pmid: prepend with "`https://www.ncbi.nlm.nih.gov/pubmed/`" > - url: output as is > > If the item data does not include any of the above identifiers, do not > include a link. > > Citation processors should include an option flag for calling > applications to disable bibliography linking behavior. Thanks to Benjamin Bray for getting this all working.
2021-08-15Remove misleading description from command/citeproc-87 test.John MacFarlane1-5/+2
2021-08-13Convert Quoted in bib entries to special Spans...John MacFarlane1-0/+42
before passing them off to citeproc. This ensures that we get proper localization and flipflopping if, e.g., quotes are used in titles. Closes jgm/citeproc#87.
2021-08-13Citeproc: avoid odd handling of quotes.John MacFarlane1-0/+16
citeproc changes allow us to ignore Quoted elements; citeproc now uses its own method for represented quoted things, and only localizes and flipflops quotes it adds itself. See #87. The one thing left to do is to convert Quoted elements in bibliography databases (esp. titles) to `Span ("",["csl-quoted"],[])` before passing them to citeproc, IF the localized quotes for the quote type match the standard inverted commas.
2021-08-13Fix raw LaTeX injection issue (LaTeX writer).John MacFarlane1-0/+37
Using a code block containing `\end{verbatim}`, one could inject raw TeX into a LaTeX document even when `raw_tex` is disabled. Thanks to Augustin Laville for noticing the bug. Closes #7497.
2021-08-11LaTeX reader: Support `\global` before `\def`, `\let`, etc.John MacFarlane1-0/+12
See #7494.
2021-08-11Fix scope for LaTeX macros.John MacFarlane1-0/+50
They should by default scope over the group in which they are defined (except `\gdef` and `\xdef`, which are global). In addition, environments must be treated as groups. We handle this by making sMacros in the LaTeX parser state a STACK of macro tables. Opening a group adds a table to the stack, closing one removes one. Only the top of the stack is queried. This commit adds a parameter for scope to the Macro constructor (not exported). Closes #7494.
2021-08-11LaTeX reader: improve handling of plain TeX macro primitives.John MacFarlane1-1/+37
- Fixed semantics for `\let`. - Implement `\edef`, `\gdef`, and `\xdef`. - Add comment noting that currently `\def` and `\edef` set global macros (so are equivalent to `\gdef` and `\xdef`). This should be fixed by scoping macro definitions to groups, in a future commit. Closes #7474.
2021-08-10HTML reader: treat commments as blank when parsing.John MacFarlane1-0/+47
This modifies pBlank. Previously comments could sometimes flummox the parser. Cloes #7482.
2021-08-03LaTeX table writer: Increase column width precision (#7466)Peter Fabinski2-2/+2
In some cases, the rounding performed by the LaTeX table writer would introduce visible overrun outside the text area. This adds two more decimal places to the width values.
2021-07-11Improved parsing of raw LaTeX from Text streams (rawLaTeXParser).John MacFarlane1-0/+15
We now use source positions from the token stream to tell us how much of the text stream to consume. Getting this to work required a few other changes to make token source positions accurate. Closes #7434.
2021-07-09RST reader: fix regression with code includes.John MacFarlane2-0/+17
With the recent changes to include infrastructure, included code blocks were getting an extra newline. Closes #7436. Added regression test.
2021-07-05Add command test for #7394.John MacFarlane1-0/+85
And fix a small bug in handling of citations in notes, which led to commas at the end of sentences in some cases.
2021-07-02HTML5 writer, remove aria-hidden when explicit atl text is provided.Aner Lucero1-1/+1
2021-06-29Use dev version of citeproc.John MacFarlane2-14/+13
This eliminates double hyperlinks in author-in-text citations. Author-only citations are no longer hyperlinked. See jgm/citeproc#77.
2021-06-29Remove duplicated alt text in HTML output.Aner Lucero1-0/+19
2021-06-28Improve punctuation moving with `--citeproc`.John MacFarlane2-3/+3
Previously, using `--citeproc` could cause punctuation to move in quotes even when there aer no citations. This has been changed; now, punctuation moving is limited to citations. In addition, we only move footnotes around punctuation if the style is a note style, even if `notes-after-punctuation` is `true`.
2021-06-28Markdown writer: put space between Plain and following fenced Div.John MacFarlane1-0/+15
Closes #4465.
2021-06-22Fix regression with comment-only YAML metadata blocks.John MacFarlane1-0/+9
Closes #7400.
2021-06-21LaTeX writer: add strut at end of minipage if it contains...John MacFarlane1-1/+1
line breaks. Without them, the last line is shorter than it should be, at least in some cases.
2021-06-21Update command test for change to LaTeX LineBreak handling.John MacFarlane1-2/+2
2021-06-21LaTeX writer: always use a minipage for cells with line breaks...John MacFarlane1-1/+4
if width information is available. Otherwise the way we treat them can lead to content that overflows a cell. Closes #7393.
2021-06-21Fix test for #7397John MacFarlane1-2/+2
2021-06-21Markdown writer: Fix regression in code blocks with attributes.John MacFarlane1-0/+14
Code blocks with a single class but nonempty attributes were having attributes drop as a result of #7242. Closes #7397.
2021-06-12Fix regression in citeproc processing.John MacFarlane2-7/+18
If inline references are used (in the metadata `references` field), we should still only include in the bibliography items that are actually cited -- unless `nocite` is used. Closes #7376.
2021-06-05LaTeX writer: Fix regression in table header position.John MacFarlane1-2/+6
In recent versions the table headers were no longer bottom-aligned (if more than one line). This patch fixes that by using minipages for table headers in non-simple tables. Closes #7347.
2021-06-01LaTeX reader: don't allow optional * on symbol control sequences.John MacFarlane1-0/+6
Generally we allow optional starred variants of LaTeX commands (since many allow them, and if we don't accept these explicitly, ignoring the star usually gives acceptable results). But we don't want to do this for `\(*\)` and similar cases. Closes #7340.
2021-05-31Fix regression with commonmark/gfm yaml metdata block parsing.John MacFarlane1-0/+11
A regression in 2.14 led to the document body being omitted after YAML metadata in some cases. This is now fixed. Closes #7339.