aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/Org/Blocks.hs
AgeCommit message (Collapse)AuthorFilesLines
2016-10-14Org reader: allow figure with empty captionAlbert Krewinkel1-3/+1
A `#+CAPTION` attribute before an image is enough to turn an image into a figure. This wasn't the case because the `parseFromString` function, which processes the caption value, would fail on empty values. Adding a newline character to the caption value fixes this. Fixes: #3161
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-10-10Org reader: trim verse lines properlyAlbert Krewinkel1-2/+4
An empty verse line should not result in `Str ""` but in `mempty`.
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-30Org reader: respect unnumbered header propertyAlbert Krewinkel1-2/+10
Sections the `unnumbered` property should, as the name implies, be excluded from the automatic numbering of section provided by some output formats. The Pandoc convention for this is to add an "unnumbered" class to the header. The reader treats properties as key-value pairs per default, so a special case is added to translate the above property to a class instead. Closes #3095.
2016-08-29Org reader: respect `author` export optionAlbert Krewinkel1-3/+3
The `author` option controls whether the author should be included in the final markup. Setting `#+OPTIONS: author:nil` will drop the author from the final meta-data output.
2016-08-29Org reader: extract meta parsing code to moduleAlbert Krewinkel1-64/+1
Parsing of meta-data is well separable from other block parsing tasks. Moving into new module to get small files and clearly arranged code.
2016-08-09Merge pull request #3065 from tarleb/org-verse-indentJohn MacFarlane1-1/+10
Org reader: preserve indentation of verse lines
2016-08-09Org reader: ensure image sources are proper linksAlbert Krewinkel1-12/+22
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-08-08Org reader: preserve indentation of verse linesAlbert Krewinkel1-1/+10
Leading spaces in verse lines are converted to non-breaking spaces, so indentation is preserved. This fixes #3064.
2016-07-04Org reader: replace ugly code with view patternAlbert Krewinkel1-5/+4
Some less-than-smart code required a pragma switching of overlapping pattern warnings in order to compile seamlessly. Using view patterns makes the code easier to read and also doesn't require overlapping pattern checks to be disabled.
2016-07-03Org reader: support headline levels export settingAlbert Krewinkel1-6/+27
The depths of headlines can be modified using the `H` option. Deeper headlines will be converted to lists.
2016-07-02Org reader: put export setting parser into moduleAlbert Krewinkel1-116/+2
Export option parsing is distinct enough from general block parsing to justify putting it into a separate module.
2016-07-01Org reader: support archived trees export optionsAlbert Krewinkel1-6/+43
Handling of archived trees can be modified using the `arch` option. Archived trees are either dropped, exported completely, or collapsed to include just the header when the `arch` option is nil, non-nil, or `headline`, respectively.
2016-07-01Org reader: refactor comment tree handlingAlbert Krewinkel1-1/+20
Comment trees were handled after parsing, as pattern matching on lists is easier than matching on sequences. The new method of reading documents as trees allows for more elegant subtree removal.
2016-07-01Org reader: parse as headlines, convert to blocksAlbert Krewinkel1-47/+86
Emacs org-mode is based on outline-mode, which treats documents as trees with headlines are nodes. The reader is refactored to parse into a similar tree structure. This simplifies transformations acting on document (sub-)trees.
2016-07-01Org reader: improve tag and properties type safetyAlbert Krewinkel1-25/+57
Specific newtype definitions are used to replace stringly typing of tags and properties. Type safety is increased while readability is improved.
2016-06-26Org reader: support figure labelsAlbert Krewinkel1-1/+6
Figure labels given as `#+LABEL: thelabel` are used as the ID of the respective image. This allows e.g. the LaTeX to add proper `\label` markup. This fixes half of #2496 and #2999.
2016-06-21Org reader: remove partial functionsAlbert Krewinkel1-2/+4
Partial functions like `head` lead to avoidable errors and should be avoided. They are replaced with total functions. This fixes #2991.
2016-06-03Org reader: support special strings export optionAlbert Krewinkel1-1/+1
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-1/+1
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-1/+1
Reading of smart quotes can be toggled using the `'` option.
2016-06-02Org reader: drop unused field from parser stateAlbert Krewinkel1-6/+5
The `OrgParserState` contained both an `orgStateMeta` and `orgStateMeta'` field, the former for plain meta information and the latter for F-monad wrapped meta info. The plain meta info is only used to make `OrgParserState` an instance of the `HasMeta` class, which in turn is never used in the reader. The (F Meta) version is hence renamed to the "un-primed" version while the other one is dropped.
2016-06-02Org reader: undo code duplicationAlbert Krewinkel1-21/+3
Some code was duplicated (copy-pasted) or placed in an inappropriate module during the modularization refactoring. Those functions are moved into a `Shared` module, as was originally intended but forgotten. Better documentation of the respective functions is a positive side-effect.
2016-05-29Org reader: support new syntax for export blocksAlbert Krewinkel1-0/+9
Org-mode version 9 usees a new syntax for export blocks. Instead of `#+BEGIN_<FORMAT>`, where `<FORMAT>` is the format of the block's content, the new format uses `#+BEGIN_export <FORMAT>` instead. Both types are supported.
2016-05-29Org reader: refactor BEGIN…END block parsingAlbert Krewinkel1-111/+131
- Reorder functions, grouping related functions together. - Demote simple functions to local functions if they are used just once. - Rename and document functions to increase code readability. - Fix handling of whitespace in blocks, allowing content to be indented less then the block header.
2016-05-29Org reader: rename `parseInlines` to `inlines`Albert Krewinkel1-7/+7
Having a function starting with `parse` in a parsing library is overly redundant. Let's use a nicer, shorter name more in line with the rest of the library.
2016-05-25Org reader: extract blocks parser to moduleAlbert Krewinkel1-0/+891
Block parsing code is moved to a separate module. This is part of the Org-mode reader cleanup effort.