Commit graph

7811 commits

Author SHA1 Message Date
Albert Krewinkel
49f1e7608e Lua: add module pandoc.layout to format and layout text 2022-02-06 16:01:24 -08:00
Lucas V. R
ae846381c3 Org reader: allow comments above property drawer
The Org Manual page at https://orgmode.org/manual/Property-Syntax.html
says (as of 2022-02-03):

"Property blocks defined before first headline needs to be located at
the top of the buffer, allowing only comments above."

This commit allows comments above.
2022-02-06 23:08:27 +01:00
Lucas V. R
61f4771c55 Org reader: allow ":" in property drawer keys
Any non-space character is allowed as property drawer key, including ":"
itself (so it is not really a delimiter). The real delimiter is a space
character, so in a drawer like

:PROPERTIES:
::k:ey:: value
:END:

":k:ey:" is a key with value "value".

This usage can be seen in the Org Manual at
https://orgmode.org/manual/Using-Header-Arguments.html,
where the Org snippet

* Heading
  :PROPERTIES:
  :header-args:clojure:    :session *clojure-1*
  :header-args:R:          :session *R*
  :END:

is listed as an example.
2022-02-06 23:08:27 +01:00
Jan Tojnar
876859f9e9
Docbook writer: Interpret links without contents as cross-references (#7360)
Links without text contents are converted to `<xref>` elements. DocBook
processors will generate appropriate cross-reference text when presented
with an xref element.
2022-02-06 23:05:20 +01:00
John MacFarlane
677f2ca26e Allow use of a RIS bibliography with citeproc. 2022-02-05 23:48:55 -08:00
John MacFarlane
6cc253aab6 RIS reader: support ID and DO fields. 2022-02-05 23:34:44 -08:00
John MacFarlane
3da5440858 Add RIS bibliography format reader.
New module, Text.Pandoc.Readers.RIS, exporting readRIS.

New input format `ris`.

Closes #7894.
2022-02-05 23:25:03 -08:00
Albert Krewinkel
c962cef309
Lua: set module name before pushing
Using the correct module name is relevant when auto-generating
documentation.
2022-02-05 13:32:02 +01:00
John MacFarlane
d40d94ebd9 EndNote reader: add nocite as the other bib format readers do. 2022-02-04 23:51:12 -08:00
John MacFarlane
b7f1c97b6a Docx zotero/mendeley/endnote: add comma before locator in suffix. 2022-02-04 23:28:46 -08:00
John MacFarlane
f48890eff0 Support Prefix, Suffix, Pages in endnote ADDINs. 2022-02-04 22:20:51 -08:00
John MacFarlane
19cfe6a907 Got endnote citations working in docx...
Still to do:  prefix, suffix, locator.
2022-02-04 21:54:50 -08:00
John MacFarlane
28349447cb Docx reader: skeleton for endnote citation ADDINs. 2022-02-04 17:02:43 -08:00
John MacFarlane
15316a0058 EndNote: export readEndNoteXMLCitation...
instead of readEndNoteXMLReferences.  This is the function
we'll need in the docx reader.

We still need to implement locator, prefix, and suffix.
2022-02-04 14:02:58 -08:00
John MacFarlane
d164e5bb1d Docx reader: parse EN.CITE and EN.REFLIST fields. 2022-02-04 10:04:16 -08:00
John MacFarlane
34897031f4 Add endnote XML reader.
New input format: endnotexml

New reader module: Text.Pandoc.Readers.EndNote, exporting
`readEndNoteXML` and `readEndNoteXMLReferences`. [API change]

This reader is still a bit rudimentary, but it should get
be good enough to be helpful.
2022-02-04 10:03:52 -08:00
John MacFarlane
e07c0e74ce Support embedded Mendeley citations in docx.
These are supported in the same way as Zotero citations,
using the same code.  As with Zotero, enable the `citations`
extension on `docx` to parse these as native citations.

Closes #7840.
2022-02-04 10:00:23 -08:00
John MacFarlane
d40236805d MediaBag: improve detection of absolute paths.
Previously we used System.FilePath's isRelative to
determine when paths are relative (since absolute
paths need to get a new name based on the sha1 hash).
But this has an OS-specific behavior and actually
returns True on Windows for paths like `/media/file.png`.
This ought to fix #7881.
2022-02-04 09:47:07 -08:00
John MacFarlane
40b174c770 Revert "T.P.Class.IO.adjustImagePath: avoid double slash."
This reverts commit 3dcb526b9b.
2022-02-04 09:29:49 -08:00
John MacFarlane
3dcb526b9b T.P.Class.IO.adjustImagePath: avoid double slash.
PReviously if the directory argument ended in slash,
we'd get a doubled slash in the path.  This may help
with #7881.
2022-02-04 07:54:52 -08:00
John MacFarlane
60caa0a1e1 Docx reader: add bibliographic entries for zotero ADDIN.
Bibliographic data embedded in citation items is added
to the `references` metadata field.

Closes #7840.
2022-02-03 22:08:46 -08:00
John MacFarlane
4086873281 Improve locators for docx Zotero citations. 2022-02-03 20:23:11 -08:00
John MacFarlane
1c2f0fe1d2 Enable citations extension for docx reader.
When enabled, Zotero citations are parsed as native pandoc
citations.  (When disabled, the Zotero-generated citation
text is passed through as regular text.)  In addition, the
Zotero-generated bibliography is suppressed.

Locators still need some work.
2022-02-03 19:34:05 -08:00
John MacFarlane
9ef8650612 Docx reader: Parse CSL JSON in Zotero addin.
This gives us what we ned for #7840, except adding
to the references in metadata.
2022-02-03 16:04:15 -08:00
John MacFarlane
b9ac243986 Trim whitespace from math in --webtex.
This fixes problems with --webtex and markdown output,
when display math starts or ends with a newline.

Closes #7892.
2022-02-03 13:21:27 -08:00
John MacFarlane
9618b66fe8 Whitespace fixes. 2022-02-03 13:13:03 -08:00
John MacFarlane
0011c9520d Docx reader: add more framework for Zotero citations.
- Add docxReferences to state, so we can accumulate
  references for metadata.
- Add a clause for ZoteroItem to parPartToInlines'.
  So far it doesn't do anything except add a surrounding Cite element.

See #7840.
2022-02-03 07:39:07 -08:00
John MacFarlane
54279149ab Use unreleased citeproc. 2022-02-03 07:37:13 -08:00
John MacFarlane
6ed8999f75 LaTeX reader: handle subequations as inline math environment.
Closes #7883.
2022-02-02 10:41:46 -08:00
Albert Krewinkel
2fa8308afa Restore wkhtmltopdf as default pdf engine for HTML 2022-02-01 14:43:38 -08:00
John MacFarlane
4c8c7f6dff Revert "T.P.App.Opt: fix logic bug in fullDefaultsPath."
This reverts commit 545c0911aa.

Fixes regression in 2.17.1.

The original commit was completely misguided, and caused
problems finding defaults files in the default user data
directory.
2022-01-31 09:36:49 -08:00
John MacFarlane
a246107347 LaTeX reader: ensure that \raggedright doesn't gobble an argument.
See #7757.
2022-01-29 22:15:04 -08:00
John MacFarlane
c348c4d4fe Use [x] not [X] for asciidoctor checklists.
See #7798.
2022-01-29 17:47:35 -08:00
Albert Krewinkel
fbb9fbf9bb
Custom writer: preserve order of element attributes
Attribute key-value pairs are marshaled as AttributeList, i.e., as a
userdata type that behaves both like a list and a map. This allows to
preserve the order of key-value pairs.

Closes: #7489
2022-01-29 22:36:22 +01:00
Albert Krewinkel
412596c30b Switch to hslua-2.1
This allows for some code simplification and improves stability.
2022-01-29 08:43:14 -08:00
Albert Krewinkel
a6fa3df114
HTML writer: avoid duplicate "style" attributes on table cells
Fixes: #7871
2022-01-28 18:20:14 +01:00
Even Brenden
d36a16a4df Don't read files outside of user data directory
If a file path does not exist relative to the working directory, but
it does exist relative to the user data directory, and it exists outside
of the user data directory, do not read it. This applies to readDataFile
and readMetadataFile in PandocMonad and, by extension, any module that
uses these by passing them relative paths.
2022-01-28 08:51:27 -08:00
Even Brenden
e1f8c4b396 Handle consecutive ".."s in makeCanonical
As an example, prior to this commit, "../../file" would evaluate to
"file", when it should be unchanged.
2022-01-28 08:51:27 -08:00
John MacFarlane
7fbce82f2f LaTeX writer: allow arbitrary frameoptions to be passed...
to a beamer frame, using the frameoptions attribute.
Updated manual.

See #7869.
2022-01-27 14:07:51 -08:00
John MacFarlane
4fa042f847 LaTeX writer: add s and squeeze to recognized beamer frameoptions.
Closes #7869.
2022-01-27 14:07:51 -08:00
John MacFarlane
183fb3e327 LaTeX reader: improve descItem.
For some reason we were skipping arbitrary blocks before `\item`.
This is now changed to "skip whitespace and comments."
2022-01-25 08:43:12 -08:00
John MacFarlane
a9f901cf6b CommonMark reader: fix source position after YAML metadata.
Closes #7863.
2022-01-23 22:13:58 -08:00
John MacFarlane
67f2b25c05 LaTeX reader: improve handling of newif.
Adding a pair of braces around the second argument of `\def`
prevents LaTeX from an emergency stop with:  Closes #6096.

```
pandoc -f markdown -o test.pdf
\newif\ifepub

\epubtrue

\ifepub

hi

\fi
^D
```
2022-01-22 21:48:14 -08:00
Even Brenden
7df29e495f
Search for metadata files in $DATADIR/metadata (#7851)
If files specified with `--metadata-file` are not found in the working
directory, look in `$DATADIR/metadata`.

Expose new `readMetadataFile` function from Text.Pandoc.Class
[API change].

Expose new `PandocCouldNotFindMetadataFileError` constructor for
`PandocError` from Text.Pandoc.Error [API change].

Closes #5876.
2022-01-21 12:00:45 -08:00
John MacFarlane
672b6dc7e6 Remove retokenizing in rawLaTeXParser.
This was causing serious problems with `newif` commands.
See #6096.  And it didn't seem to make any difference for
the tests; I assume that, unless there's some untested
behavior, this is something that has now become unnecessary.
2022-01-21 10:17:58 -08:00
John MacFarlane
52b78b10c8 Avoid putting a frame around speaker notes in beamer.
If speaker notes (a Div with class 'notes') occur right
after a section heading, but above slide level, the
resulting `\note{..}` caommand should not be wrapped in
a frame, as that will cause a spurious blank slide.

Closes #7857.
2022-01-20 19:09:44 -08:00
John MacFarlane
ef8135b4a7 HTML writer: don't break lines inside code elements.
With the new (default) line wrapping of HTML, in
conjunction with the default CSS which includes
`code { whitespace: pre-wrap; }`, spurious line
breaks could be introduced into inline code.

Closes #7858.
2022-01-20 09:17:34 -08:00
John MacFarlane
d9ec95e7ab Modify stringify so it ignores [Citation] inside Cite.
Otherwise we'll sometimes get two copies of things, one
from the `citationPrefix` or `citationSuffix` and another
from the embedded fallback text.

When there is no fallback text, we'll get no content.
However, it really isn't an alternative to just rely
on the result of running `query` on the embedded `Citation`s;
this will result in a jumble of text rather than anything
structured.

Closes #7855.
2022-01-19 22:06:06 -08:00
John MacFarlane
d5818413ff Docx reader: parse both zotero citation and bibliography...
as FieldInfo.
2022-01-19 10:31:00 -08:00
John MacFarlane
73fe7c129e Docx reader: add skeleton for parsing zotero ADDINs.
So far this just adds a constructor for FieldInfo;
we'll need to adjust the rest of the reader code to
parse the JSON and do something with it.

See #7840.
2022-01-19 10:20:15 -08:00