aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/OpenDocument.hs
AgeCommit message (Collapse)AuthorFilesLines
2021-10-22Use simpleFigure in Readers.Aner Lucero1-2/+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-05-25Allow compilation with base 4.15Albert Krewinkel1-51/+47
2021-04-17Update to released unicode-collation, latest citeproc dev version.John MacFarlane1-1/+1
Update citeproc test.
2021-04-17Remove Text.Pandoc.BCP47 module.John MacFarlane1-4/+4
[API change] Use Lang from UnicodeCollation.Lang instead. This is a richer implementation of BCP 47.
2020-12-05OpenDocument writer: Allow references for internal links (#6774)Nils Carlson1-18/+73
This commit adds two extensions to the OpenDocument writer, `xrefs_name` and `xrefs_number`. Links to headings, figures and tables inside the document are substituted with cross-references that will use the name or caption of the referenced item for `xrefs_name` or the number for `xrefs_number`. For the `xrefs_number` to be useful heading numbers must be enabled in the generated document and table and figure captions must be enabled using for example the `native_numbering` extension. In order for numbers and reference text to be updated the generated document must be refreshed. Co-authored-by: Nils Carlson <nils.carlson@ludd.ltu.se>
2020-11-22OpenDocument Writer: Implement Div and Span ident support (#6755)Nils Carlson1-10/+33
Spans and Divs containing an ident in the Attr will become bookmarks or sections with idents in OpenDocument format.
2020-11-21OpenDocument writer: Table text width support (#6792)Nils Carlson1-4/+10
Support for table width as a percentage of text width by summing width of columns and verifying that the sum is > 0 and <= 1.
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-10-01Syntax highlight for inline code of OpenDocument (#6711)niszet1-3/+18
To implement Syntax highlighting for OpenDocument, inlineToOpenDocument in OpenDocument Writer is updated based on Docx Writer. This commit is only for inline Code because update of CodeBlock needs structual change of output document. Currently, styles are not generated automatically in styles.xml. To implement it, additional commit for ODT Writer is needed. Although styles are not included in styles.xml, output file can be shown in LibreOffice(7.0.0.3) like normal characters.
2020-09-27OpenDocument Writer: Implement table cell alignment (#6700)Nils Carlson1-5/+33
Co-authored-by: Mauro Bieg <mb21@users.noreply.github.com>
2020-09-24OpenDocument writer: New table cell support with row and column spans (#6682)Nils Carlson1-26/+56
Unit tests only verify column spans at this point. Co-authored-by: Nils Carlson <nils.carlson@ludd.ltu.se>
2020-09-24Support toc-depth option for ODT writer (#6697)niszet1-0/+1
To support `--toc-depth` option for ODT, writer and template are updated. Closes #6696.
2020-09-13Fix hlint suggestions, update hlint.yaml (#6680)Christian Despres1-1/+1
* 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-05-16OpenDocument writer: add custom-style "Abstract" in metadata abstract.John MacFarlane1-1/+8
This ensures that the abstract is rendered with style Abstract.
2020-05-16OpenDocument/ODT writer: enable custom-style attribute on a Div.John MacFarlane1-2/+6
This allows you to apply a custom style to contained paragraphs.
2020-04-28Support new Underline element in readers and writers (#6277)Vaibhav Sagar1-0/+5
Deprecate `underlineSpan` in Shared in favor of `Text.Pandoc.Builder.underline`.
2020-04-15Adapt to the newest Table type, fix some previous adaptation issuesdespresc1-2/+2
- 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-2/+4
2020-03-22Finer grained imports of Text.Pandoc.Class submodules (#6203)Albert Krewinkel1-2/+2
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-03-13Update copyright year (#6186)Albert Krewinkel1-1/+1
* Update copyright year * Copyright: add notes for Lua and Jira modules
2020-02-07Apply linter suggestions. Add fix_spacing to lint target in Makefile.John MacFarlane1-2/+2
2020-02-07Resolve HLint warningsAlbert Krewinkel1-2/+2
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-73/+76
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-11-03Place caption before table in OpenDocument format. (#5869)Dmitry Pogodin1-3/+5
Closes #5681.
2019-09-24odt: Add external option for native numberingNils Carlson1-7/+7
This adds an external options +native_numbering to the ODT writer enabling enumeration of figures and tables in ODT output.
2019-08-25Use new doctemplates, doclayout.John MacFarlane1-53/+54
+ 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-4/+5
* 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-12OpenDocument writer: Avoid duplicate attributes.John MacFarlane1-20/+23
We use the innermost attribute in nested cases. Closes #4634.
2019-06-08Roll back automatic figure/table numbering in ODT/OpenDocument.John MacFarlane1-2/+11
This was added in pandoc 2.7.2, but it makes it impossible to use pandoc-crossref. So this has been rolled back for now, until we find a good solution to make this behavior optional (or a creative way to let pandoc-crossref and this feature to coexist). See #5474.
2019-03-01Remove license boilerplate.John MacFarlane1-19/+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.
2018-11-22OpenDocument writer: small amendment to #5095.John MacFarlane1-1/+1
Level one lists should start at 0.5in rather than 0.75in. (At least this is how LibreOffice behaves for me with a new document.)
2018-11-22ODT writer: Fix list indentationNils Carlson1-2/+2
Previously lists were indented by half an inch on the first line for each level of nesting. This resulted in lists that looked like this: 1. The first line of the list point text the second line of the same list point. Fix this and bring style into line with libreoffice standards: 1. The first line of the list point text the second line of the list point text.
2018-10-05OpenDocument writer: Implement table caption numbering (#4949)Nils Carlson1-36/+53
Implement table caption numbering with a format "Table 1: <caption>". Translations are enabled and numbering is consecutive for captioned tables, uncaptioned tables are not enumerated. Captioned figures are now also numbered consecutively and uncaptioned figures are not enumerated.
2018-10-04Add lookupMeta* functions to Text.Pandoc.Writers.Shared (#4907)Mauro Bieg1-2/+4
Remove exported functions `metaValueToInlines`, `metaValueToString`. Add new exported functions `lookupMetaBool`, `lookupMetaBlocks`, `lookupMetaInlines`, `lookupMetaString`. Use these whenever possible for uniformity in writers. API change (major, because of removed function `metaValueToInlines`. `metaValueToString` wasn't in any released version.)
2018-10-03OpenDocument writer: make 'Figure' term sensitive to `lang` in metadata.John MacFarlane1-9/+16
We use the new translations API.
2018-10-03OpenDocument writer: Implement figure numbering in captions (#4944)Nils Carlson1-1/+13
Figure captions are now numbered 1, 2, 3, ... The format in the caption is "Figure 1: <caption>" and so on. This is necessary in order for libreoffice to generate an Illustration Index (Table of Figures) for included figures.
2018-10-02OpenDocument writer: improve bullet/numbering alignment.John MacFarlane1-4/+12
This patch eliminates the large gap we used to have between bullet and text, and also ensures that numbers in numbered lists will be right-aligned. Closes #4385.
2018-09-23ODT Writer: Improve table header row style handlingNils Carlson1-13/+21
This changes the way styles for cells in the header row and normal rows are handled in ODT tables. Previously a new (but identical) style was generated for every table, specifying the style of the cells within the table. After this change there are two style definitions for table cells, one for the cells in the header row, one for all other cells. This doesn't change the actual styles, but makes post-processing changes to the table styles much simpler as it is no longer necessary to introduce new styles for header rows and there are now only two styles where there was previously one per table.
2018-09-07Fix percentage image scaling in ODT (#4881)Nils Carlson1-0/+2
Image scaling in ODT was broken when a width was set to a percentage. The width was passed to the svg:width field as a pecentage, which is not correct according to the ODT standard. Instead the real dimensions should be passed as width and height and the style:rel-width attribute should be set to the percentage while style:rel-heigh attribute should be set to "scale". The converse is true if a percentage height is given. This is now fixed and documents produced are now properly scaled.
2018-05-14Make internal links work in ODT/OpenDocument.John MacFarlane1-5/+11
This adds proper bookmarks to the headers with non-null IDs. Closes #4358.
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-01-19hlint code improvements.John MacFarlane1-1/+1
2018-01-05Update copyright notices to include 2018Albert Krewinkel1-2/+2
2017-12-28improve formatting of formulas in OpenDocumentoltolm1-1/+19
2017-12-04Add `empty_paragraphs` extension.John MacFarlane1-2/+2
* Deprecate `--strip-empty-paragraphs` option. Instead we now use an `empty_paragraphs` extension that can be enabled on the reader or writer. By default, disabled. * Add `Ext_empty_paragraphs` constructor to `Extension`. * Revert "Docx reader: don't strip out empty paragraphs." This reverts commit d6c58eb836f033a48955796de4d9ffb3b30e297b. * Implement `empty_paragraphs` extension in docx reader and writer, opendocument writer, html reader and writer. * Add tests for `empty_paragraphs` extension.
2017-11-01hlintAlexander Krotov1-1/+1