aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/JATS.hs
AgeCommit message (Collapse)AuthorFilesLines
2021-11-12JATS writer: ensure figures are wrapped with `<p>` in list items.Albert Krewinkel1-0/+1
This prevents the generation of invalid output.
2021-10-22Use simpleFigure in Readers.Aner Lucero1-3/+1
2021-10-12Revert "Depend on pandoc-types 1.23, remove Null constructor on Block."John MacFarlane1-0/+1
This reverts commit fb0d6c7cb63a791fa72becf21ed493282e65ea91.
2021-10-01Depend on pandoc-types 1.23, remove Null constructor on Block.John MacFarlane1-1/+0
2021-04-28JATS writer: use either styled-content or named-content for spans.Albert Krewinkel1-10/+26
If the element has a content-type attribute, or at least one class, then that value is used as `content-type` and the span is put inside a `<named-content>` element. Otherwise a `<styled-content>` element is used instead. Closes: #7211
2021-04-25Writers: Recognize custom syntax definitions (#7241)Jan Tojnar1-11/+13
Languages defined using `--syntax-definition` were not recognized by `languagesByExtension`. This patch corrects that, allowing the writers to see all custom definitions. The LaTeX still uses the default syntax map, but that's okay in that context, since `--syntax-definition` won't create new listings styles.
2021-04-16JATS writer: reduce unnecessary use of <p> elements for wrappingAlbert Krewinkel1-10/+12
The `<p>` element is used for wrapping in cases were the contents would otherwise not be allowed in a certain context. Unnecessary wrapping is avoided, especially around quotes (`<disp-quote>` elements). Closes: #7227
2021-04-10JATS writer: convert spans to <named-content> elementsAlbert Krewinkel1-6/+7
Spans with attributes are converted to `<named-content>` elements instead of being wrapped with `<milestone-start/>` and `<milestone-end>` elements. Milestone elements are not allowed in documents using the articleauthoring tag set, so this change ensures the creation of valid documents. Closes: #7211
2021-04-10JATS writer: add footnote number as label in backmatterAlbert Krewinkel1-0/+1
Footnotes in the backmatter are given the footnote's number as a label. The articleauthoring output is unaffected from this change, as footnotes are placed inline there. Closes: #7210
2021-04-05JATS writer: escape disallows chars in identifiersAlbert Krewinkel1-13/+14
XML identifiers must start with an underscore or letter, and can contain only a limited set of punctuation characters. Any IDs not adhering to these rules are rewritten by writing the offending characters as Uxxxx, where `xxxx` is the character's hex code.
2021-01-22JATS writer: allow to use element-citationAlbert Krewinkel1-6/+15
2021-01-19JATS writer: Ensure that disp-quote is always wrapped in p.John MacFarlane1-1/+3
Closes #7041.
2021-01-10JATS writer: fix citations (#7018)Albert Krewinkel1-12/+21
* JATS writer: keep code lines at 80 chars or below * JATS writer: fix citations
2021-01-08Update copyright notices for 2021 (#7012)Albert Krewinkel1-1/+1
2020-11-19JATS writer: support advanced table featuresAlbert Krewinkel1-2/+3
2020-11-17JATS writer: move Table handling to separate moduleAlbert Krewinkel1-68/+17
This makes it easier to split the module into smaller parts.
2020-11-07Lint code in PRs and when committing to master (#6790)Albert Krewinkel1-1/+1
* Remove unused LANGUAGE pragmata * Apply HLint suggestions * Configure HLint to ignore some warnings * Lint code when committing to master
2020-09-13Fix hlint suggestions, update hlint.yaml (#6680)Christian Despres1-5/+5
* 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-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-15/+19
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-02-12Introduce new format variants for JATS (#6067)Albert Krewinkel1-41/+99
New formats: - `jats_archiving` for the "Archiving and Interchange Tag Set", - `jats_publishing` for the "Journal Publishing Tag Set", and - `jats_articleauthoring` for the "Article Authoring Tag Set." The "jats" output format is now an alias for "jats_archiving". Closes: #6014
2020-02-08More cleanup (#6130)Joseph C. Sible1-7/+6
* Use an infix operator normally instead of immediately applying an operator section * Use M.fromList
2020-02-07Resolve HLint warningsAlbert Krewinkel1-10/+10
All warnings are either fixed or, if more appropriate, HLint is configured to ignore them. HLint suggestions remain. * Ignore "Use camelCase" warnings in Lua and legacy code * Fix or ignore remaining HLint warnings * Remove redundant brackets * Remove redundant `return`s * Remove redundant as-pattern * Fuse mapM_/map * Use `.` to shorten code * Remove redundant `fmap` * Remove unused LANGUAGE pragmas * Hoist `not` in Text.Pandoc.App * Use fewer imports for `Text.DocTemplates` * Remove redundant `do`s * Remove redundant `$`s * Jira reader: remove unnecessary parentheses
2019-11-12Switch to new pandoc-types and use Text instead of String [API change].despresc1-53/+53
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-10-29Changes to build with new doctemplates/doclayout.John MacFarlane1-2/+2
The new version of doctemplates adds many features to pandoc's templating system, while remaining backwards-compatible. New features include partials and filters. Using template filters, one can lay out data in enumerated lists and tables. Templates are now layout-sensitive: so, for example, if a text with soft line breaks is interpolated near the end of a line, the text will break and wrap naturally. This makes the templating system much more suitable for programatically generating markdown or other plain-text files from metadata.
2019-09-08Replace Element and makeHierarchical with makeSections.John MacFarlane1-23/+16
Text.Pandoc.Shared: + Remove `Element` type [API change] + Remove `makeHierarchicalize` [API change] + Add `makeSections` [API change] + Export `deLink` [API change] Now that we have Divs, we can use them to represent the structure of sections, and we don't need a special Element type. `makeSections` reorganizes a block list, adding Divs with class `section` around sections, and adding numbering if needed. This change also fixes some longstanding issues recognizing section structure when the document contains Divs. Closes #3057, see also #997. All writers have been changed to use `makeSections`. Note that in the process we have reverted the change c1d058aeb1c6a331a2cc22786ffaab17f7118ccd made in response to #5168, which I'm not completely sure was a good idea. Lua modules have also been adjusted accordingly. Existing lua filters that use `hierarchicalize` will need to be rewritten to use `make_sections`.
2019-08-25Use new doctemplates, doclayout.John MacFarlane1-33/+38
+ 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-15/+11
* 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-06-21JATS Writer: do not emit empty <fn-group> (#5595)Mauro Bieg1-1/+3
introduced by e87b54dcad5e37133bc0f4cfc8039e9fd0dd1b4e
2019-06-11JATS writer: ensure validity of pub-date.John MacFarlane1-0/+22
We try to parse the date and convert to year, month, day, as expected in pub-date. We also add an iso-8601-date attribute if possible.
2019-06-11JATS writer: don't use break element for LineBreak.John MacFarlane1-1/+2
It's only allowed in a few special contexts, and not in p elements.
2019-06-11JATS writer: wrap elements with p when needed.John MacFarlane1-5/+43
The JATS spec restricts contents of certain elements (fn, list-item); this patch wraps elements that can't go in these contexts inside p elements with specific-use "wrapper", so the documents will conform. Closes #5570.
2019-05-16JATS writer: properly handle footnotes.John MacFarlane1-7/+24
"Best Practice: When footnotes are grouped at the end of an article, wrap them in a `<fn-group>` and use an `<xref>` element in the text, as usual, to tie each footnote in the list to a particular location in the text." Closes #5511.
2019-05-04JATS writer: fix citations with PMID so they validate.John MacFarlane1-6/+10
Closes #5481. This includes an update to data/jats.csl.
2019-03-26JATS writer: Ensure that plain strings go inside `<pub-id>` tag.John MacFarlane1-1/+9
See #5397.
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-15Revert "JATS writer: Support citations."John MacFarlane1-4/+3
This reverts commit 39889c22df578a4310bcf549fcd507c08fbf1416.
2019-02-15JATS writer: Support citations.John MacFarlane1-3/+4
2019-02-10JATS writer: wrap figure caption in <p> to fix validation (#5292)Mauro Bieg1-1/+1
closes #5290
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.
2018-09-30Implement `--ascii` (`writerPreferAscii`) in writers, not App.John MacFarlane1-1/+2
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-27JATS writer: remove 'role' attribute on 'bold' and 'sc' elements.John MacFarlane1-3/+2
The JATS spec does not allow these. Closes #4937.
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-05Remove extraneous, significant whitespace in JATS writer output (#4335)Nokome Bentley1-6/+6
This patch fixes some cases where the JATS writer was introducing semantically significant whitespace by indenting and wrapping tags. Note that the JATS spec has a content model for `<p>` tags of `(#PCDATA | ...`. Any tag where `#PCDATA` children are possible should not have any indentation. The same is true for `<th>`, `<td>`, `<term>`, `<label>`.
2018-01-05Update copyright notices to include 2018Albert Krewinkel1-2/+2
2017-12-21Merge pull request #4177 from stencila/jats-xml-readerJohn MacFarlane1-18/+29
Add Basic JATS reader based on DocBook reader
2017-12-21JATS writer: Make <p> optional in <td> and <th> (#4178)Hamish Mackenzie1-0/+3
If the contents are single `Plain` block then do not wrap them with a <p> element.