aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
AgeCommit message (Collapse)AuthorFilesLines
2018-01-15Renaming: Json -> JSON in modules and functions.John MacFarlane3-8/+8
2018-01-15Merge pull request #4227 from tarleb/lua-run-json-filterJohn MacFarlane7-99/+296
Run JSON filters from Lua filters
2018-01-15Powerpoint writer: Move Presentation.hs out of PandocMonadJesse Rosenthal2-35/+39
We don't need it for anything but the log messages, and we can just keep track of that in state and pass it along to the `writePowerpoint` function. This will simplify the code.
2018-01-15Powerpoint writer: Ignore anchor links to nowehere.Jesse Rosenthal1-3/+6
We don't convert a '#target' ExternalTarget to an InternalTarget if `target` is not in the AnchorMap. We just remove the link. This prevents broken links in the Powerpoint output.
2018-01-14Powerpoint writer: Fix anchor links.Jesse Rosenthal2-60/+81
They were broken when I refactored (the Output module wanted to use state left over from the construction of the Presentation type). This change introduces a new type `LinkTarget = InternalTarget | ExternalTarget`. Internal target points to a slide number, and these will all be resolved before the Presentation is passed along to the Output module.
2018-01-14RST reader: add aligned environment when needed in math.John MacFarlane1-2/+7
rst2latex.py uses an align* environment for math in `.. math::` blocks, so this math may contain line breaks. If it does, we put the math in an `aligned` environment to simulate rst2latex.py's behavior. Closes #4254.
2018-01-14Markdown reader: Improved inlinesInBalancedBrackets.John MacFarlane2-13/+22
The change both improves performance and fixes a regression whereby normal citations inside inline notes were not parsed correctly. Closes jgm/pandoc-citeproc#315.
2018-01-14LaTeX reader: Advance source position at end of stream.John MacFarlane1-1/+1
2018-01-14Powerpoint writer: Refactor into separate modules.Jesse Rosenthal3-1979/+2151
There are two steps in the conversion: a conversion from pandoc to a Presentation datatype modeling pptx, and a conversion from Presentation to a pptx archive. The two steps were sharing the same state and environment, and the code was getting a bit spaghetti-ish. This separates the conversion into separate modules (T.P.W.Powerpoint.Presentation, which defineds the Presentation datatype and goes Pandoc->Presentation) and (T.P.W.Pandoc.Output, which goes Presentation->Archive). Text.Pandoc.Writers.Powerpoint a thin wrapper around the two modules.
2018-01-14Powerpoint writer: Avoid overlapping blocks in column output.Jesse Rosenthal1-2/+10
Just as a slide can't have an image and text on the same slide because of overlapping, we can't have both in a single column. We run splitBlocks on the text in the column and discard the rest.
2018-01-14Powerpoint writer: Position images correctly in two-column layout.Jesse Rosenthal1-45/+33
You can have two images side-by-side, or text alongside an image. The image will be fit correctly within the column.
2018-01-14Powerpoint writer: Make content shape retrieval environment-awareJesse Rosenthal1-28/+48
We put `getContentShape` and `getContentShapeSize` inside the P monad, so that we can (in the future) make use of knowledge of what slide environment we're in to get the correct shape. This will allow us, for example, to get individual columns for a two-column layout, and place images in them appropriately.
2018-01-13LaTeX reader: pass through macro defs in rawLaTeXBlock...John MacFarlane1-4/+2
even if the `latex_macros` extension is set. This reverts to earlier behavior and is probably safer on the whole, since some macros only modify things in included packages, which pandoc's macro expansion can't modify. Closes #4246.
2018-01-13LaTeX reader: fixed pos calculation in tokenizing escaped space.John MacFarlane1-3/+6
2018-01-13Powerpoint writer: Improve image handling.Jesse Rosenthal1-153/+224
We now determine image and caption placement by getting the dimensions of the content box in a given layout. This allows for images to be correctly sized and positioned in a different template. Note that iamges without captions and headers are no longer full-screened. We can't do this dependably in different layouts, because we don't know where the header is (it could be to the side of the content, for example).
2018-01-13LaTeX reader: allow macro definitions inside macros.John MacFarlane1-6/+9
Previously we went into an infinite loop with ``` \newcommand{\noop}[1]{#1} \noop{\newcommand{\foo}[1]{#1}} \foo{hi} ``` See #4253.
2018-01-13Powerpoint writer: read presentation size from reference file.Jesse Rosenthal1-29/+45
Our presentation size is now dependent on the reference/template file we use. This will make it easier to set different output sizes by supplying different reference files. The alternative (allowing a user to explicitly set output size regardless of the template) will lead to too many thorny issues, as explicitly set sizes at the various level of powerpoint layout would have to be reset.
2018-01-13Powerpoint writer: code cleanupJesse Rosenthal1-7/+0
Last commit accidentally left commented-out code in.
2018-01-13Powerpoint writer: Handle (sub)headers above slidelevel correctly.Jesse Rosenthal1-27/+29
Above the slidelevel, subheaders will be printed in bold and given a bit of extra space before them. Note that at the moment, no distinction is made between levels of headers above the slide header, though that can be changed. (It has to be changed in pandoc, since PowerPoint has no concept of paragraph or character classes.) This allows us to clean up the code as well: the code in `blockToParagraphs` since it will only touch content blocks, and therefore will not deal with headers at or below the slidelevel.
2018-01-13Powerpoint writer: Check for required filesJesse Rosenthal1-71/+30
Since we now import from reference/dist file by glob, we need to make sure that we're getting the files we need to make a non-corrupt Powerpoint. This performs that check. (In the process, this change also cleaned up a lot of commented-out code left from the switch to the new reference-doc method.)
2018-01-12Powerpoint writer: Improve templating using `--reference-doc`Jesse Rosenthal1-69/+145
Templating should work much more reliably now. There is still some problem with image placement when we change sizes. A further commit will address this.
2018-01-13Lua modules: add function pandoc.utils.run_json_filterAlbert Krewinkel2-4/+28
Runs a JSON filter on a Pandoc document.
2018-01-13Move filter functions to separate moduleAlbert Krewinkel5-95/+268
2018-01-12Lua filters: improve error messagesAlbert Krewinkel3-15/+34
Provide more context about the task which caused an error.
2018-01-12Powerpoint writer: Include Notes slide in TOCJesse Rosenthal1-19/+42
2018-01-12Lua filters: make PANDOC_READER_OPTIONS availableAlbert Krewinkel3-10/+61
The options which were used to read the document are made available to Lua filters via the `PANDOC_READER_OPTIONS` global.
2018-01-12Powerpoint writer: allow setting toc-title in metadata.Jesse Rosenthal1-2/+5
Accompanying change in MANUAL.txt
2018-01-12Move `metaValueToInlines` to T.P.W.SharedJesse Rosenthal2-11/+10
This will allow the Powerpoint writer to use it as well.
2018-01-12Powerpoint writer: Set notes slide header with slide-levelJesse Rosenthal1-1/+2
It used to be hardcoded to 2. This will set it to the appropriate slide-level.
2018-01-12Powerpoint writer: Add table of contentsJesse Rosenthal1-2/+33
This is triggered by the `--toc` flag. Note that in a long slide deck this risks overrunning the text box. The user can address this by setting `--toc-depth=1`.
2018-01-12Powerpoint writer: Set notes slide number correctlyJesse Rosenthal1-10/+8
Previously, this hadn't been aware of a metadata slide. We also clarify the logic for setting the startnumber of different slide sections correctly.
2018-01-12Powerpoint writer: Ignore internal links without targets.Jesse Rosenthal1-12/+31
If the user entered an internal link without a corresponding anchor, it would produce a corrupted file. Now we check the anchor map, and make sure the target is in the file. If it isn't, we ignore it.
2018-01-12Powerpoint writer: Clean up adding metadata slideJesse Rosenthal1-6/+8
We want to count the slide numbers correctly if it's in there.
2018-01-12Powerpoint writer: Add anchor linksJesse Rosenthal1-20/+47
For anchor-type links (`[foo](#bar)`) we produce an anchor link. In powerpoint these are links to slides, so we keep track of a map relating anchors to the slides they occur on.
2018-01-12Powerpoint writer: Make the slide number available to the blocks.Jesse Rosenthal1-2/+10
For anchors, block-processing functions need to know what slide number they're in. We make the envCurSlideId available to blocks.
2018-01-12Powerpoint writer: move curSlideId to environment.Jesse Rosenthal1-16/+16
It really isn't a moving state, and that can be misleading.
2018-01-10LaTeX reader: fix inconsistent column widths.John MacFarlane1-2/+2
This fixes a bug whereby column widths for the body were different from widths for the header in some tables. Closes #4238.
2018-01-10RST reader: better handling for headers with an anchor.John MacFarlane1-2/+12
Instead of creating a div containing the header, we put the id directly on the header. This way header promotion will work properly. Closes #4240.
2018-01-09HTML writer: Fixed footnote backlinks with --id-prefix.John MacFarlane1-1/+1
Closes #4235.
2018-01-07Use latest skylighting and omit the 'missingincludes' check.John MacFarlane1-11/+1
If you use a custom syntax definition that refers to a syntax you haven't loaded, pandoc will now complain when it is highlighting the text, rather than at the start. This saves a huge performance hit from the `missingIncludes` check. Closes #4226.
2018-01-07Lua: make pandoc-types version available as PANDOC_API_VERSIONAlbert Krewinkel1-0/+3
The current pandoc-types version is made available to Lua programs in the global PANDOC_API_VERSION. It contains the version as a list of numbers.
2018-01-07Lua: make pandoc version available as PANDOC_VERSIONAlbert Krewinkel1-0/+4
The current pandoc version is made available to Lua programs in the global PANDOC_VERSION. It contains the version as a list of numbers.
2018-01-06Don't use `missingIncludes` unless custom syntax defs have been given.John MacFarlane1-1/+2
This avoids a huge performance sink that comes from evaluating all the elements of the default syntax map. Better just to have run-time errors for missing includes? See #4226.
2018-01-05Update copyright notices to include 2018Albert Krewinkel90-185/+185
2018-01-05data/pandoc.lua: fix attribute names of CitationAlbert Krewinkel1-6/+6
The fields were named like the Haskell fields, not like the documented, shorter version. The names are changed to match the documentation and Citations are given a shared metatable to enable simple extensibility. Fixes: #4222
2018-01-04Use hslua utils where possibleAlbert Krewinkel4-33/+16
Some helper functions and types have been moved to hslua. Change: minor
2018-01-04Powerpoint writer: remove some code duplication.Jesse Rosenthal1-10/+3
2018-01-03Powerpoint writer: Ignore Notes divJesse Rosenthal1-0/+1
For now, ignore notes div for parity with other slide outputs.
2018-01-03Powerpoint writer: Set default slidelevel correctly.Jesse Rosenthal1-1/+2
We had previously defaulted to slideLevel 2. Now we use the correct behavior of defaulting to the highest level header followed by content. We change an expected test result to match this behavior.
2018-01-03Powerpoint writer: Split blocks correctly for linked imagesJesse Rosenthal1-10/+15
We treat links with an image as the first inline as an image with a link picProp -- so we have to split on it the same as if it were an image.