Commit graph

4962 commits

Author SHA1 Message Date
John MacFarlane
e4263d306e Revamped raw HTML block parsing in markdown.
- We no longer include trailing spaces and newlines in the
  raw blocks.
- We look for closing tags for elements (but without backtracking).
- Each block-level tag is its own RawBlock; we no longer try to
  consolidate them (though `--normalize` will do so).

Closes #1330.
2014-07-07 15:53:59 -06:00
John MacFarlane
91b902f02f EPUB writer: better handle HTML media tags. 2014-07-07 15:53:59 -06:00
John MacFarlane
3d4e76f342 Parsing: Added stateInHtmlBlock to ParserState.
This is used to keep track of the ending tag we're waiting
for when we're parsing inside HTML block tags.
2014-07-07 15:53:59 -06:00
John MacFarlane
8c7abf173a normalize: consolidate adjacent RawBlocks when possible. 2014-07-07 15:53:59 -06:00
John MacFarlane
cbeb931554 HTML reader: adjust blockTags and eitherBlockOrInline.
- Added `audio` and `source` in `eitherBlockOrInline`.
- Moved `video`, `svg`, `progress`, `script`, `noscript`, `svg` from
  `blockTags` to `eitherBlockOrInline`.
- `map` and `object` were mistakenly in both lists; they have been removed
  from `blockTags`.
2014-07-07 15:53:59 -06:00
John MacFarlane
186b8e71e0 Merge pull request #1397 from jkr/equations
Docx Reader: Parse Docx OMML math/equations
2014-07-07 11:13:03 -06:00
John MacFarlane
5ea21760d9 MediaWiki writer: Minor renaming of 'st' prefixed names. 2014-07-04 18:56:11 -06:00
John MacFarlane
fb2e92b7fc Merge pull request #1399 from xkollar/reader
Modad.Reader + HLint for MediaWiki writer
2014-07-04 18:38:34 -06:00
Matej Kollar
0bda602fcb Little restructuralization. 2014-07-04 23:48:58 +02:00
Matej Kollar
d2c81346e7 Move more things to Reader. 2014-07-04 23:42:10 +02:00
Matej Kollar
0bc900e36a HLint suggestions. 2014-07-04 23:25:44 +02:00
Jesse Rosenthal
d77ccbba63 Docx Reader: Write LaTeX based on equations in word.
This is a first stab at writing out equations in LaTeX based on
omml equations in Word. There are some glitches: unicode chars not known to
LaTeX are silently skipped, and functions (such as `\oiiint`) not in the
standard LaTeX packages are inserted, which can lead to pdf compilation
errors (depending, of course, on your preamble).

Adding, for example, `\usepackage[charter]{mathdesign}` to the preamble will
allow you to use most of the more esoteric functions.
2014-07-02 16:54:33 -04:00
Jesse Rosenthal
9f4bacf86f Docx Reader: Add new file, TexChar.
This will allow us to deal with unicode characters from word equations. This
part of the process will need to continue to be improved.
2014-07-02 16:53:28 -04:00
Jesse Rosenthal
2bc0c77791 Docx Reader: Parse omml equations. 2014-07-02 16:52:39 -04:00
Matej Kollar
05b94c31ae Use Reader.
To avoid to pass opts explicitly around (as we
do not use it very much at the moment anyway)
2014-07-02 06:36:31 +02:00
John MacFarlane
264e366f1a Filters: respect shebang if filter is executable.
Closes #1389.
2014-06-30 14:03:47 -07:00
John MacFarlane
124cfb80f5 Merge pull request #1388 from jkr/divattrToCont-cleanup
Docx reader: clean up parStyle processing.
2014-06-30 10:34:31 -07:00
Jesse Rosenthal
0abfd386a4 Docx reader: clean up parStyle processing.
This gets rid of `divAttrToContainers`: an internal convenience function
which had become pretty inconvenient. Rather than converting classes and
indentations to string lists and back, we deal with the `pPr` attribute
directly.
2014-06-30 11:19:06 -04:00
John MacFarlane
3fbbafd391 Rewrote normalize for efficiency. (Closes #1385.)
* Added normalizeInlines, normalizeBlocks.
* Type signature is now more narrow, `Pandoc -> Pandoc` instead of
  `Data a :: a -> a`.  Some users may need to change their uses of
  `normalize` to the newly exported `normalizeInlines` or
  `normalizeBlocks`.
2014-06-29 23:05:08 -07:00
John MacFarlane
aad618d9db Merge pull request #1386 from jkr/hanging_indent
Fix hanging indent behavior
2014-06-29 21:31:44 -07:00
Jesse Rosenthal
1405e7b709 Docx reader: Add tests for hanging indent handline.
We want to treat it as a plain paragraph if the hanging amount is
greater to or equal to the left indent---i.e., if the first line has
zero indentation. But we still want it to be a block quote if it starts
to the right of the margin. Someone might format verse with wrapping
lines with a hanging indent, for example.
2014-06-29 23:37:00 -04:00
Jesse Rosenthal
0f59196e0e Docx reader: Make use of new ParIndentation info.
Here, when hanging indents are greater than or equal to left indents, we
don't set it to block quote. Such indents are frequently used in
academic bibliographies. (Thanks to Caleb McDaniel.)
2014-06-29 23:20:10 -04:00
Jesse Rosenthal
c0fcc8a789 Docx reader: Add ParIndentation type to parser.
This lets us keep more information about the indentation, and act
accordingly in the reader.
2014-06-29 23:19:56 -04:00
John MacFarlane
45d26fd01a Merge pull request #1383 from jkr/writer-bookmark-fix
Docx writer: insert bookmark tags inside <w:p> tag.
2014-06-29 20:01:51 -07:00
Jesse Rosenthal
0587334bc0 Docx writer: insert bookmark tags inside <w:p> tag.
This makes the header anchors in pandoc-generated ooxml match those
generated by word.
2014-06-29 16:38:51 -04:00
John MacFarlane
3c8f17b52c Merge pull request #1381 from jkr/updateDState
Docx Reader: Update state properly
2014-06-29 11:29:08 -07:00
Jesse Rosenthal
b1eba3c65c Docx Reader: Update state properly
Previously, a fresh state was created for the purpose of updating. In
the future, when there is more than one field in the state, this
obviously won't work.
2014-06-29 08:14:36 -04:00
John MacFarlane
ce69021e42 Merge pull request #1379 from jkr/more_auto_id
Docx Reader: Extend auto id behavior to all headers
2014-06-28 15:00:25 -07:00
Jesse Rosenthal
7fb74d88fb Update docx tests to reflect new expected behavior
Now doing auto ids for all headers, so tests should reflect that.
2014-06-28 17:47:00 -04:00
Jesse Rosenthal
c0a8d5ac72 Docx Reader: All headers get auto id.
Previously, only those with an anchor got an auto id. Now, all do, which
puts it in line with pandoc's markdown extension.
2014-06-28 17:47:00 -04:00
John MacFarlane
7fc7e61745 Merge pull request #1377 from jkr/monad
New DocxContext Monad, and rewriting anchor ids
2014-06-28 10:31:05 -07:00
Jesse Rosenthal
b152145d6d Change test result to match new behavior. 2014-06-28 04:00:17 -04:00
Jesse Rosenthal
dce360e1e6 Docx Reader: Introduce link rewriting. 2014-06-28 04:00:16 -04:00
Jesse Rosenthal
b89a3ba2b1 make makeHeaderAnchors make an auto id
Record relationship between original id and auto id, so we can fix links
after.
2014-06-28 04:00:16 -04:00
Jesse Rosenthal
5969baf5b9 Rewrote header generation.
In preparation for auto ids.
2014-06-28 04:00:16 -04:00
Jesse Rosenthal
1de8d4d087 Docx Reader: Simplify makeHeaderAnchors
Using pattern guard, in preparation for doing some more complicated
stuff with it (recording header anchors, so we can change them to auto
ids.)
2014-06-28 04:00:16 -04:00
Jesse Rosenthal
ab76bbebbe Docx Reader: Clean up guards
Use PatternGuards to get rid of need for `isJust`, `fromJust`
altogether.
2014-06-28 04:00:16 -04:00
Jesse Rosenthal
db187348cd Docx rdr: Avoid mapping makeHeaderAnchors globally
It only applies to headers, so we can just apply it when we make a
header.
2014-06-28 04:00:16 -04:00
Jesse Rosenthal
4248f25152 Move Docx reader to DocxContext monad
This is a ReaderT State stack, which keeps track of some environment info, such
as the options and the docx doc. The state will come in handy in the future,
for a couple of planned features (rewriting the section anchors as auto_idents,
and hopefully smart-quoting).
2014-06-28 04:00:16 -04:00
John MacFarlane
b1a8f1fa1a Fixed --filter so it doesn't search PATH for a filter with a path.
This fixed a bug wherein `--filter ./caps.py` would run `caps.py` from
the system path, even if there was a `caps.py` in the working directory.
2014-06-27 18:30:57 -07:00
John MacFarlane
b2127311cb Require haddock-library >= 1.1 and simplify haddock reader code.
See #1346.
2014-06-26 12:35:13 -07:00
John MacFarlane
9f694619cd Merge pull request #1374 from jkr/track-changes-options
Track changes with options
2014-06-25 23:51:16 -07:00
John MacFarlane
2b958a2d03 Merge pull request #1375 from jkr/cleanup
Docx reader: Code cleanup in parse.
2014-06-25 23:50:36 -07:00
Jesse Rosenthal
2396be6f57 Docx reader: Code cleanup in parse.
Remove some redundant ways of dealing with Maybe.
2014-06-25 17:12:03 -04:00
Jesse Rosenthal
74676df75f Fix typo in README. 2014-06-25 16:19:27 -04:00
Jesse Rosenthal
afdc0af779 Track changes tests. 2014-06-25 16:13:59 -04:00
Jesse Rosenthal
58da1cd3bd Updated README to include "--track-changes" option. 2014-06-25 16:01:52 -04:00
John MacFarlane
e3beae5845 Merge pull request #1372 from jkr/track-changes
Rudimentary track-changes support
2014-06-25 12:50:21 -07:00
Jesse Rosenthal
0e9bf37f64 Docx reader: Make use of track-changes option. 2014-06-25 14:17:20 -04:00
Jesse Rosenthal
aa194d387c Add track changes option to command line. 2014-06-25 14:09:01 -04:00