aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/LaTeX
AgeCommit message (Collapse)AuthorFilesLines
2019-10-23T.P.Readers.LaTeX.Parsing: add `[Tok]` parameter to rawLaTeXParser.John MacFarlane1-4/+3
This allows us to avoid retokenizing multiple times in e.g. rawLaTeXBlock. (Unexported module, so not an API change.)
2019-09-28Use Prelude.fail to avoid ambiguity with fail from GHC.Base.John MacFarlane1-5/+5
2019-09-09LaTeX reader: Fix parsing of optional arguments that contain braced text.John MacFarlane1-4/+3
Closes #5740.
2019-09-02LaTeX reader: properly handle optional arguments for macros.John MacFarlane1-1/+1
Closes #5682.
2019-08-14LaTeX reader: improve withRaw so it can handle cases where...John MacFarlane1-2/+3
the token string is modified by a parser (e.g. accent when it only takes part of a Word token). Closes #5686. Still not ideal, because we get the whole `\t0BAR` and not just `\t0` as a raw latex inline command. But I'm willing to let this be an edge case, since you can easily work around this by inserting a space, braces, or raw attribute. The important thing is that we no longer drop the rest of the document after a raw latex inline command that gobbles only part of a Word token!
2019-07-19Markdown: Ensure that expanded latex macros end with space if original did.John MacFarlane1-1/+10
Closes #4442.
2019-07-16LaTeX reader: handle \looseness command values better.John MacFarlane1-5/+4
Closes #4439.
2019-03-01Remove license boilerplate.John MacFarlane3-54/+0
The haddock module header contains essentially the same information, so the boilerplate is redundant and just one more thing to get out of sync.
2019-02-04Add missing copyright notices and remove license boilerplate (#5112)Albert Krewinkel3-6/+6
Quite a few modules were missing copyright notices. This commit adds copyright notices everywhere via haddock module headers. The old license boilerplate comment is redundant with this and has been removed. Update copyright years to 2019. Closes #4592.
2019-01-31LaTeX reader: don't let `\egroup` match `{`.John MacFarlane1-3/+3
`braced` now actually requires nested braces. Otherwise some legitimate command and environment definitions can break (see test/command/tex-group.md).
2018-12-31Remove unused HasHeaderMap (#5175)Alexander1-6/+0
It is updated by some readers, but never actually used.
2018-11-19LaTeX reader: cleaned up handling of dimension arguments.John MacFarlane1-5/+11
Allow decimal points, preceding space. Also require text 1.1+.
2018-10-15LaTeX reader: withVerbatimMode now does nothing if already inJohn MacFarlane1-4/+8
verbatim mode. Previously nested uses wouldn't work properly.
2018-10-15LaTeX reader: simplified type on doMacros'.John MacFarlane1-11/+8
2018-10-15LaTeX reader: small efficiency improvement.John MacFarlane1-1/+2
2018-10-15LaTeX reader: tokenize before pulling tokens,John MacFarlane1-11/+14
rather than after. This has some performance penalty but is more reliable. Closes #4408.
2018-10-15LaTeX reader: improved parsing of `\def`, `\let`.John MacFarlane1-16/+23
We now correctly parse: ``` \def\bar{hello} \let\fooi\bar \def\fooii{\bar} \fooi +\fooii \def\bar{goodbye} \fooi +\fooii ```
2018-10-15LaTeX reader: Fix small regression in pattern argumnents...John MacFarlane1-1/+2
introduced in last commit.
2018-10-15More refactoring of LaTeX reader code.John MacFarlane1-33/+36
2018-10-15T.P.R.LaTeX.Parsing: moved more functions.John MacFarlane1-57/+64
2018-10-15T.P.R.LaTeX.Parsing: moved some functions up a level.John MacFarlane1-20/+21
2018-10-01Moved isArgTok to Readers.LaTeX.Parsing.John MacFarlane1-1/+6
2018-10-01Moved babelLangToBCP, polyglossiaLangToBCP to new module...John MacFarlane1-0/+173
Text.Pandoc.Readers.LaTeX.Lang (unexported).
2018-09-28Added Text.Pandoc.Readers.LaTeX.Parsing (unexported).John MacFarlane1-0/+663
This collects some of the general-purpose code from the LaTeX reader, with the aim of making the module smaller. (We've been having out-of-memory issues compiling this module on CI.)
2018-08-14LaTeX reader: handle parameter patterns for `\def`.John MacFarlane1-1/+5
For example: `\def\foo#1[#2]{#1 and #2}`. Closes #4768. Also fixes #4771. API change: in Text.Pandoc.Readers.LaTeX.Types, new type ArgSpec added. Second parameter of Macro constructor is now `[ArgSpec]` instead of `Int`.
2018-03-18Use NoImplicitPrelude and explicitly import Prelude.John MacFarlane1-0/+2
This seems to be necessary if we are to use our custom Prelude with ghci. Closes #4464.
2018-01-05Update copyright notices to include 2018Albert Krewinkel1-2/+2
2017-10-27hlint suggestions.John MacFarlane1-1/+0
2017-10-16Improved handling of include files in LaTeX reader.John MacFarlane1-4/+4
Previously `\include` wouldn't work if the included file contained, e.g., a begin without a matching end. We've changed the Tok type so that it stores a full SourcePos, rather than just a line and column. So tokens keeep track of the file they came from. This allows us to use a simpler method for includes, which doesn't require parsing the included document as a whole. Closes #3971.
2017-08-07LaTeX reader: Support `\let`.John MacFarlane1-1/+5
Also, fix regular macros so they're expanded at the point of use, and NOT also the point of definition. `\let` macros, by contrast, are expanded at the point of definition. Added an `ExpansionPoint` field to `Macro` to track this difference.
2017-07-07Rewrote LaTeX reader with proper tokenization.John MacFarlane1-0/+48
This rewrite is primarily motivated by the need to get macros working properly. A side benefit is that the reader is significantly faster (27s -> 19s in one benchmark, and there is a lot of room for further optimization). We now tokenize the input text, then parse the token stream. Macros modify the token stream, so they should now be effective in any context, including math. Thus, we no longer need the clunky macro processing capacities of texmath. A custom state LaTeXState is used instead of ParserState. This, plus the tokenization, will require some rewriting of the exported functions rawLaTeXInline, inlineCommand, rawLaTeXBlock. * Added Text.Pandoc.Readers.LaTeX.Types (new exported module). Exports Macro, Tok, TokType, Line, Column. [API change] * Text.Pandoc.Parsing: adjusted type of `insertIncludedFile` so it can be used with token parser. * Removed old texmath macro stuff from Parsing. Use Macro from Text.Pandoc.Readers.LaTeX.Types instead. * Removed texmath macro material from Markdown reader. * Changed types for Text.Pandoc.Readers.LaTeX's rawLaTeXInline and rawLaTeXBlock. (Both now return a String, and they are polymorphic in state.) * Added orgMacros field to OrgState. [API change] * Removed readerApplyMacros from ReaderOptions. Now we just check the `latex_macros` reader extension. * Allow `\newcommand\foo{blah}` without braces. Fixes #1390. Fixes #2118. Fixes #3236. Fixes #3779. Fixes #934. Fixes #982.