Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
Otherwise they get left dangling in the document.
|
|
Note that "Italic" can be on, and, from the last commit, `<w:i>` can be
present, but be turned off. In that case, the turned-off tag takes
precedence. So, we have to distinguish between something being off and
something not being there. Hence, isItalic, isBold, isStrike, and
isSmallCaps have become Maybes.
|
|
|
|
Introduces a new function in Reducibles, concatR. The idea is that if we
have two list of Reducibles (blocks or inlines), we can combine them and
just perform the reduction on the joining parts (the last element of the
first list, the first element of the second list). This is useful in cases
where the two lists are already reduced, and we're only worried about the
joining elements.
This actually improves the efficiency a bit further, because concatR can be
smart about empty lists.
|
|
Before, we had to run reduceList on the whole combined paragraph, which
was redundant, and could take some time for long paragraphs. We only
need to combine the drop cap with the first inline of the next
paragraph.
|
|
Make sure that adjacent inlines are combined properly in dropcaps. This
updates the test results as well.
|
|
If we get to a dropcap, we keep hold the inlines until the next
paragraph, and combine it there.
|
|
This changes the signature of the exported `readOMML` to `String ->
Either String [Exp]`, so it can now, in theory, be slotted into
TeXMath. It doesn't have any real error reporting yet, but that might
make more sense once I put it in a branch, and understand how it works
in the other readers.
It also now reads strings that parse to either oMath or oMathPara
elements. Note that the distinction is lost in the output. It's up to
the caller to remember the display type.
|
|
Math module
|
|
Previous drawings that were under some other toplevel run (i.e., a
hyperlink) wouldn't be properly handled. This should fix that.
|
|
Could use some cleanup, but this is the first step for getting
an OMML reader into TeXMath.
|
|
Signed-off-by: Jesse Rosenthal <jrosenthal@jhu.edu>
|
|
Since changing the Docx type, this is no longer necessary. Thanks to
Matthew Pickering for picking up on this.
|
|
This also introduces a `defaultDState` value.
|
|
The new version of TeXMath can translate from its type system into
LaTeX. So instead of writing the LaTeX ourself, we write to the TeXMath
`Exp` type, and let TeXMath do the rest.
|
|
|
|
All other underlines are ignored.
|
|
Moved `MediaBag` definition and functions from Shared:
`lookupMedia`, `mediaDirectory`, `insertMedia`, `extractMediaBag`.
Removed `emptyMediaBag`; use `mempty` instead, since `MediaBag`
is a Monoid.
|
|
Shared now exports functions for interacting with a MediaBag:
- `emptyMediaBag`
- `lookuMedia`
- `insertMedia`
- `mediaDirectory`
- `extractMediaBag`
|
|
Image data will not be put in a media bag map, which will be output
along with the pandoc output.
|
|
This will make paragraphs styled with `Author`, `Title`, `Subtitle`,
`Date`, and `Abstract` into pandoc metavalues, rather than text. The
implementation only takes those elements from the beginning of the
document (ignoring empty paragraphs).
Multiple paragraphs in the `Author` style will be made into a metaList,
one paragraph per item. Hard linebreaks (shift-return) in the paragraph
will be maintained, and can be used for institution, email, etc.
|
|
If header anchors (bookmarks in a header paragraph) already have an
auto-id, which will happen if they're generated by pandoc, we don't want
to rename it twice, and thus end up with an unnecessary number at the
end. So we add a state value to check if we're in a header. If we are,
we don't rename the bookmark -- wait until we rename it in our header
handling.
|
|
We don't need `updateDState` -- the built-in `modify` works just
fine. And we redefine `withDState` to use modify.
|
|
|
|
This modifies the Docx type in the parser to avoid all the extra files
(Notes, numbering, etc). A reader monad keeps track of these, and applies
them at the end. The reader monad is stacked with ErrorT to enable better
error-handling than the old Maybes. (Note that the better error handling
isn't really there yet, but it is now possible.)
One long-term goal of these changes is to make it easier to write the Docx
type. This should make it easier to develop a standalone docx package in the
future.
|
|
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.
|
|
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.
|
|
Fix hanging indent behavior
|
|
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.)
|
|
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.
|
|
Previously, only those with an anchor got an auto id. Now, all do, which
puts it in line with pandoc's markdown extension.
|
|
|
|
Record relationship between original id and auto id, so we can fix links
after.
|
|
In preparation for auto ids.
|
|
Using pattern guard, in preparation for doing some more complicated
stuff with it (recording header anchors, so we can change them to auto
ids.)
|
|
Use PatternGuards to get rid of need for `isJust`, `fromJust`
altogether.
|
|
It only applies to headers, so we can just apply it when we make a
header.
|
|
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).
|
|
|
|
This will only read the insertions, and ignore the deletions.
|
|
If a block has an indentation less than or equal to zero, it should not be
treated as a block quote.
|
|
This marks the removal of the final tree-walk in the code. (Though there
is still one in the Lists module.)
|
|
This commit also fixes a problem with the previous code pushes, which
wouldn't allow code blocks to share a div.
|
|
|
|
This cleans up them implementation, and cuts down on tree-walking.
Anecdotally, I've seen about a 3-fold speedup.
|
|
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.
|
|
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.
|
|
This was how it used to be before it was folded into blockNormalize.
|
|
`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.
|