aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/RST.hs
AgeCommit message (Collapse)AuthorFilesLines
2017-01-25Removed `--normalize` option and normalization functions from Shared.John MacFarlane1-1/+1
* Removed normalize, normalizeInlines, normalizeBlocks from Text.Pandoc.Shared. These shouldn't now be necessary, since normalization is handled automatically by the Builder monoid instance. * Remove `--normalize` command-line option. * Don't use normalize in tests. * A few revisions to readers so they work well without normalize.
2017-01-25RST reader: rebase-related fixes to warnings.John MacFarlane1-13/+12
2017-01-25RST reader: removed now unnecessary lifts.John MacFarlane1-8/+7
2017-01-25Have warningWithPos take a SourcePos rather than Maybe SourcePos.John MacFarlane1-2/+2
After all, we have warning if you don't want the source pos info.
2017-01-25RST reader: implement start-after, end-before fields for include.John MacFarlane1-6/+12
2017-01-25RST reader: handle code, literal, number-lines, class, name for include.John MacFarlane1-30/+27
2017-01-25RST reader include: handle negative values for start-, end-line.John MacFarlane1-23/+30
2017-01-25RST reader: support start-line and end-line in include.John MacFarlane1-2/+8
Just skip other options for now.
2017-01-25RST reader: Simple `.. include::` support.John MacFarlane1-2/+65
TODO: handle the options (see comment in code). See #223.
2017-01-25Removed readRSTWithWarnings (now useless).John MacFarlane1-10/+1
2017-01-25Class: rename addWarning[WithPos] to warning[WithPos].John MacFarlane1-7/+7
There's already a function addWarning in Parsing! Maybe we can dispense with that now, but I still like 'warning' better as a name.
2017-01-25Class: Renamed 'warn' to 'addWarning' and consolidated RTF writer.John MacFarlane1-5/+5
* Renaming Text.Pandoc.Class.warn to addWarning avoids conflict with Text.Pandoc.Shared.warn. * Removed writeRTFWithEmbeddedImages from Text.Pandoc.Writers.RTF. This is no longer needed; we automatically handle embedded images using the PandocM functions. [API change]
2017-01-25Readers: pass errors straight up to PandocMonad.Jesse Rosenthal1-2/+1
Since we've unified error types, we can just throw the same error at the toplevel.
2017-01-25Unify Errors.Jesse Rosenthal1-1/+2
2017-01-25Working on readers.Jesse Rosenthal1-115/+130
2016-12-07RST reader: print warnings when keys, substitition, notes not found.John MacFarlane1-6/+26
Previously the parsers failed and we got raw text. Now we get a link with an empty URL, or empty inlines in the case of a note or substitution.
2016-12-07RST reader: fix hyperlink aliases.John MacFarlane1-2/+10
`link <google_>`_ .. _google: https://google.com is really a reference link. Closes #3283.
2016-10-17RST reader: skip whitespace before note.Jesse Rosenthal1-2/+3
RST requires a space before a footnote marker. We discard those spaces so that footnotes will be adjacent to the text that comes before it. This is in line with what rst2latex does. rst2html does not discard the space, but its html output is different than pandoc's, so this seems the most semantically correct approach. Closes #3163
2016-10-13Parse line-oriented markup as LineBlockAlbert Krewinkel1-2/+2
Markup-features focusing on lines as distinctive part of the markup are read into `LineBlock` elements. This currently means line blocks in reStructuredText and Markdown (the latter only if the `line_block` extension is enabled), the `linegroup`/`line` combination from the Docbook 5.1 working draft, and Org-mode `VERSE` blocks.
2016-09-02Remove Compat.MonoidJesse Rosenthal1-1/+1
This was only necessary for GHC versions with base below 4.5 (i.e., ghc < 7.4).
2016-07-20RST reader: use Div for admonitions.John MacFarlane1-8/+6
Previously blockquotes were used. Now a Div is used with class `admonition` and (if relevant) one of the following: `attention`, `caution`, `danger`, `error`, `hint`, `important`, `note`, `tip`, `warning`. `sidebar` is also put into a Div. Note: This will change rendering of RST documents! It should provide much more flexibility. Closes #3031.
2016-06-25Fixed RST links with no explicit link text.John MacFarlane1-1/+4
The link `<foo>`_ should have `foo` as both its link text and its URL. See RST spec at <http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#embedded-uris-and-aliases> "The reference text may also be omitted, in which case the URI will be duplicated for use as the reference text. This is useful for relative URIs where the address or file name is also the desired reference text: See `<a_named_relative_link>`_ or `<an_anonymous_relative_link>`__ for details." Closes Debian #828167 -- reported by Christian Heller.
2016-05-01Add class option for code block in RST readerSidharth Kapur1-6/+8
According to http://docutils.sourceforge.net/docs/ref/rst/directives.html#code, the code directive supports the ":class:" option.
2015-12-13RST reader: image attributesmb211-7/+14
2015-12-12Modified readers to emit SoftBreak when appropriate.John MacFarlane1-1/+1
2015-11-19Merge branch 'new-image-attributes' of https://github.com/mb21/pandoc into ↵John MacFarlane1-8/+10
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-09Restored Text.Pandoc.Compat.Monoid.John MacFarlane1-1/+1
Don't use custom prelude for latest ghc. This is a better approach to making 'stack ghci' and 'cabal repl' work. Instead of using NoImplicitPrelude, we only use the custom prelude for older ghc versions. The custom prelude presents a uniform API that matches the current base version's prelude. So, when developing (presumably with latest ghc), we don't use a custom prelude at all and hence have no trouble with ghci. The custom prelude no longer exports (<>): we now want to match the base 4.8 prelude behavior.
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-3/+1
- 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-08-15RST reader: better handling of indirect roles.John MacFarlane1-9/+11
Previously the parser failed on this kind of case .. role:: indirect(code) .. role:: py(indirect) :language: python :py:`hi` Now it currectly recognizes `:py:` as a code role. The previous test for this didn't work, because the name of the indirect role was the same as the language defined its parent, os it didn't really test for this behavior. Updated test.
2015-08-07Updated readers, writers and README for link attributemb211-1/+1
2015-08-07Updated readers and writers for new image attribute parameter.John MacFarlane1-8/+10
(mb21)
2015-07-03Readers.RST: Factor out inline markup string parsingLars-Dominik Braun1-15/+11
2015-07-03Readers.RST: Parse field list nameLars-Dominik Braun1-1/+1
“Inline markup is parsed in field names.” [1] [1] http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#field-lists
2015-06-29Fix RST reference names with special charactersLars-Dominik Braun1-1/+1
2015-04-26Updated copyright notices to -2015. Closes #2111.John MacFarlane1-2/+2
2015-04-18Revert "Merge pull request #1947 from mpickering/Fmonad"John MacFarlane1-1/+1
Closes #2062. This reverts commit c302bdcdbe97b38721015fe82403b2a8f488a702, reversing changes made to b983adf0d0cbc98d2da1e2751f46ae1f93352be6. Conflicts: src/Text/Pandoc/Parsing.hs src/Text/Pandoc/Readers/Markdown.hs src/Text/Pandoc/Readers/Org.hs src/Text/Pandoc/Readers/RST.hs
2015-02-18Change return type of RST readerMatthew Pickering1-2/+4
2015-02-18Changed parseWithWarnings to the more general returnWarnings parser transformerMatthew Pickering1-1/+1
2015-01-05ghc 7.10.1 RC1 requires FlexibleContexts ↵Mark Wright1-1/+2
https://ghc.haskell.org/trac/ghc/wiki/Migration/7.10#Inferredtype-signaturesnowmayrequiretoenableFlexibleContextsGADTsorTypeFamilies ; ghc 7.10.1 RC1 requires specifying the type of String literals https://ghc.haskell.org/trac/ghc/wiki/Migration/7.10#GHCsaysNoinstanceforFoldable...arisingfromtheuseof...
2014-12-12RST: warn about ignored fields in role directivesDaniel Bergey1-6/+26
2014-12-12RST Reader: compute Attrs when role is definedDaniel Bergey1-15/+15
Move recursive role lookup from renderRole to addNewRole. The Attr value will be the same for every occurance of this role, so there's no reason to compute it every time. This allows simplifying the stateRstCustomRoles map considerably. We could go even further, and remove the fmt and attr arguments to renderRole, which are null except for custom roles.
2014-12-12RST reader: improve support for custom rolesDaniel Bergey1-11/+14
- Add "sourceCode" to classes for :code: role, and anything inheriting from it. - Add the name of the custom role to classes if the Inline constructor supports Attr. - If the custom role directive does not specify a parent role, inherit from the :span: role. This differs somewhat from the rst2xml.py behavior. If a custom role inherits from another custom role, Pandoc will attach both roles' names as classes. rst2xml.py will only use the class of the directly invoked role (though in the case of inheriting from a :code: role with a :language: defined, it will also provide the inherited language as a class).
2014-12-12RST: literal role should produce Code,Daniel Bergey1-2/+2
code role should have "code" class. http://docutils.sourceforge.net/docs/ref/rst/roles.html says that `text`:literal` is the same as ``text``. docutils outputs a <literal> element in both cases, whereas for the code role, it outputs a <literal> element with the "code" class.
2014-12-12expose warnings from RST reader; refactorDaniel Bergey1-2/+9
This commit moves some code which was only used for the Markdown Reader into a generic form which can be used for any Reader. Otherwise, it takes naming and interface cues from the preexisting Markdown code.
2014-12-08RST Reader: Warn about skipped directivesDaniel Bergey1-1/+4
move `addWarning` to Parsing.hs, so it can be used by Markdown & RST readers.
2014-12-01parse RST class directivesDaniel Bergey1-2/+8
The class directive accepts one or more class names, and creates a Div value with those classes. If the directive has an indented body, the body is parsed as the children of the Div. If not, the first block folowing the directive is made a child of the Div. This differs from the behavior of rst2xml, which does not create a Div element. Instead, the specified classes are applied to each child of the directive. However, most Pandoc Block constructors to not take an Attr argument, so we can't duplicate this behavior.
2014-12-01parse RST quoted literal blocksDaniel Bergey1-1/+9
closes #65 RST quoted literal blocks are the same as indented literal blocks (which pandoc already supports) except that the quote character is preserved in each line. This includes test cases for the quoted literal block, as well as additional tests for line blocks and indented literal blocks, to verify that these are unaffected by the changes.
2014-08-04Remove redundant isHexDigit function.Artyom Kazak1-4/+1