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
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
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
Jesse Rosenthal
0e9bf37f64
Docx reader: Make use of track-changes option.
2014-06-25 14:17:20 -04:00
Jesse Rosenthal
ed44e4ca8c
Docx reader: Add rudimentary track changes support.
...
This will only read the insertions, and ignore the deletions.
2014-06-25 10:38:01 -04:00
Jesse Rosenthal
69743cd598
Docx reader: Ignore zero (or negative) indent
...
If a block has an indentation less than or equal to zero, it should not be
treated as a block quote.
2014-06-24 15:06:25 -04:00
Jesse Rosenthal
a8866bc121
Docx reader: remove T.P.Generic import.
...
This marks the removal of the final tree-walk in the code. (Though there
is still one in the Lists module.)
2014-06-24 12:15:26 -04:00
Jesse Rosenthal
5ae6b8c6f1
Docx reader: pass definition test.
...
This commit also fixes a problem with the previous code pushes, which
wouldn't allow code blocks to share a div.
2014-06-24 12:12:02 -04:00
Jesse Rosenthal
bebea5e936
Docx reader: pass code tests.
2014-06-24 10:34:07 -04:00
Jesse Rosenthal
11b0778744
Use Reducible in docx reader.
...
This cleans up them implementation, and cuts down on tree-walking.
Anecdotally, I've seen about a 3-fold speedup.
2014-06-23 17:08:17 -04:00
Jesse Rosenthal
8e5bd9d851
Docx reader: Fix spacing in formatting.
...
The normalizing tests revealed a problem with unformatted spaces, brought about
by `spanTrim`. This fixes by not trimming the spaces out of spans until they
are in their final form.
2014-06-22 01:53:30 -04:00
Jesse Rosenthal
9c7e0dc84b
Implement new normalization.
...
There were some problems with the old str normalization. This fixes those
problems. Also, since it drills down on its own, it only needs to be
mapped over the blocks, not walked over the tree.
2014-06-22 00:45:18 -04:00
Jesse Rosenthal
f6ae644831
Make strNormalize go bottomUp.
...
This was how it used to be before it was folded into blockNormalize.
2014-06-20 12:31:36 -04:00
Jesse Rosenthal
2aa5f58c5b
Docx reader: Add a comment explaining strNormalize
...
`normalize` from Text.Pandoc.Shared is more general. In tests, though,
it more than doubles the run time. `strNormalize` does less, but it does
what we need. This comment is added for future maintainability.
2014-06-20 10:27:18 -04:00
Jesse Rosenthal
03af19a7e1
Docx Reader: Normalize DefinitionLists
...
Previously DefinitionList had been left out of `blockNormalize`. Now it
is included.
2014-06-20 10:20:37 -04:00
Jesse Rosenthal
3da515bdb0
Docx reader: simplify blockNormalize
...
Use a function `stripSpaces`, instead of recursion. Makes it a bit
easier to read and mantain, and simplify normalizing DefinitionList,
which was left out the first time.
2014-06-20 10:12:28 -04:00
Jesse Rosenthal
7fd48b30e0
Docx reader: Fix hdr handling in block norm
...
`blockNormalize` previously forgot to account for the case in which a
Header's inlines did not start with a space.
2014-06-20 09:30:30 -04:00
Jesse Rosenthal
a934db9a32
Introduce blockNormalize
...
This will help take care of spaces introduced at the beginning of strings.
2014-06-19 19:28:55 -04:00
Jesse Rosenthal
0e7d2dbd43
Have Docx reader properly interpret tabs.
2014-06-19 17:55:02 -04:00
John MacFarlane
7d60c798bf
Fixed compiler warning.
2014-06-16 23:02:20 -07:00
John MacFarlane
bbe99003f8
Naming: Use Docx instead of DocX.
...
For consistency with the existing writer.
2014-06-16 22:44:40 -07:00