Commit graph

1925 commits

Author SHA1 Message Date
John MacFarlane
76c55466d3 Use new warnings throughout the code base. 2017-02-11 00:14:44 +01:00
John MacFarlane
5e1249481b Added Text.Pandoc.Logging (exported module).
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-10 20:59:54 +01:00
John MacFarlane
c76eec97d4 LaTeX reader: Improved messages for skipped environments. 2017-02-10 10:00:23 +01:00
John MacFarlane
29b1ed0b84 LaTeX reader: Improved warning messages for unknown commands. 2017-02-10 08:36:04 +01:00
John MacFarlane
a84a360f7a HTML reader: Added warnings for ignored material.
See #3392.
2017-02-10 08:18:08 +01:00
John MacFarlane
87507e1b9c LaTeX reader: Issue warnings when skipping unknown latex commands.
See #3392.
2017-02-09 22:21:07 +01:00
John MacFarlane
6949d74e01 LaTeX reader: support \lstinputlisting.
Closes #2116.
2017-02-08 00:07:53 +01:00
John MacFarlane
e4d7bed51c RST reader: Improved admonition support.
* We no longer add an "admonition" class, we just use the
  class for the type of admonition, "note" for example.
* We put the word corresponding to the label in a paragraph
  inside a div at the beginning of the admonition with class
  "admonition-title".
* This is about as close as we can get to RST's own output.

See #223.
2017-02-07 23:18:56 +01:00
John MacFarlane
857d35fce4 Refactored some files formerly in LaTeX reader.
* Export readFileFromDirs from Class.
* Export insertIncludedFile from Parsing.

Simplified code in LaTeX/RST readers.
2017-02-07 22:33:05 +01:00
John MacFarlane
1ecc48e9f9 Moved readFileFromDirs to Text.Pandoc.Class.
This can be used in several different modules, not just
LaTeX reader.
2017-02-07 21:42:35 +01:00
John MacFarlane
9db98550df Refactored include file handling in LaTeX reader. 2017-02-07 19:16:56 +01:00
John MacFarlane
47a16065c4 Removed --parse-raw and readerParseRaw.
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-02-06 23:33:23 +01:00
John MacFarlane
76aa43c579 Docx reader: handle local namespace declarations.
Previously we didn't recognize math, for example, when
the xmlns declaration occured on the element and not the root.
Now we recognize either.

Closes #3365.

This patch defines findChildByName, findChildrenByName,
and findAttrByName in Util, and uses these in Parse.
2017-02-03 22:23:07 +01:00
John MacFarlane
23e6495624 Docx reader: Don't drop smartTag contents.
This just parses inside smartTags and yields their contents,
ignoring the attributes of the smartTag.  @jkr, you may want
to adjust this, but I wanted to get a fix in as fast as possible
for the dropped content.

Closes #2242; see also #3412.
2017-02-03 11:57:07 +01:00
John MacFarlane
5156a4fe3c Shared: rename compactify', compactify'DL -> compactify, compactifyDL. 2017-01-27 21:36:45 +01:00
John MacFarlane
56f74cb0ab Removed Shared.compactify.
Changed signatures on Parsing.tableWith and Parsing.gridTableWith.
2017-01-27 21:30:35 +01:00
John MacFarlane
65b8570e0e Cleanups for rebase. 2017-01-25 17:07:43 +01:00
John MacFarlane
70b86f48e1 Removed readerVerbosity and writerVerbosity.
API change.

Also added a verbosity parameter to makePDF.
2017-01-25 17:07:43 +01:00
John MacFarlane
bc7e846da6 More logging-related changes.
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-25 17:07:43 +01:00
John MacFarlane
8280d6a489 Changes to verbosity in writer and reader options.
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-25 17:07:43 +01:00
John MacFarlane
01483f91bd Revert "Added page breaks into Pandoc."
This reverts commit f02a12aff638fa2339192231b8f601bffdfe3e14.
2017-01-25 17:07:43 +01:00
John MacFarlane
5bf9125770 Removed readerOldDashes and --old-dashes option, added old_dashes extension.
API change.  CLI option change.
2017-01-25 17:07:42 +01:00
John MacFarlane
6f8b967d98 Removed readerSmart and the --smart option; added Ext_smart extension.
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-25 17:07:42 +01:00
John MacFarlane
3876b91448 Make Extensions a custom type instead of a Set Extension.
The type is implemented in terms of an underlying bitset
which should be more efficient.

API change: from Text.Pandoc.Extensions export Extensions,
emptyExtensions, extensionsFromList, enableExtension, disableExtension,
extensionEnabled.
2017-01-25 17:07:42 +01:00
John MacFarlane
8165014df6 Removed --normalize option and normalization functions from Shared.
* 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-25 17:07:41 +01:00
John MacFarlane
2e7b0c7eda Added ReaderOptions parameter to readNative.
This makes it similar to the other readers -- even
though ReaderOptions is essentially ignored, the uniformity
is nice.
2017-01-25 17:07:41 +01:00
John MacFarlane
da2055d709 RST reader: rebase-related fixes to warnings. 2017-01-25 17:07:41 +01:00
John MacFarlane
7d21238d62 RST reader: removed now unnecessary lifts. 2017-01-25 17:07:41 +01:00
John MacFarlane
931528dba6 Markdown reader: Removed readMarkdownWithWarnings [API change]. 2017-01-25 17:07:41 +01:00
John MacFarlane
e1d2da4c22 Have warningWithPos take a SourcePos rather than Maybe SourcePos.
After all, we have warning if you don't want the source pos info.
2017-01-25 17:07:41 +01:00
John MacFarlane
f1cec1dd02 LaTeX reader: add warning when parsing unescaped characters
that normally need escaping in LaTeX.
2017-01-25 17:07:40 +01:00
John MacFarlane
92cc80b58b RST reader: implement start-after, end-before fields for include. 2017-01-25 17:07:40 +01:00
John MacFarlane
03ede3e312 RST reader: handle code, literal, number-lines, class, name for include. 2017-01-25 17:07:40 +01:00
John MacFarlane
d595702b17 RST reader include: handle negative values for start-, end-line. 2017-01-25 17:07:40 +01:00
John MacFarlane
223dff4d29 RST reader: support start-line and end-line in include.
Just skip other options for now.
2017-01-25 17:07:40 +01:00
John MacFarlane
ad3ff342dd RST reader: Simple .. include:: support.
TODO: handle the options (see comment in code).
See #223.
2017-01-25 17:07:40 +01:00
John MacFarlane
c55a98ff0d LaTeX reader: Make sure we process includes in preamble. 2017-01-25 17:07:40 +01:00
John MacFarlane
7a68617556 LaTeX reader: further fixes to include. 2017-01-25 17:07:40 +01:00
John MacFarlane
62b30d8418 Give source position for include file loop. 2017-01-25 17:07:40 +01:00
John MacFarlane
1a0d93a1d3 LaTeX reader: Proper include file processing.
* Removed handleIncludes from LaTeX reader [API change].
* Now the ordinary LaTeX reader handles includes in a way
  that is appropriate to the monad it is run in.
2017-01-25 17:07:40 +01:00
John MacFarlane
dc1bbaf58d Removed readRSTWithWarnings (now useless). 2017-01-25 17:07:40 +01:00
John MacFarlane
1ed925ac20 TWiki reader: Remove old readTWikiWithWarnings'.
We get warnings for free now from PandocM.
(And anyway, this reader doesn't generate any!)
2017-01-25 17:07:40 +01:00
John MacFarlane
a4bd650277 Class: rename addWarning[WithPos] to warning[WithPos].
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-25 17:07:40 +01:00
John MacFarlane
2710fc4261 Class: Renamed 'warn' to 'addWarning' and consolidated RTF writer.
* 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-25 17:07:40 +01:00
John MacFarlane
830be4d632 Refactored math conversion in writers.
* Remove exported module `Text.Pandoc.Readers.TeXMath`
* Add exported module `Text.Pandoc.Writers.Math`
* The function `texMathToInlines` now lives in `Text.Pandoc.Writers.Math`
* Export helper function `convertMath` from `Text.Pandoc.Writers.Math`
* Use these functions in all writers that do math conversion.

This ensures that warnings will always be issued for failed
math conversions.
2017-01-25 17:07:40 +01:00
Jesse Rosenthal
650fa20788 Readers: pass errors straight up to PandocMonad.
Since we've unified error types, we can just throw the same error at
the toplevel.
2017-01-25 17:07:40 +01:00
Jesse Rosenthal
d5051ae101 Remove redundant imports from OPML reader. 2017-01-25 17:07:40 +01:00
Jesse Rosenthal
3574b98f81 Unify Errors. 2017-01-25 17:07:40 +01:00
Jesse Rosenthal
3f7b3f5fd0 Add Text2Tags to Text.Pandoc 2017-01-25 17:07:40 +01:00
Jesse Rosenthal
b53ebcdf8e Working on readers. 2017-01-25 17:07:40 +01:00