aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/RST.hs
AgeCommit message (Collapse)AuthorFilesLines
2018-10-04Add lookupMeta* functions to Text.Pandoc.Writers.Shared (#4907)Mauro Bieg1-4/+1
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-08-15Markdown reader: Use "tex" instead of "latex" for raw tex-ish content.John MacFarlane1-0/+1
We can't always tell if it's LaTeX, ConTeXt, or plain TeX. Better just to use "tex" always. Also changed: ConTeXt writer: now outputs raw "tex" blocks as well as "context". (Closes #969). RST writer: uses ".. raw:: latex" for "tex" content. (RST doesn't support raw context anyway.) Note that if "context" or "latex" specifically is desired, you can still force that in a markdown document by using the raw attribute (see MANUAL.txt): ```{=latex} \foo ``` Note that this change may affect some filters, if they assume that raw tex parsed by the Markdown reader will be RawBlock (Format "latex"). In most cases it should be trivial to modify the filters to accept "tex" as well.
2018-08-13RST writer: render Divs with admonition classes as admonitions.John MacFarlane1-3/+12
Also omit Div with class "admonition-title". These are generated by the RST reader and should be omitted on round-trip. Closes #4833.
2018-08-13RST writer: use `.. container` for generic Divs, instead of raw HTML.John MacFarlane1-4/+10
2018-08-05RST reader: improve parsing of inline interpreted text roles.John MacFarlane1-3/+6
* Use a Span with class "title-reference" for the default title-reference role. * Use B.text to split up contents into Spaces, SoftBreaks, and Strs for title-reference. * Use Code with class "interpreted-text" instead of Span and Str for unknown roles. (The RST writer has also been modified to round-trip this properly.) * Disallow blank lines in interpreted text. * Backslash-escape now works in interpreted text. * Backticks followed by alphanumerics no longer end interpreted text. Closes #4811.
2018-08-03RST writer: allow images to be directly nested within links, closes #4810 ↵Francesco Occhipinti1-0/+2
(#4814)
2018-08-01RST writer: use `titleblock` instead of `title` variable for title blockFrancesco Occhipinti1-4/+5
Closes #4803 After this commit use `$titleblock$` in order to get what was contained in `$title$` before, that is a title and subtitle rendered according to the official rST method: http://docutils.sourceforge.net/docs/user/rst/quickstart.html#document-title-subtitle. from With this commit, the `$title$` and `$subtitle$` metadata are available and they simply carry the metadata values. This opens up more possibilities in templates.
2018-07-02Spellcheck commentsAlexander Krotov1-1/+1
2018-06-30RST writer: don't treat 'example' as a syntax name.John MacFarlane1-1/+2
This fixes conversions from org with example blocks. Closes #4748.
2018-06-02Support --number-sections in RST output...John MacFarlane1-0/+1
via the "section-numbering" directive in standalone output.
2018-04-27RST writer: preserve empty inline parents in flatten (#4603)Francesco Occhipinti1-2/+5
2018-04-26RST reader: flatten nested inlines, closes #4368 (#4554)Francesco Occhipinti1-3/+75
nested inlines are not valid RST syntax, so we flatten them following some readability criteria discussed in #4368.
2018-04-19RST writer: use more consistent indentation.John MacFarlane1-6/+3
Previously we used an odd mix of 3- and 4-space indentation. Now we use 3-space indentation, except for ordered lists, where indentation must depend on the width of the list marker. Closes #4563.
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-17Fixed typo introduced in merge.John MacFarlane1-1/+1
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.