aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/Textile.hs
AgeCommit message (Collapse)AuthorFilesLines
2018-01-05Update copyright notices to include 2018Albert Krewinkel1-2/+2
2017-11-02hlintAlexander Krotov1-5/+4
2017-10-27hlint suggestions.John MacFarlane1-1/+1
2017-10-27Automatic reformating by stylish-haskell.John MacFarlane1-4/+4
2017-10-27Consistent underline for Readers (#2270)hftf1-2/+2
* Added underlineSpan builder function. This can be easily updated if needed. The purpose is for Readers to transform underlines consistently. * Docx Reader: Use underlineSpan and update test * Org Reader: Use underlineSpan and add test * Textile Reader: Use underlineSpan and add test case * Txt2Tags Reader: Use underlineSpan and update test * HTML Reader: Use underlineSpan and add test case
2017-09-12Textile reader: allow 'pre' code in list item.John MacFarlane1-8/+4
Closes #3916.
2017-07-07Rewrote LaTeX reader with proper tokenization.John MacFarlane1-1/+1
This rewrite is primarily motivated by the need to get macros working properly. A side benefit is that the reader is significantly faster (27s -> 19s in one benchmark, and there is a lot of room for further optimization). We now tokenize the input text, then parse the token stream. Macros modify the token stream, so they should now be effective in any context, including math. Thus, we no longer need the clunky macro processing capacities of texmath. A custom state LaTeXState is used instead of ParserState. This, plus the tokenization, will require some rewriting of the exported functions rawLaTeXInline, inlineCommand, rawLaTeXBlock. * Added Text.Pandoc.Readers.LaTeX.Types (new exported module). Exports Macro, Tok, TokType, Line, Column. [API change] * Text.Pandoc.Parsing: adjusted type of `insertIncludedFile` so it can be used with token parser. * Removed old texmath macro stuff from Parsing. Use Macro from Text.Pandoc.Readers.LaTeX.Types instead. * Removed texmath macro material from Markdown reader. * Changed types for Text.Pandoc.Readers.LaTeX's rawLaTeXInline and rawLaTeXBlock. (Both now return a String, and they are polymorphic in state.) * Added orgMacros field to OrgState. [API change] * Removed readerApplyMacros from ReaderOptions. Now we just check the `latex_macros` reader extension. * Allow `\newcommand\foo{blah}` without braces. Fixes #1390. Fixes #2118. Fixes #3236. Fixes #3779. Fixes #934. Fixes #982.
2017-06-20Move CR filtering from tabFilter to the readers.John MacFarlane1-2/+2
The readers previously assumed that CRs had been filtered from the input. Now we strip the CRs in the readers themselves, before parsing. (The point of this is just to simplify the parsers.) Shared now exports a new function `crFilter`. [API change] And `tabFilter` no longer filters CRs.
2017-06-19Separated tracing from logging.John MacFarlane1-4/+2
Formerly tracing was just log messages with a DEBUG log level. We now make these things independent. Tracing can be turned on or off in PandocMonad using `setTrace`; it is independent of logging. * Removed `DEBUG` from `Verbosity`. * Removed `ParserTrace` from `LogMessage`. * Added `trace`, `setTrace` to `PandocMonad`.
2017-06-10Changed all readers to take Text instead of String.John MacFarlane1-2/+5
Readers: Renamed StringReader -> TextReader. Updated tests. API change.
2017-05-28Parsing: `many1Till`: Check for the end condition before parsingHerwig Stuetz1-1/+1
By not checking for the end condition before the first parse, the parser was applied too often, consuming too much of the input. This fixes the behaviour of `testStringWith (many1Till (oneOf "ab") (string "aa")) "aaa"` which before incorrectly returned `Right "a"`. With this change, it instead correctly fails with `Left (PandocParsecError ...)` because it is not able to parse at least one occurence of `oneOf "ab"` that is not `"aa"`. Note that this only affects `many1Till p end` where `p` matches on a prefix of `end`.
2017-05-24Parsing: Provide parseFromString'.John MacFarlane1-4/+4
This is a verison of parseFromString specialied to ParserState, which resets stateLastStrPos at the end. This is almost always what we want. This fixes a bug where `_hi_` wasn't treated as emphasis in the following, because pandoc got confused about the position of the last word: - [o] _hi_ Closes #3690.
2017-05-15Textile reader: fix bug for certain links in table cells.John MacFarlane1-2/+5
Closes #3667.
2017-05-13Update dates in copyright noticesAlbert Krewinkel1-3/+4
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-04Stylish-haskell automatic formatting changes.John MacFarlane1-16/+16
2017-02-11Use new warnings throughout the code base.John MacFarlane1-4/+2
2017-02-10Added Text.Pandoc.Logging (exported module).John MacFarlane1-0/+1
This now contains the Verbosity definition previously in Options, as well as a new LogMessage datatype that will eventually be used instead of raw strings for warnings. This will enable us, among other things, to provide machine-readable warnings if desired. See #3392.
2017-02-06Removed --parse-raw and readerParseRaw.John MacFarlane1-6/+0
These were confusing. Now we rely on the +raw_tex or +raw_html extension with latex or html input. Thus, instead of --parse-raw -f latex we use -f latex+raw_tex and instead of --parse-raw -f html we use -f html+raw_html
2017-01-25More logging-related changes.John MacFarlane1-7/+4
Class: * Removed getWarnings, withWarningsToStderr * Added report * Added logOutput to PandocMonad * Make logOutput streaming in PandocIO monad * Properly reverse getLog output Readers: * Replaced use of trace with report DEBUG. TWiki Reader: Put everything inside PandocMonad m. API changes.
2017-01-25Changes to verbosity in writer and reader options.John MacFarlane1-1/+1
API changes: Text.Pandoc.Options: * Added Verbosity. * Added writerVerbosity. * Added readerVerbosity. * Removed writerVerbose. * Removed readerTrace. pandoc CLI: The `--trace` option sets verbosity to DEBUG; the `--quiet` option sets it to ERROR, and the `--verbose` option sets it to INFO. The default is WARNING.
2017-01-25Removed readerOldDashes and --old-dashes option, added old_dashes extension.John MacFarlane1-3/+1
API change. CLI option 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-84/+92
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-08-06MediaWiki reader: properly interpret XML tags in pre environments.John MacFarlane1-3/+2
They are meant to be interpreted as literal text in textile. Closes #3042.
2016-07-22Textile reader: disallow empty URL in explicit link.John MacFarlane1-1/+1
Closes #3036.
2016-07-22Textile reader: support `bc..` extended code blocks.John MacFarlane1-5/+25
Also, remove trailing newline in code blocks (consistently with Markdown reader).
2016-07-19Textile reader: improve definition list parsing.John MacFarlane1-6/+13
- Allow multiple terms (which we concatenate with linebreaks). - Fix exponential parsing bug (closes #3020 for real this time).
2016-07-18Textile reader: improved table parsing.John MacFarlane1-22/+62
We now handle cell and row attributes, mostly by skipping them. However, alignments are now handled properly. Since in pandoc alignment is per-column, not per-cell, we try to devine column alignments from cell alignments. Table captions are also now parsed, and textile indicators for thead and tfoot no longer cause parse failure. (However, a row designated as tfoot will just be a regular row in pandoc.)
2016-07-14Fixed exponential parsing bug in textile reader.John MacFarlane1-0/+1
Closes #3020.
2016-06-25Textile reader: Fix overly aggressive interpretation as images.John MacFarlane1-7/+4
Spaces are not allowed in the image URL in textile. Closes #2998.
2016-06-23Textile reader: fixed attributes.John MacFarlane1-1/+3
Attributes can't be followed by a space. So, _(class)emph_ but _(noclass) emph_ Closes #2984.
2016-01-25Textile reader: Support `>`, `<`, `=`, `<>` text alignment attributes.John MacFarlane1-2/+19
Closes #2674.
2016-01-02Textile reader: don't allow block HTML tags in inline contexts.John MacFarlane1-2/+2
The reader previously did allow this, following redcloth, which happily parses Html blocks can be <div>inlined</div> as well. as <p>Html blocks can be <div>inlined</div> as well.</p> This is invalid HTML, and this kind of thing can lead to parsing problems (stack overflows) as well. So this commit undoes this behavior. The above sample now produces; <p>Html blocks can be</p> <div> <p>inlined</p> </div> <p>as well.</p>
2015-12-13new function to extract multiple properties at once in CSS.hsmb211-4/+1
and use it in Textile reader
2015-12-03Textile Reader: image attributesmb211-2/+9
closes #2515
2015-11-16Textile reader: skip over attribute in image source.John MacFarlane1-0/+1
We don't have a place yet for styles or sizes on images, but we can skip the attributes rather than incorrectly taking them to be part of the filename. Closes #2515.
2015-11-09Restored Text.Pandoc.Compat.Monoid.John MacFarlane1-0/+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-30Textile reader: don't do smart punctuation unless explicitly asked.John MacFarlane1-3/+4
Closes #2480. Note that although smart punctuation is part of the textile spec, it's not always wanted when converting from textile to, say, Markdown. So it seems better to make this an option.
2015-10-14Use custom Prelude to avoid compiler warnings.John MacFarlane1-2/+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-05-28Removed tab chars in Textile reader source.John MacFarlane1-2/+2
2015-04-26Updated copyright notices to -2015. Closes #2111.John MacFarlane1-2/+2
2015-02-18Change return type of Textile readerMatthew Pickering1-1/+2
2015-02-02Textile reader: table improvements.John MacFarlane1-16/+14
* Handle newlines in cells. * Handle empty cells. * Closes #1919.
2014-08-11Textile reader: list and HTML block parsing improvements.John MacFarlane1-16/+13
Closes #1513. Lists can now start without an intervening blank line. Also, html block-level tags that don't start a line are parsed as RawInline and don't interrupt paragraphs, as in RedCloth.
2014-08-08Textile reader: fixed list parsing bug. Closes #1500.John MacFarlane1-5/+16
2014-08-08Textile reader: don't allow inline formatting to extend over newline.John MacFarlane1-1/+2
This matches behavior of RedCarpet, avoids some ugly bugs, and improves performance.