aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/RST.hs
AgeCommit message (Collapse)AuthorFilesLines
2018-03-17RST writer: filter out empty inline containers (#4434).Francesco Occhipinti1-3/+18
There is nothing in RST that corresponds to e.g. `Emph []`, so we just filter out elements like this.
2018-03-17RST writer: separate inline transformation logic from writing logic (#4438)Francesco Occhipinti1-18/+22
This is to help enable solutions solutions to #4434 and #4368.
2018-03-17RST writer: strip whitespace within inlines, closes #4327 (#4329)Francesco Occhipinti1-1/+3
+ Whitespace is ignored at the beginning and end of emphasis, as per <http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#inline-markup>. + Export `stripLeadingTrailingSpace` from `Text.Pandoc.Writers.Shared`.
2018-01-19hlint code improvements.John MacFarlane1-8/+7
2018-01-19remove `blockToRST'` moving its logic into `fixBlocks`danse1-32/+13
2018-01-19in RST writer insert comment between lists and quotes, closes #4248danse1-1/+12
2018-01-05Update copyright notices to include 2018Albert Krewinkel1-2/+2
2017-12-22RST writer: fix anchors for headers.John MacFarlane1-1/+1
We were missing an `_`. See #4188.
2017-11-01hlintAlexander Krotov1-2/+2
2017-10-29Source code reformatting.John MacFarlane1-3/+3
2017-10-29hlint suggestions.John MacFarlane1-18/+18
2017-10-27Automatic reformating by stylish-haskell.John MacFarlane1-7/+7
2017-10-16RST writer: correctly handle inline code containing backticks.John MacFarlane1-2/+7
(Use a :literal: role.) Closes #3974.
2017-10-16RST writer: don't backslash-escape word-internal punctuation.John MacFarlane1-15/+18
Closes #3978.
2017-09-27RST writer: add header anchors when header has non-standard id.John MacFarlane1-1/+6
Closes #3937.
2017-08-17RST reader/writer: support unknown interpreted text roles...John MacFarlane1-1/+6
...by parsing them as Span with "role" attributes. This way they can be manipulated in the AST. Closes #3407.
2017-08-09RST writer: don't wrap term in definition list.John MacFarlane1-1/+1
Wrapping is not allowed.
2017-06-20Writers: adjusted for renderTemplate' changes.John MacFarlane1-1/+1
Now we raise a proper error on template failure.
2017-06-17Use Control.Monad.State.Strict throughout.John MacFarlane1-1/+1
This gives 20-30% speedup and reduction of memory usage in most of the writers.
2017-06-11Switched Writer types to use Text.John MacFarlane1-5/+8
* XML.toEntities: changed type to Text -> Text. * Shared.tabFilter -- fixed so it strips out CRs as before. * Modified writers to take Text. * Updated tests, benchmarks, trypandoc. [API change] Closes #3731.
2017-05-23Shared: Provide custom isURI that rejects unknown schemes [isURI]Albert Krewinkel1-1/+0
We also export the set of known `schemes`. The new function replaces the function of the same name from `Network.URI`, as the latter did not check whether a scheme is well-known. E.g. MediaWiki wikis frequently feature pages with names like `User:John`. These links were interpreted as URIs, thus turning internal links into global links. This is prevented by also checking whether the scheme of a URI is frequently used (i.e. is IANA registered or an otherwise well-known scheme). Fixes: #2713 Update set of well-known URIs from IANA list All official IANA schemes (as of 2017-05-22) are included in the set of known schemes. The four non-official schemes doi, isbn, javascript, and pmid are kept.
2017-05-19RST writer: add empty comments when needed...John MacFarlane1-3/+25
to avoid including a blocquote in the indented content of a preceding block. Closes #3675.
2017-05-13Update dates in copyright noticesAlbert Krewinkel1-2/+2
This follows the suggestions given by the FSF for GPL licensed software. <https://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html>
2017-03-21RST writer: improve grid table output, fix bug with empty rows.John MacFarlane1-32/+11
Uses the new gridTable in Writers.Shared, which is here improved to better handle 0-width cells. Closes #3516.
2017-03-13RST writer: convert to PandocMonad, report on unrendered raw items.John MacFarlane1-31/+39
2017-03-10Removed normalizeSpaces from Text.Pandoc.Shared.John MacFarlane1-3/+3
Rewrote functions in RST reader and writer to avoid the need for it. Closes #1530.
2017-03-08Remove space at beginning/end of RST code span.John MacFarlane1-1/+4
Otherwise we get invalid RST. There seems to be no way to escape the space. Closes #3496.
2017-03-04Stylish-haskell automatic formatting changes.John MacFarlane1-29/+29
2017-03-01Writers: Use gets to access MonadState where possible (#3480)Alexander Krotov1-14/+14
2017-02-11RST reader/writer: properly handle table captions.John MacFarlane1-4/+5
Currently the support for the `.. table` directive is a bit limited; we don't yet support the `widths` field. But at least you can have a proper captioned table.
2017-02-04Improved escaping in RST writer with smart option.John MacFarlane1-6/+20
2017-02-04Implemented +/-smart in rst writer.John MacFarlane1-3/+14
Moved unsmartify to Writers.Shared.
2017-01-25Revert "Added page breaks into Pandoc."John MacFarlane1-1/+0
This reverts commit f02a12aff638fa2339192231b8f601bffdfe3e14.
2017-01-25Convert all writers to use PandocMonad.Jesse Rosenthal1-2/+3
Since PandocMonad is an instance of MonadError, this will allow us, in a future commit, to change all invocations of `error` to `throwError`, which will be preferable for the pure versions. At the moment, we're disabling the lua custom writers (this is temporary). This requires changing the type of the Writer in Text.Pandoc. Right now, we run `runIOorExplode` in pandoc.hs, to make the conversion easier. We can switch it to the safer `runIO` in the future. Note that this required a change to Text.Pandoc.PDF as well. Since running an external program is necessarily IO, we can be clearer about using PandocIO.
2017-01-25Adds support for pagebreaks (when it makes sense)Hubert Plociniczak1-0/+1
Update all writers to take into account page breaks. A straightforwad, far from complete, implementation of page breaks in selected writers. Readers will have to follow in the future as well.
2016-11-30Options: Removed writerStandalone, made writerTemplate a Maybe.John MacFarlane1-6/+6
Previously setting writerStandalone = True did nothing unless a template was provided in writerTemplate. Now a fragment will be generated if writerTemplate is Nothing; otherwise, the specified template will be used and standalone output generated. [API change]
2016-11-23Fixed some bugs in Pretty that caused blank lines in tables.John MacFarlane1-1/+1
The bugs caused spurious blank lines in grid tables when we had things like blankline $$ blankline Closes #3251.
2016-10-13Add support for the LineBlock element to writersAlbert Krewinkel1-2/+9
The following markup features are used to output the lines of the `LineBlock` element: - AsciiDoc: a `[verse]` block, - ConTeXt: text surrounded by `\startlines` and `\endlines`, - HTML: `div` with an per-element style setting to interpret the content as pre-wrapped, - Markdown: line blocks if the `line_blocks` extension is enabled, a simple paragraph with hard linebreaks otherwise, - Org: VERSE block, - RST: a line block, and - all other formats: a paragraph, containing hard linebreaks between lines. Custom lua writers should be updated to use the `LineBlock` element.
2016-01-05RST, Markdown writers: Fixed rendering of grid tables with blank rows.John MacFarlane1-1/+1
Closes #2615.
2015-12-11Implemented SoftBreak and new `--wrap` option.John MacFarlane1-1/+9
Added threefold wrapping option. * Command line option: deprecated `--no-wrap`, added `--wrap=[auto|none|preserve]` * Added WrapOption, exported from Text.Pandoc.Options * Changed type of writerWrapText in WriterOptions from Bool to WrapOption. * Modified Text.Pandoc.Shared functions for SoftBreak. * Supported SoftBreak in writers. * Updated tests. * Updated README. Closes #1701.
2015-11-19Merge branch 'new-image-attributes' of https://github.com/mb21/pandoc into ↵John MacFarlane1-20/+48
mb21-new-image-attributes * Bumped version to 1.16. * Added Attr field to Link and Image. * Added `common_link_attributes` extension. * Updated readers for link attributes. * Updated writers for link attributes. * Updated tests * Updated stack.yaml to build against unreleased versions of pandoc-types and texmath. * Fixed various compiler warnings. Closes #261. TODO: * Relative (percentage) image widths in docx writer. * ODT/OpenDocument writer (untested, same issue about percentage widths). * Update pandoc-citeproc.
2015-11-09Revert "Use -XNoImplicitPrelude and 'import Prelude' explicitly."John MacFarlane1-1/+0
This reverts commit c423dbb5a34c2d1195020e0f0ca3aae883d0749b.
2015-11-08Use -XNoImplicitPrelude and 'import Prelude' explicitly.John MacFarlane1-0/+1
This is needed for ghci to work with pandoc, given that we now use a custom prelude. Closes #2503.
2015-10-14Use custom Prelude to avoid compiler warnings.John MacFarlane1-1/+0
- The (non-exported) prelude is in prelude/Prelude.hs. - It exports Monoid and Applicative, like base 4.8 prelude, but works with older base versions. - It exports (<>) for mappend. - It hides 'catch' on older base versions. This allows us to remove many imports of Data.Monoid and Control.Applicative, and remove Text.Pandoc.Compat.Monoid. It should allow us to use -Wall again for ghc 7.10.
2015-10-12RST writer: do header normalization only in "standalone" mode.John MacFarlane1-8/+5
If we're producing a fragment, just skip normalization. After all, the fragment might be somewhere in the middle of the document. It's more important for fragments to have consistency in rendering (so they can be pieced together) than to normalize. This closes #2394. It's simpler and more robust than my earlier fix.
2015-10-12Revert "RST writer: tweaks to header normalization."John MacFarlane1-22/+4
This reverts commit 476b383c578699567ac4630391a15855521ab3d4.
2015-10-12RST writer: tweaks to header normalization.John MacFarlane1-4/+22
These changes are intended to make the writer more useful to people who are processing small fragments, which may for example look like this: ### third level header from previous section ## second level header Previously such fragments got turned into two headers of the same level. The new algorithm avoids doing any normalization until we hit the minimal-level header in the fragment (here, the second level header). Closes #2394.
2015-09-19[RST Writer] Don't normalize heading levels below input minimumNikolay Yakimov1-1/+7
2015-08-13RST writer: ensure that `\ ` is inserted when needed...John MacFarlane1-0/+2
...before Cite and Span elements that begin with a "complex" element. Closes jgm/pandoc-citeproc#157.
2015-08-12RST writer: Don't insert `\ ` when complex expression in matched pairs.John MacFarlane1-3/+4
E.g. `` [:sup:`3`] `` is okay; you don't need `` [:sup:`3`\ ] ``.