Commit graph

1861 commits

Author SHA1 Message Date
Alexander Krotov
fa515e46f3 Muse writer: fix hlint errors (#3764) 2017-06-26 15:07:45 +02:00
John MacFarlane
b2fe009d8f LaTeX writer: use BCP47 parser. 2017-06-26 15:04:22 +02:00
John MacFarlane
4cbbc9dd58 BCP47: split toLang from getLang, rearranged types. 2017-06-25 23:16:55 +02:00
John MacFarlane
d0d2443f2e Refactored ConTeXt writer to use BCP47.
BCP47 - consistent case for BCP47 fields (e.g. uppercase
for region).
2017-06-25 21:56:29 +02:00
John MacFarlane
ac9423eccc Moved BCP47 specific functions from Writers.Shared to new module.
Text.Pandoc.BCP47 (unexported, internal module).
`getLang`, `Lang(..)`, `parseBCP47`.
2017-06-25 21:00:35 +02:00
John MacFarlane
643cbdf104 Writers.Shared: improve type of Lang and bcp47 parser.
Use a real parsec parser for BCP47, include variants.
2017-06-25 18:31:59 +02:00
John MacFarlane
e7cd3cb466 Writers.Shared: refactored getLang, splitLang...
into `Lang(..)`, `getLang`, `parceBCP47`.
2017-06-25 15:36:30 +02:00
John MacFarlane
3ae4105d14 Fixed support for lang attribute in OpenDocument and ODT writers.
This improves on the last commit, which didn't work in
some important ways.

See #1667.
2017-06-25 13:49:40 +02:00
John MacFarlane
083a224d1e Support lang attribute in OpenDocument and ODT writers.
This adds the required attributes to the temporary styles,
and also replaces existing language attributes in styles.xml.

Support for lang attributes on Div and Span has also been
added.

Closes #1667.
2017-06-25 12:46:26 +02:00
John MacFarlane
0c993a6c7b Text.Pandoc.Writers.Shared: export splitLang. 2017-06-25 12:46:26 +02:00
John MacFarlane
87e6235fe7 Text.Pandoc.Writers.Shared: added getLang. 2017-06-25 10:37:49 +02:00
John MacFarlane
57cc9a391c Markdown writer: make sure plain, markdown_github, etc. work for raw.
Previously only `markdown` worked.

Note: currently a raw block labeled `markdown_github` will
be printed for any `markdown` format.
2017-06-23 11:51:44 +02:00
John MacFarlane
da7d9ef295 HTML writer: make sure html4, html5 formats work for raw blocks/inlines. 2017-06-23 11:51:26 +02:00
John MacFarlane
4a6868885d EPUB writer: put title_page.xhtml in text/. 2017-06-22 12:42:21 +02:00
John MacFarlane
2b3e8cb718 EPUB writer: Fixed various things with new EPUB structure. 2017-06-22 12:38:08 +02:00
John MacFarlane
379b99f63a Added writerEpubSubdirectory to WriterOptions.
[API change]

The EPUB writer now takes its EPUB subdirectory from this option.

Also added `PandocEpubSubdirectoryError` to `PandocError`.
This is raised if the EPUB subdirectory is not all ASCII
alphanumerics.

See #3720.
2017-06-22 11:43:50 +02:00
John MacFarlane
242e2a064f Change default EPUB directory structure in OCF container.
See #3720.
We now put all EPUB related content in an EPUB/ subdirectory
by default (later this will be configurable).

    mimetype
    META-INF/
      com.apple.ibooks.display-options.xml
      container.xml
    EPUB/ <<--configurable-->>
      fonts/ <<--static-->>
      font.otf
    media/ <<--static-->>
      cover.jpg
      fig1.jpg
    styles/ <<--static-->>
      stylesheet.css
    content.opf
    toc.ncx
    text/ <<--static-->>
      ch001.xhtml
2017-06-21 23:54:16 +02:00
John MacFarlane
c349f0b0ba Writers: adjusted for renderTemplate' changes.
Now we raise a proper error on template failure.
2017-06-20 22:43:48 +02:00
John MacFarlane
429c4620df Removed redundant import. 2017-06-20 16:44:05 +02:00
John MacFarlane
ea1724e35e Docbook, JATS, TEI writers: print INFO message when omitting interior header.
This only applies to section headers inside list items, e.g.,
which were otherwise silently omitted.

See #3750.
2017-06-20 14:22:19 +02:00
John MacFarlane
b26d3c4522 FB2 writer: don't fail with an error on interior headers (e.g. in list).
Instead, omit them with an INFO message.

Closes #3750.
2017-06-20 14:21:43 +02:00
John MacFarlane
6a077ac9c7 Fixed footnotes in table captions.
Note that if the table has a first page header and a
continuation page header, the notes will appear only
on the first occurrence of the header.

Closes #2378.
2017-06-20 11:21:32 +02:00
John MacFarlane
b3041de2fc Text.Pandoc.Writers.Math: export defaultMathJaxURL, defaultKaTeXURL.
This will ensure that we only need to update these in one place.
(Currently, for example, the mathjax URL is used in both
App and trypandoc.)

Closes #3685.
2017-06-19 11:10:29 +02:00
John MacFarlane
ec3992b2f0 Use revealjs's math plugin for mathjax.
This is a thin wrapper around mathjax that makes math look better
on revealjs.

See https://github.com/hakimel/reveal.js/#mathjax

We do this by setting the 'mathjax' boolean variable and
using it in the revealjs template. Also, for revealjs
and mathjax, we don't assign the usual thing to the 'math'
variable, since it's handled by mathjax config.

Closes #3743.
2017-06-18 11:44:21 +02:00
John MacFarlane
9849ba7fd7 Use Control.Monad.State.Strict throughout.
This gives 20-30% speedup and reduction of memory
usage in most of the writers.
2017-06-17 07:45:28 +02:00
John MacFarlane
8a000e3ecc Markdown writer: don't allow soft break in header.
Closes #3736.
2017-06-12 09:23:30 +02:00
John MacFarlane
fa719d0264 Switched Writer types to use Text.
* 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-06-11 00:46:31 +02:00
John MacFarlane
0c2a509dfb Writers.Shared: metaToJSON, generalized type so it can take a Text.
Previously a String was needed as argument; now any ToJSON
instance will do.

API change.
2017-06-10 23:10:33 +02:00
Albert Krewinkel
55d679e382
Improve code style in lua and org modules 2017-06-03 13:35:19 +02:00
John MacFarlane
18f86a0c02 Fixed keywords in docx writer.
(See #3719)
2017-06-02 10:17:19 +02:00
Ian
b2fe1015d9 Add keywords metadata to docx document properties
Hi, I don't know haskell so possibly this is wrong, but DOCX stores keywords in cp:keywords in core.xml, and this should be easy to add from the pandoc metadata (I copy and paste the author code). As far as I can tell (no clear documentation, just a few refs), keywords should be separated with a comma.
2017-06-02 10:47:30 +08:00
John MacFarlane
8218bdb95c HTML writer: Avoid two class attributes when adding 'uri' class.
Closes #3716.
2017-06-01 18:41:54 +02:00
John MacFarlane
c366fab2cb Markdown writer: Avoid inline surround-marking with empty content.
E.g. we don't want `<strong></strong>` to become `****`.
Similarly for emphasis, super/subscript, strikeout.

Closes #3715.
2017-06-01 12:30:58 +02:00
John MacFarlane
8614902234 Markdown writer: changes to --reference-links.
With `--reference-location` of `section` or `block`, pandoc
will now repeat references that have been used in earlier
sections.

The Markdown reader has also been modified, so that *exactly*
repeated references do not generate a warning, only
references with the same label but different targets.

The idea is that, with references after every block,
one  might want to repeat references sometimes.

Closes #3701.
2017-05-27 23:18:45 +02:00
John MacFarlane
8ec03cfc87 HTML writer: Removed unused parameter in dimensionsToAttributeList. 2017-05-26 10:21:55 +02:00
John MacFarlane
cb7b0a6985 Allow em for image height/width in HTML, LaTeX.
- Export `inEm` from ImageSize [API change].
- Change `showFl` and `show` instance for `Dimension` so
  extra decimal places are omitted.
- Added `Em` as a constructor of `Dimension` [API change].
- Allow `em`, `cm`, `in` to pass through without conversion
  in HTML, LaTeX.

Closes #3450.
2017-05-25 22:48:27 +02:00
John MacFarlane
650e1ac1fd Docx writer: Use Table rather than "Table Normal" for table style.
"Table Normal" is the default table style and can't be modified.

Closes #3275, further testing welcome.
2017-05-25 12:11:46 +02:00
John MacFarlane
8edeaa9349 Fixed handling of soft hyphen (0173) in docx writer.
Closes #3691.
2017-05-23 16:58:24 +02:00
Albert Krewinkel
5debb0da0f Shared: Provide custom isURI that rejects unknown schemes [isURI]
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-23 09:48:11 +02:00
John MacFarlane
ca77f0a95e RST writer: add empty comments when needed...
to avoid including a blocquote in the indented content
of a preceding block.

Closes #3675.
2017-05-19 21:05:15 +02:00
John MacFarlane
f870a2d8ea Don't render LaTeX images with data: URIs.
LaTeX can't handle these.

Note that --extract-media can be used when the input contains
data: URIs.  Closes #3636.
2017-05-18 22:50:07 +02:00
Ian
b9185b0216 Docx writer: Change FigureWithCaption to CaptionedFigure (#3658)
Edit styles.xml as part of the fix for #3656
2017-05-18 22:34:13 +02:00
John MacFarlane
7b3aaee15a Markdown writer: Fixed duplicated reference links
with `--reference-links` and `--reference-location=section`.
Also ensure that there are no empty link references `[]`.

Closes #3674.
2017-05-17 16:23:33 +02:00
Albert Krewinkel
965f1ddd4a
Update dates in copyright notices
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-13 23:30:13 +02:00
Albert Krewinkel
1cbb3bad2b
Add haddock module description to FB2 writer
Copyright, maintainer etc. were missing in haddock docs for this module.
2017-05-13 23:18:50 +02:00
Albert Krewinkel
62d34c79b9
Change maintainer line in Org writer module 2017-05-13 23:18:10 +02:00
David A Roberts
cff6d2dd73 Markdown writer: missing \n (#3647) 2017-05-07 23:11:57 +02:00
Alexander Krotov
69110cde81 Muse writer: Indent tables with one space (#3649)
It is required to trigger Muse table rendering.
2017-05-07 21:41:38 +02:00
Alexander Krotov
430e6be1f4 Muse writer: omit automatic header identifiers (#3633) 2017-05-04 11:36:52 +02:00
David A Roberts
79855ef934 Markdown writer: better escaping for links (#3628)
Previously the Markdown writer would sometimes create links where there
were none in the source.  This is now avoided by selectively escaping bracket
characters when they occur in a place where a link might be created.

Closes #3619.
2017-05-03 12:19:45 +02:00