summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Citeproc
AgeCommit message (Collapse)Author
2024-02-07Support "pagetotal" in converting BibLaTeX.John MacFarlane
2023-02-09Citeproc: Fix bug in metaValueToReference.John MacFarlane
This bug caused us to get some repeated content when converting MetaBlock to Inlines. Closes #8611.
2023-02-04Improve handling of `%` in bib(la)tex parsing.John MacFarlane
bibtex/biblatex seem to pass through an unescaped `%` inside braces or quotes; it won't escape the closing brace. So we'll do the same. This prevents the need for our previous special treatment of url and doi fields. Closes #8597.
2023-02-01Handle % in biblatex doi field.John MacFarlane
Closes #8595.
2022-12-22Support "software" type in biblatex <-> CSL conversions.John MacFarlane
Closes #8504.
2022-12-22Make sure "version" field comes through in biblatex.John MacFarlane
See #8504.
2022-10-31First stab at mtl 2.3 compliance.John MacFarlane
This will no doubt produce a bunch of warnings and hence CI failures, which we'll need to work around with explicit imports.
2022-10-18T.P.Citeproc.Locator: remove unnecessary import of Text.Parsec.John MacFarlane
2022-10-16T.P.Parsing: Remove gratuitious renaming of Parsec types.John MacFarlane
We were exporting Parser, ParserT as synonyms of Parsec, ParsecT. There is no good reason for this and it can cause confusion. Also, when possible, we replace imports of Text.Parsec with T.P.Parsing. The idea is to make it easier, at some point, to switch to megaparsec or another parsing engine if we want to. T.P.Parsing new exports: Stream(..), updatePosString, SourceName, Parsec, ParsecT [API change]. Removed exports: Parser, ParserT [API change].
2022-10-15Minor code cleanups.John MacFarlane
2022-10-04Removed some final blank lines.John MacFarlane
2022-10-02Add T.P.Citeproc.Name.John MacFarlane
This exports `toName`, which previously had been part of T.P.Citeproc.BibTeX. T.P.Readers.RIS,EndNote can now depend on this module without transitively depending on the LaTeX reader, which is used in T.P.Citeproc.BibTeX. Closes #8345.
2022-09-27T.P.Citeproc.MetaValue: remove unused function metaValueToPathJohn MacFarlane
2022-09-27Fix small whitespace things.John MacFarlane
2022-09-27Allow `url` field in bibtext (input and output).John MacFarlane
This field is not officially supported, but many styles can handle it (<https://www.bibtex.com/f/url-field/>), and others will ignore it. Closes #8287.
2022-09-25T.P.Citeproc.Locator: update `sub verbo` to `sub-verbo`.John MacFarlane
This is a change in the term's canonical name in citeproc. As a result of this change, `sub verbo` locators have not worked in pandoc since citeproc 0.7. This patch fixes `sub verbo`. Closes #8315.
2022-09-18BibTeX parser: fix handling of `%` in url field.John MacFarlane
`%` does not function as a comment character inside `url` (where URL-encoding is common). Commit 6fb2973a582116cd515c6f7e68794cca22955511 mistakenly took this reassignment of `%` to be a general feature of braced (but not quoted) BibTeX fields. This commit restores the correct behavior of `%` in braced fields other than `url`, and corrects the behavior of `%` in `url` when the value is quoted. Closes #7678 (again).
2022-09-09Citeproc: Require a digit for an implicit "page" locator...John MacFarlane
inside explicit locator syntax `{...}`. Previously a locator specified as `{}` would be rendered as `p.` with nothing after it. Closes #8288.
2022-08-31T.P.Citeproc.CslJson: allow an object with `items` property...John MacFarlane
...in addition to an array of references. This is what is returned by e.g. `https://api.zotero.org/groups/904125/items?v=3&q=صحافة&format=csljson` See comment in #7151.
2022-06-15Use dev version of citeproc.John MacFarlane
2022-02-04Add endnote XML reader.John MacFarlane
New input format: endnotexml New reader module: Text.Pandoc.Readers.EndNote, exporting `readEndNoteXML` and `readEndNoteXMLReferences`. [API change] This reader is still a bit rudimentary, but it should get be good enough to be helpful.
2022-01-08toLocatorMap: store keys as lowercase.John MacFarlane
We want to do a case-insensitive comparison when parsing locators, so that e.g. both `Chap.` and `chap.` work. Previously we lowercase terms when doing the lookup, but they weren't lowercased in the map itself, which led to locator-detection breaking for German (where the terms have uppercase letters). See https://groups.google.com/d/msgid/pandoc-discuss/1dd44886-7b79-4e5f-97ec-57b91113df36n%40googlegroups.com
2021-12-13Citeproc changes:John MacFarlane
T.P.Citeproc exports `getCiteprocLang` and `getStyle` [API change]. T.P.Citeproc.Locator now exports `toLocatorMap`, `LocatorInfo`, and `LocatorMap`. The type of `parseLocator` has changed, so it now takes a `LocatorMap` rather than a `Locale` as parameter, and returns a `LocatorInfo` instead of a tuple.
2021-11-10Fix parsing of `%` in bibtex fields.John MacFarlane
Closes #7678 (a bug introduced by 0a45f26).
2021-11-08Properly handle commented lines in BibTeX/BibLaTeX.John MacFarlane
Closes #7668.
2021-10-21Move splitStrWhen to T.P.Citeproc.Util.John MacFarlane
Previously there were two copies, in BibTeX and Locator.
2021-10-14Remove redundant $Samuel Tardieu
Found by hlint 3.3.1
2021-09-27Better implementation of splitStrWhenJohn MacFarlane
2021-09-23BibTeX parser: fix expansion of special strings in series...John MacFarlane
e.g. `newseries` or `library`. Expansion should not happen when these strings are protected in braces, or when they're capitalized. Closes #7591.
2021-08-17Revise citeproc code to fit new citeproc 0.5 API.John MacFarlane
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-06-28Allow `$` characters in bibtex keys.John MacFarlane
Closes #7409.
2021-06-28Set proper initial source name in parsing BibTeX.John MacFarlane
(For better error messages.)
2021-05-27Two citeproc locator/suffix improvements:John MacFarlane
- Recognize locators spelled with a capital letter. Closes #7323. - Add a comma and a space in front of the suffix if it doesn't start with space or punctuation. Closes #7324.
2021-05-27Citeproc: Don't detect math elements as locators.John MacFarlane
Closes #7321.
2021-05-12Hande 'annote' field in bibtex/biblatex writer.John MacFarlane
Closes #7266.
2021-05-09Change reader types, allowing better tracking of source positions.John MacFarlane
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.
2021-04-17Update to released unicode-collation, latest citeproc dev version.John MacFarlane
Update citeproc test.
2021-04-17Remove Text.Pandoc.BCP47 module.John MacFarlane
[API change] Use Lang from UnicodeCollation.Lang instead. This is a richer implementation of BCP 47.
2021-04-17Move getLang from BCP47 -> T.P.Writers.Shared.John MacFarlane
[API change]
2021-03-15Use foldl' instead of foldl everywhere.John MacFarlane
2021-02-26Fix/update URLs and use HTTP**S** where possible (#7122)Salim B
2021-02-11Correctly parse "raw" date value in markdown references metadata.John MacFarlane
See jgm/citeproc#53.
2021-02-01BibTeX writer: use doclayout and doctemplate.John MacFarlane
This change allows bibtex/biblatex output to wrap as other formats do, depending on the settings of `--wrap` and `--columns`. It also introduces default templates for bibtex and biblatex, which allow for using the variables `header-include`, `include-before` or `include-after` (or alternatively the command line options `--include-in-header`, `--include-before-body`, `--include-after-body`) to insert content into the generated bibtex/biblatex. This change requires a change in the return type of the unexported `T.P.Citeproc.writeBibTeXString` from `Text` to `Doc Text`. Closes #7068.
2021-02-01BibTeX writer fixes. Closes #7067.John MacFarlane
+ Require citeproc 0.3.0.7, which correctly titlecases when titles contain non-ASCII characters. + Correctly handle 'pages' (= 'page' in CSL). + Correctly handle BibLaTeX 'langid' (= 'language' in CSL). + In BibTeX output, protect foreign titles since there's no language field.
2021-01-26Clean up BibTeX parsing.John MacFarlane
Previously there was a messy code path that gave strange results in some cases, not passing through raw tex but trying to extract a string content. This was an artefact of trying to handle some special bibtex-specific commands in the BibTeX reader. Now we just handle these in the LaTeX reader and simplify parsing in the BibTeX reader. This does mean that more raw tex will be passed through (and currently this is not sensitive to the `raw_tex` extension; this should be fixed). Closes #7049.
2021-01-22Add biblatex, bibtex as output formats (closes #7040).John MacFarlane
* `biblatex` and `bibtex` are now supported as output as well as input formats. * New module Text.Pandoc.Writers.BibTeX, exporting writeBibTeX and writeBibLaTeX. [API change] * New unexported function `writeBibtexString` in Text.Pandoc.Citeproc.BibTeX.
2020-12-07Bibtex parser: avoid noneOf.John MacFarlane
2020-11-21Citeproc BibTeX parser: revert change in getRawField...John MacFarlane
which was made (for reasons forgotten) when transferring this code from pandoc-citeproc. The change led to `--` in URLs being interpreted as en-dashes, which is unwanted. Closes #6874.
2020-11-07Lint code in PRs and when committing to master (#6790)Albert Krewinkel
* Remove unused LANGUAGE pragmata * Apply HLint suggestions * Configure HLint to ignore some warnings * Lint code when committing to master
2020-10-15Fix handling of xdata in bibtex/biblatex bibliographies.John MacFarlane
Closes #6752.