aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/Org/Inlines.hs
AgeCommit message (Collapse)AuthorFilesLines
2019-05-05Org reader: prefer plain symbols over math symbolsAlbert Krewinkel1-1/+1
Symbols like `\alpha` are output plain and unemphasized, not as math. Fixes: #5483
2019-03-01Remove license boilerplate.John MacFarlane1-18/+0
The haddock module header contains essentially the same information, so the boilerplate is redundant and just one more thing to get out of sync.
2019-02-04Add missing copyright notices and remove license boilerplate (#5112)Albert Krewinkel1-2/+2
Quite a few modules were missing copyright notices. This commit adds copyright notices everywhere via haddock module headers. The old license boilerplate comment is redundant with this and has been removed. Update copyright years to 2019. Closes #4592.
2019-01-01Org reader: fix self-link parsing regressionAlbert Krewinkel1-5/+6
Fixes a regression introduced by the previous commit.
2019-01-01Org reader: fix treatment of links to imagesAlbert Krewinkel1-11/+15
Links with descriptions which are pointing to images are no longer read as inline images, but as proper links. Fixes: #5191
2019-01-01Org reader: hlintAlbert Krewinkel1-2/+2
2018-10-22Add enclosedByPair1 and change relevant invocations.leungbk1-7/+13
2018-09-28Parse empty argument array in inline src blocks.leungbk1-1/+2
`enclosedByPair` alone does not the handle the empty array properly since it uses `many1Till`.
2018-09-26Force inline code blocks to honor export options.leungbk1-2/+3
`exportsCode` is moved from `Blocks.hs` to `Shared.hs` and exported accordingly.
2018-07-02Spellcheck commentsAlexander Krotov1-1/+1
2018-03-18Removed unnecessary import.John MacFarlane1-2/+0
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-16Monoid/Semiground cleanup relying on custom Prelude.John MacFarlane1-1/+0
2018-03-13Require pandoc-types 1.17.4.John MacFarlane1-1/+1
And a few tweaks related to the Semigroups/Monoid change. Closes #4448.
2018-02-21Org reader: allow changing emphasis syntaxAlbert Krewinkel1-10/+6
The characters allowed before and after emphasis can be configured via `#+pandoc-emphasis-pre` and `#+pandoc-emphasis-post`, respectively. This allows to change which strings are recognized as emphasized text on a per-document or even per-paragraph basis. The allowed characters must be given as (Haskell) string. #+pandoc-emphasis-pre: "-\t ('\"{" #+pandoc-emphasis-post: "-\t\n .,:!?;'\")}[" If the argument cannot be read as a string, the default value is restored. Closes: #4378
2018-01-05Update copyright notices to include 2018Albert Krewinkel1-2/+2
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-10-02Org reader: support `\n` export optionAlbert Krewinkel1-1/+2
The `\n` export option turns all newlines in the text into hard linebreaks. Closes #3950
2017-09-25Org reader: update emphasis border charsAlbert Krewinkel1-3/+3
The org reader was updated to match current org-mode behavior: the set of characters which are acceptable to occur as the first or last character in an org emphasis have been changed and now allows all non-whitespace chars at the inner border of emphasized text (see `org-emphasis-regexp-components`). Fixes: #3933
2017-07-07Rewrote LaTeX reader with proper tokenization.John MacFarlane1-2/+3
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-03Improve code style in lua and org modulesAlbert Krewinkel1-7/+6
2017-06-03Org reader: apply hlint suggestionsAlbert Krewinkel1-31/+33
2017-05-31Org reader: fix module names in haddock commentsAlbert Krewinkel1-1/+1
Copy-pasting had lead to haddock module descriptions containing the wrong module names.
2017-05-28Org reader: Fix cite parsing behaviourHerwig Stuetz1-2/+10
Until now, org-ref cite keys included special characters also at the end. This caused problems when citations occur right before colons or at the end of a sentence. With this change, all non alphanumeric characters at the end of a cite key are ignored. This also adds `,` to the list of special characters that are legal in cite keys to better mirror the behaviour of org-export.
2017-05-28Parsing: `many1Till`: Check for the end condition before parsingHerwig Stuetz1-2/+2
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-18Org reader: fix smart parsing behaviorAlbert Krewinkel1-9/+14
Parsing of smart quotes and special characters can either be enabled via the `smart` language extension or the `'` and `-` export options. Smart parsing is active if either the extension or export option is enabled. Only smart parsing of special characters (like ellipses and en and em dashes) is enabled by default, while smart quotes are disabled. This means that all smart parsing features will be enabled by adding the `smart` language extension. Fine-grained control is possible by leaving the language extension disabled. In that case, smart parsing is controlled via the aforementioned export OPTIONS only. Previously, all smart parsing was disabled unless the language extension was enabled.
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-05-06Org reader: support macrosAlbert Krewinkel1-0/+21
Closes: #3401
2017-04-30Add returnF to Text.Pandoc.ParsingAlexander Krotov1-1/+1
2017-04-23Org reader: stop adding rundoc prefix to src paramsAlbert Krewinkel1-4/+3
Source block parameter names are no longer prefixed with *rundoc*. This was intended to simplify working with the rundoc project, a babel runner. However, the rundoc project is unmaintained, and adding those markers is not the reader's job anyway. The original language that is specified for a source element is now retained as the `data-org-language` attribute and only added if it differs from the translated language.
2017-04-16Org reader: allow emphasized text to be followed by `[`Albert Krewinkel1-1/+1
Closes: #3577
2017-03-04Stylish-haskell automatic formatting changes.John MacFarlane1-24/+24
2017-02-06Removed --parse-raw and readerParseRaw.John MacFarlane1-1/+2
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-25Removed readerSmart and the --smart option; added Ext_smart extension.John MacFarlane1-1/+1
Now you will need to do -f markdown+smart instead of -f markdown --smart This change opens the way for writers, in addition to readers, to be sensitive to +smart, but this change hasn't yet been made. API change. Command-line option change. Updated manual.
2017-01-25Working on readers.Jesse Rosenthal1-117/+129
2017-01-06Remove pipe char irking the haddock coverage toolAlbert Krewinkel1-1/+1
Haddock documentation strings must be associated with functions. Remove pipe char from a comment that was moved into a `do` block in `Readers/Org/Inlines.hs`.
2017-01-06Org reader: accept org-ref citations followed by commasAlbert Krewinkel1-15/+16
Bugfix for an issue which, whenever the citation was immediately followed by a comma, prevented correct parsing of org-ref citations.
2017-01-05Org reader: ensure emphasis markup can be nestedAlbert Krewinkel1-0/+3
Nested emphasis markup (e.g. `/*strong and emphasized*/`) was interpreted incorrectly in that the inner markup was not recognized.
2016-11-19Org reader: Ensure images in paragraphs are not parsed as figuresAlbert Krewinkel1-13/+2
This fixes a regression introduced in 7e5220b57c5a48fabe6e43ba270db812593d3463.
2016-09-02Fix grouping of imports.Jesse Rosenthal1-1/+1
Some source files keep imports in tidy groups. Changing `Text.Pandoc.Compat.Monoid` to `Data.Monoid` could upset that. This restores tidiness.
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-09Org reader: ensure image sources are proper linksAlbert Krewinkel1-25/+8
Image sources as those in plain images, image links, or figures, must be proper URIs or relative file paths to be recognized as images. This restriction is now enforced for all image sources. This also fixes the reader's usage of uncleaned image sources, leading to `file:` prefixes not being deleted from figure images (e.g. `[[file:image.jpg]]` leading to a broken image `<img src="file:image.jpg"/>) Thanks to @bsag for noticing this bug.
2016-07-14Org reader: fix parsing of verbatim inlinesAlbert Krewinkel1-2/+4
Org rules for allowed characters before or after markup chars were not checked for verbatim text. This resultet in wrong parsing outcomes of if the verbatim text contained e.g. space enclosed markup characters as part of the text (`=is_substr = True=`). Forcing the parser to update the positions of allowed/forbidden markup border characters fixes this. This fixes #3016.
2016-06-21Org reader: remove partial functionsAlbert Krewinkel1-17/+17
Partial functions like `head` lead to avoidable errors and should be avoided. They are replaced with total functions. This fixes #2991.
2016-06-13Org reader: support arbitrary raw inlinesAlbert Krewinkel1-1/+9
Org mode allows arbitrary raw inlines ("export snippets" in Emacs parlance) to be included as `@@format:raw foreign format text@@`. Support for this features is added to the Org reader.
2016-06-05Org reader: add support for "Berkeley-style" citesAlbert Krewinkel1-7/+126
A specification for an official Org-mode citation syntax was drafted by Richard Lawrence and enhanced with the help of others on the orgmode mailing list. Basic support for this citation style is added to the reader. This closes #1978.
2016-06-05Org reader: add semicolon to list of special charsAlbert Krewinkel1-1/+1
Semicolons are used as special characters in citations syntax. This ensures the correct parsing of Pandoc-style citations: [prefix; @key; suffix] Previously, parsing would have failed unless there was a space or other special character as the last <prefix> character.
2016-06-03Org reader: support special strings export optionAlbert Krewinkel1-4/+8
Parsing of special strings (like '...' as ellipsis or '--' as en dash) can be toggled using the `-` option.
2016-06-03Org reader: support emphasized text export optionAlbert Krewinkel1-4/+11
Parsing of emphasized text can be toggled using the `*` option. This influences parsing of text marked as emphasized, strong, strikeout, and underline. Parsing of inline math, code, and verbatim text is not affected by this option.
2016-06-03Org reader: support smart quotes export optionAlbert Krewinkel1-0/+2
Reading of smart quotes can be toggled using the `'` option.