aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
AgeCommit message (Collapse)AuthorFilesLines
2019-09-22RST reader: Fixed parsing of indented blocks.John MacFarlane1-6/+9
We were requiring consistent indentation, but this isn't required by RST, as long as each nonblank line of the block has *some* indentation. Closes #5753.
2019-09-22[Docx Writer] Re-use Readers.Docx.Parse for StyleMap (#5766)Nikolay Yakimov5-411/+385
* [Docx Parser] Move style-parsing-specific code to a new module * [Docx Writer] Re-use Readers.Docx.Parse.Styles for StyleMap * [Docx Writer] Move Readers.Docx.StyleMap to Writers.Docx.StyleMap It's never used outside of writer code, so it makes more sense to scope it under writers really.
2019-09-22Make `plain` output plainer.John MacFarlane2-5/+17
Previously we used the following Project Gutenberg conventions for plain output: - extra space before and after level 1 and 2 headings - all-caps for strong emphasis `LIKE THIS` - underscores surrounding regular emphasis `_like this_` This commit makes `plain` output plainer. Strong and Emph inlines are rendered without special formatting. Headings are also rendered without special formatting, and with only one blank line following. To restore the former behavior, use `-t plain+gutenberg`. API change: Add `Ext_gutenberg` constructor to `Extension`. See #5741.
2019-09-22Use HsYAML-0.2.0.0John MacFarlane2-17/+20
Most of this is due to @vijayphoenix (#5704), but it needed some revisions to integrate with current master, and to use the released HsYAML. Closes #5704.
2019-09-21[Docx Writer] Consistently use style names, not style idsNikolay Yakimov1-27/+25
Styles that this change affects: paragraph styles: Author, Abstract, Compact, Figure, Captioned Figure, Image Caption, First Paragraph, Source Code, Table Caption, Definition, Definition Term; character styles: Verbatim Char, token styles (those with names ending in Tok)
2019-09-21[Docx Writer] Code clean-upNikolay Yakimov1-40/+37
Reduce code duplication, remove redundant brackets
2019-09-21[Docx Reader] Use style names, not ids, for assigning semantic meaningNikolay Yakimov3-183/+287
Motivating issues: #5523, #5052, #5074 Style name comparisons are case-insensitive, since those are case-insensitive in Word. w:styleId will be used as style name if w:name is missing (this should only happen for malformed docx and is kept as a fallback to avoid failing altogether on malformed documents) Block quote detection code moved from Docx.Parser to Readers.Docx Code styles, i.e. "Source Code" and "Verbatim Char" now honor style inheritance Docx Reader now honours "Compact" style (used in Pandoc-generated docx). The side-effect is that "Compact" style no longer shows up in docx+styles output. Styles inherited from "Compact" will still show up. Removed obsolete list-item style from divsToKeep. That didn't really do anything for a while now. Add newtypes to differentiate between style names, ids, and different style types (that is, paragraph and character styles) Since docx style names can have spaces in them, and pandoc-markdown classes can't, anywhere when style name is used as a class name, spaces are replaced with ASCII dashes `-`. Get rid of extraneous intermediate types, carrying styleId information. Instead, styleId is saved with other style data. Use RunStyle for inline style definitions only (lacking styleId and styleName); for Character Styles use CharStyle type (which is basicaly RunStyle with styleId and StyleName bolted onto it).
2019-09-21[Docx Reader] Code clean-upNikolay Yakimov2-63/+39
Reduce code duplication, remove redundant brackets, use newtype instead of data where appropriate
2019-09-20Changes to Slides to be more flexible with Div structure.John MacFarlane1-0/+3
Previously if you had ``` ::: #foo c ::: ``` slide level would be 1, not 2.
2019-09-20Preserve built-in styles in DOCX with custom style (#5670)Ben Steinberg1-22/+55
This commit prevents custom styles on divs and spans from overriding styles on certain elements inside them, like headings, blockquotes, and links. On those elements, the "native" style is required for the element to display correctly. This change also allows nesting of custom styles; in order to do so, it removes the default "Compact" style applied to Plain blocks, except when inside a table.
2019-09-20Bug fixes to EPUB chapter splitting.John MacFarlane1-15/+16
2019-09-19MediaWiki: skip optional {{table}} template.John MacFarlane1-0/+1
See https://en.wikipedia.org/wiki/Template:Table Closes #5757.
2019-09-19Clarify warning for missing title.John MacFarlane1-3/+3
Closes #5760.
2019-09-19EPUB writer: make --epub-chapter-level work again.John MacFarlane1-19/+15
It was temporarily broken by the latest change to chapter splitting code.
2019-09-19EPUB writer: improve splitting into chapters.John MacFarlane2-39/+29
+ Use makeSection from T.P.Shared. This deals better with embedded divs. (Closes #5761.) + Remove chapter-title class from chapter h1, for now. (Reverts one change made earlier; we may revisit this in light of #5749.) + Avoid issuing warning multiple times when title not set (see #5760).
2019-09-19Remove admonition-title remnants.John MacFarlane1-1/+1
Completes 8e01ccb41dde8a5e6123f5b0746c36f240576047
2019-09-18LaTeX writer: use `\hspace{0pt}` for 0-width space U+200B.John MacFarlane1-0/+1
Closes #5756.
2019-09-16PDF: Fix test for Cygwin. See #5451.John MacFarlane1-2/+2
2019-09-14Add chapter-title class to EPUB chapter title h1 elements.John MacFarlane1-3/+5
See #5269.
2019-09-14EPUB toChapters: don't treat "refs" Div specially.John MacFarlane1-1/+1
This should make toChapters work better if there are Divs around sections.
2019-09-12Better message for PandocShouldNeverHappenError.John MacFarlane1-1/+3
2019-09-12Change exit codes.John MacFarlane1-3/+3
It's good practice not to use codes 1-2 for user errors. Also, we used 65 for two different errors. - PandocAppError was 1, is now 4 - PandocOptionError was 2, is now 6 - PandocMakePDFError was 65, is now 66
2019-09-10Add --shift-heading-level-by option.John MacFarlane4-6/+37
Deprecate --base-heading-level. The new option does everything the old one does, but also allows negative shifts. It also promotes the document metadata (if not null) to a level-1 heading with a +1 shift, and demotes an initial level-1 heading to document metadata with a -1 shift. This supports converting documents that use an initial level-1 heading for the document title. Closes #5615.
2019-09-10Pass value of --dpi to rsvg-convert...John MacFarlane1-11/+15
when converting SVG to PDF in the process of creating a PDF. Closes #5721.
2019-09-09LaTeX reader: Fix parsing of optional arguments that contain braced text.John MacFarlane1-4/+3
Closes #5740.
2019-09-08Add -L option as shortcut for --lua-filter.John MacFarlane1-1/+1
2019-09-08Org reader: modify handling of example blocks. (#5717)Brian Leung2-14/+43
* Org reader: allow the `-i` switch to ignore leading spaces. * Org reader: handle awkwardly-aligned code blocks within lists. Code blocks in Org lists must have their #+BEGIN_ aligned in a reasonable way, but their other components can be positioned otherwise.
2019-09-08Replace Element and makeHierarchical with makeSections.John MacFarlane17-564/+459
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-09-08Revert changes to hierarchicalizeWithIds.John MacFarlane1-21/+5
Revert "hierarchicalize: ensure that sections get ids..." This reverts commit 212406a61d027d85712705e626954e0486a2bc34. Revert "Improve detection of headings in Divs by hierarchicalize." This reverts commit 6e2cfd6c97b1b8657f1f3e2b66090a2c3ba8d887. Revert "Shared.hierarchicalize: improve handling of div and section structure." This reverts commit 345b33762eb4cc6d57d74c76c4757a6166ee5c13.
2019-09-08Emit warning on `-f latex -o out.pdf` (#5736)Mauro Bieg2-0/+14
add UnusualConversion to LogMessage [API change]
2019-09-06hierarchicalize: ensure that sections get ids...John MacFarlane1-6/+10
even if they're in divs. Improves #3057.
2019-09-06Improve detection of headings in Divs by hierarchicalize.John MacFarlane1-1/+2
The structure ``` <h1>one</h1> <div> <h1>two</h1> </div> ``` should create two coordinate sections, not a section with a subsection. Now it does. Extends #3057.
2019-09-05Shared.hierarchicalize: improve handling of div and section structure.John MacFarlane1-4/+15
Previously Divs were opaque to hierarchicalize, so headings inside divs didn't get into the table of contents, for example (#3057). Now hierarchicalize treats Divs as sections when appropriate. For example, these structures both yield a section and a subsection: ``` html <div> <h1>one</h1> <div> <h2>two</h2> </div> </div> ``` ``` html <div> <h1>one</h1> <div> <h1>two</h1> </div> </div> ``` Note that ``` html <h1>one</h1> <div> <h2>two</h2> </div> <h1>three</h1> ``` gets parsed as the structure one two three which may not always be desirable. Closes #3057.
2019-09-05Roff reader: Better support for 'while'.John MacFarlane1-0/+3
2019-09-05Roff reader: improve handling of groups.John MacFarlane1-4/+2
2019-09-04asciidoc writer: don't include `+` in code blocks for regular asciidoc.John MacFarlane1-2/+7
This is asciidoctor-specific. Amends 98ee6ca289ad7117b7336a57bcfc6f4b54463f4e.
2019-09-04Roff reader: Fix problem parsing comments before macro.John MacFarlane1-2/+0
2019-09-04Roff reader: more improvements in parsing conditionals.John MacFarlane1-3/+4
2019-09-04Roff readers: better parsing of groups.John MacFarlane1-9/+5
We now allow groups where the closing `\\}` isn't at the beginning of a line. Closes #5410.
2019-09-03SelfContained: omit content-type on type attribute for `<style>`.John MacFarlane1-5/+8
It doesn't seem to be valid for HTML5, and as a result Chrome ignores the style element. Closes #5725.
2019-09-03XML: change toEntities to emit numerical hex character references.John MacFarlane1-1/+2
Previously decimal references were used. But Polyglot Markup prefers hex. See #5718. This affects the output of pandoc with `--ascii`.
2019-09-02LaTeX writer: use `cslreferences` environment for csl bibliographies.John MacFarlane1-3/+18
this allows bibliographies to receive special formatting. The template now contains definition of this environment (enabled only when CSL is used). It also defines a `\cslhangindent` length. This is set to 2em by default when the bibliography style specifies a hanging indent. To override the length, you can use e.g. \setlength{\cslhangindent}{7em} in header-includes. Closes jgm/pandoc-citeproc#410.
2019-09-02LaTeX reader: don't try to parse includes if raw_tex is set.John MacFarlane1-5/+13
When the `raw_tex` extension is set, we just carry through `\usepackage`, `\input`, etc. verbatim as raw LaTeX. Closes #5673.
2019-09-02HTML writer: use numeric character references with `--ascii`.John MacFarlane1-6/+2
Previously we used named character references with html5 output. But these aren't valid XML, and we aim to produce html5 that is also valid XHTML (polyglot markup). (This is also needed for epub3.) Closes #5718.
2019-09-02LaTeX reader: properly handle optional arguments for macros.John MacFarlane2-2/+2
Closes #5682.
2019-09-02LaTeX writer: strip off `{}` around locator for biblatex/natbib output.John MacFarlane1-1/+7
Closes #5722.
2019-08-31html2pdf: ensure temp file is deleted...John MacFarlane1-34/+35
even if the pdf program is not found. Closes #5720.
2019-08-27LaTeX reader: fix `\\` in `\parbox` inside a table cell.John MacFarlane1-3/+18
Closes #5711.
2019-08-27Markdown reader: Headers: don't parse content over newline boundary.John MacFarlane1-4/+15
Closes #5714.
2019-08-27Add stateAllowLineBreaks to ParserState. [API change]John MacFarlane1-0/+2