Commit Graph
175 Commits
Author SHA1 Message Date
Albert Krewinkel 6463901fac Document pandoc's handling of metadata in JATS output (#6794) 2020-11-03 11:39:59 -08:00
John MacFarlane ba4dfd4f58 Fix code example in lua-filters.md.
Closes #6795, thanks to Odin Kroeger.
2020-11-01 10:48:47 -08:00
Michael Hoffmann 988d381aad Fix some small typos in the API documentation (#6751)
While reading the docs I found a couple of small typos.
2020-10-15 17:09:29 -07:00
Albert Krewinkel 74be44f91f doc/org.md: fix typos 2020-10-12 17:01:04 +02:00
Albert Krewinkel 4d564ce597 doc/lua-filters.md: fix typos
Use American spelling.
2020-10-12 16:58:23 +02:00
Albert Krewinkel 3bad78ca96 doc/lua-filters.md: describe parameters to pandoc.pipe 2020-10-11 13:05:27 +02:00
Ian Max Andolina d1e1898c52 Add info on how to debug Lua filters (#6732)
Add info on debugging Lua filters.
2020-10-08 11:56:08 +02:00
Albert Krewinkel 68454e0812 doc/lua-filters.md: document Underline type and constructor 2020-10-04 21:55:48 +02:00
Albert Krewinkel 29baaa2acb doc/org.md: add section on tables 2020-09-25 09:44:00 +02:00
Albert Krewinkel 29d4753cd9 doc/org.md: add section on handling of unknown directives 2020-09-21 11:35:28 +02:00
Albert Krewinkel acbea6b8c6 Lua filters: add SimpleTable for backwards compatibility (#6575)
A new type `SimpleTable` is made available to Lua filters. It is
similar to the `Table` type in pandoc versions before 2.10;
conversion functions from and to the new Table type are provided.

Old filters using tables now require minimal changes and can use,
e.g.,

    if PANDOC_VERSION > {2,10,1} then
      pandoc.Table = pandoc.SimpleTable
    end

and

    function Table (tbl)
      tbl = pandoc.utils.to_simple_table(tbl)
      …
      return pandoc.utils.from_simple_table(tbl)
    end

to work with the current pandoc version.
2020-09-20 15:48:31 -07:00
the-solipsist 214f2f08e4 Make the setting-the-date example conditional
This makes the example a bit more realistic/valuable by checking if the metadata value "date" is already present, before changing the value.
2020-08-26 13:36:06 +02:00
Albert Krewinkel 45ed1b6b1c doc/lua-filters.md: add missing Link.title field 2020-08-07 11:27:34 +02:00
Albert Krewinkel 857eb46793 doc/lua-filters.md: add missing header attribute 2020-07-29 18:32:56 +02:00
Albert Krewinkel 1e1c5e7f4c Lua filter docs: remove link table example
The example is outdated and requires a complete overhaul.
2020-07-28 22:30:56 +02:00
Albert Krewinkel 6448bd30c4 doc/lua-filters.md: document body field 2020-07-25 20:57:09 +02:00
Albert Krewinkel 44c4660a31 Lua filters: make attr argument optional in Table constructor
This changes the Lua API. It is highly unlikely for this change to
affect existing filters, since the documentation for the new Table
constructor (and type) was incomplete and partly wrong before.

The Lua API is now more consistent, as all constructors for elements
with attributes now take attributes as the last parameter.
2020-07-25 20:37:57 +02:00
Albert Krewinkel 9dd4d077c0 doc/lua-filters.md: fix documentation for tables 2020-07-25 19:27:29 +02:00
favonia 2bdb1e64eb Update using-the-pandoc-api.md 2020-07-21 14:31:46 -05:00
tajmone bf7c624c80 Fix Typos in Lua Filters Doc 2020-07-09 18:48:52 +02:00
Albert Krewinkel 90ac70c79c Org reader: unify keyword handling
Handling of export settings and other keywords (like `#+LINK`) has been
combined and unified.
2020-06-29 20:53:25 +02:00
Albert Krewinkel 1480606174 Org reader: support LATEX_HEADER_EXTRA and HTML_HEAD_EXTRA settings
These export settings are treated like their non-extra counterparts,
i.e., the values are added to the `header-includes` metadata list.
2020-06-29 17:04:29 +02:00
Albert Krewinkel d17b257c89 Org reader: allow multiple #+SUBTITLE export settings
The values of all lines are read as inlines and collected in the
`subtitle` metadata field.
2020-06-29 17:03:33 +02:00
Albert Krewinkel a2e0f39df8 doc/org.md: document behavior of smart extension
See discussion in #4788.

Closes: #4387
2020-06-28 21:36:38 +02:00
Albert Krewinkel d2d5eb8a99 Org reader: read #+INSTITUTE values as text with markup
The value is stored in the `institute` metadata field and used in the
default beamer presentation template.
2020-06-28 19:25:57 +02:00
Albert Krewinkel cd3941d34e doc/org.md: describe all supported export options in detail 2020-06-27 10:10:16 +02:00
Albert Krewinkel 37ef57be51 lua-filters.md: use pandoc.system module in TikZ example
Showcase temporary directory handling with `with_temporary_directory`
and `with_working_directory`.
2020-05-25 09:10:26 +02:00
Levi Gruspe e04ac2a093 Fix description of BulletList Lua type
Change description of BulletList parameter from 'List of Blocks' to 'List of List of Blocks'.
2020-04-01 13:16:41 +02:00
John MacFarlane e23554cec1 Update filter code in doc/filters.md...
so it works with latest pandoc. Closes #6185.
2020-03-15 09:59:44 -07:00
Albert Krewinkel 6c8ed00e7b doc/lua-filters.md: fix copy-paste mistake
Closes: #6040
2020-01-18 22:02:52 +01:00
Albert Krewinkel 672a4bdd1d Lua filters: allow filtering of element lists (#6040)
Lists of Inline and Block elements can now be filtered via `Inlines` and
`Blocks` functions, respectively. This is helpful if a filter conversion
depends on the order of elements rather than a single element.

For example, the following filter can be used to remove all spaces
before a citation:

    function isSpaceBeforeCite (spc, cite)
      return spc and spc.t == 'Space'
       and cite and cite.t == 'Cite'
    end

    function Inlines (inlines)
      for i = #inlines-1,1,-1 do
        if isSpaceBeforeCite(inlines[i], inlines[i+1]) then
          inlines:remove(i)
        end
      end
      return inlines
    end

Closes: #6038
2020-01-15 14:26:00 -08:00
John MacFarlane ebf413cdec Update filters doc with better cabal v2 instructions. 2020-01-14 16:31:09 -08:00
John MacFarlane dfac1239d9 Update filter documentation.
Remove example using pandoc API directly (we have other
docs for that and it was outdated).

Closes #6065.
2020-01-14 11:18:24 -08:00
Albert Krewinkel 11e99409ce docs: capitalize Lua where it refers to the programming language name
This follows the advise on the Lua
website (https://www.lua.org/about.html#name):

> […] "Lua" is a name, the name of the Earth's moon and the name of the
> language. Like most names, it should be written in lower case with an
> initial capital, that is, "Lua".
2020-01-12 11:29:05 +01:00
Albert Krewinkel 6fd3d546a2 Lua filter docs: cross-link constructors and types
Thanks to @bpj for the idea.
2020-01-11 23:51:07 +01:00
Albert Krewinkel 4ede11a75f Lua: add methods insert, remove, and sort to pandoc.List
The functions `table.insert`, `table.remove`, and `table.sort` are added
to pandoc.List elements.  They can be used as methods, e.g.

    local numbers = pandoc.List {2, 3, 1}
    numbers:sort()     -- numbers is now {1, 2, 3}
2020-01-11 21:31:20 +01:00
Albert Krewinkel 23d81081d0 doc/lua-filters.md: sort pandoc.List methods alphabetically 2020-01-11 21:29:47 +01:00
Albert Krewinkel d09bcc7f16 doc/lua-filters.md: unify, fix anchors and internal links (#6061)
Links and anchors now follow consistent conventions, like lowercase-only
anchor names.

This breaks some links to specific sections in the document, but will
make it much easier to link documentation in the future.
2020-01-11 11:55:02 -08:00
Albert Krewinkel e98921ae57 pandoc.List.lua: make pandoc.List a callable constructor
It is now possible to construct a new List via `pandoc.List()` instead of
`pandoc.List:new()`.
2020-01-11 19:38:27 +01:00
Albert Krewinkel 467ea4e02c docs/lua-filters.md: clarify filter function execution order (#6059) 2020-01-10 15:19:26 -08:00
Albert Krewinkel 2cf89ade85 doc/lua-filters.md: replace metadata example with image centering (#6004)
Metadata defaults can be given via the command line `--metadata-file`.
Adding raw format snippets is a common use case for Lua filters, so it
seems sensible to provide an example.

Thanks to @efx for proposing this filter.

Closes: pandoc/lua-filters#70
2019-12-22 16:09:30 -08:00
Mauro Bieg abb0e35b94 lua-filters.md remove spurious dot in title (#5996) 2019-12-17 10:01:42 -08:00
Brian Wignall a946424e3c Fix typos (#5919) 2019-11-20 09:44:23 -08:00
Albert Krewinkel 791043772b doc/lua-filters.md: mention which Lua version is shipped with pandoc
See: #5892
2019-11-13 08:48:34 +01:00
John MacFarlane 8a2e87758e Fix metadata replacement example in lua-filters doc.
Closes #5851.

We avoid the failure with a boolean value by simply checking
to make sure we have a table before indexing.
2019-11-02 22:55:58 -07:00
Marcus Stollsteimer 57e2148ca2 Fix capitalization of "Linux" in docs (#5859) 2019-10-28 10:45:36 -07:00
Albert Krewinkel 88409f9afa doc/lua-filters.md: fix mistakes in mediabag module docs
See: #5851
2019-10-27 23:09:20 +01:00
Albert Krewinkel d0261d7387 Lua filters: allow passing of HTML-like tables instead of Attr (#5750)
Attr values can now be given as normal Lua tables; this can be used as a
convenient alternative to define Attr values, instead of constructing
values with `pandoc.Attr`. Identifiers are taken from the *id* field,
classes must be given as space separated words in the *class* field. All
remaining fields are included as misc attributes.

With this change, the following lines now create equal elements:

    pandoc.Span('test', {id = 'test', class = 'a b', check = 1})
    pandoc.Span('test', pandoc.Attr('test', {'a','b'}, {check = 1}))

This also works when using the *attr* setter:

    local span = pandoc.Span 'text'
    span.attr = {id = 'test', class = 'a b', check = 1}

Furthermore, the *attributes* field of AST elements can now be a plain
key-value table even when using the `attributes` accessor:

    local span = pandoc.Span 'test'
    span.attributes = {check = 1}   -- works as expected now

Closes: #5744
2019-09-15 12:11:58 -07:00
John MacFarlane 9f984ff26a Replace Element and makeHierarchical with makeSections.
Text.Pandoc.Shared:

+ Remove `Element` type [API change]
+ Remove `makeHierarchicalize` [API change]
+ Add `makeSections` [API change]
+ Export `deLink` [API change]

Now that we have Divs, we can use them to represent the structure
of sections, and we don't need a special Element type.
`makeSections` reorganizes a block list, adding Divs with
class `section` around sections, and adding numbering
if needed.

This change also fixes some longstanding issues recognizing
section structure when the document contains Divs.
Closes #3057, see also #997.

All writers have been changed to use `makeSections`.
Note that in the process we have reverted the change
c1d058aeb1
made in response to #5168, which I'm not completely
sure was a good idea.

Lua modules have also been adjusted accordingly.
Existing lua filters that use `hierarchicalize` will
need to be rewritten to use `make_sections`.
2019-09-08 22:20:19 -07:00
John MacFarlane b6490de03b lua-filters - avoid duplicate id element-components. 2019-08-08 11:29:36 -07:00