Commit graph

421 commits

Author SHA1 Message Date
Albert Krewinkel
1d639456d3
data/pandoc.lua: drop _VERSION
Having a _VERSION became superfluous, as this module is closely tied to
the pandoc version, which is available via PANDOC_VERSION.
2018-01-13 15:38:15 +01:00
Albert Krewinkel
f5e021998e
data/pandoc.lua: fix access to Attr components
Accessing an Attr value (e.g., ` Attr().classes`) was broken; the more
common case of accessing it via an Inline or Block element was
unaffected by this.
2018-01-09 19:44:42 +01:00
Albert Krewinkel
bf944e0aeb
data/pandoc.lua: slightly de-complicate accessor code
Change: minor
2018-01-09 07:44:09 +01:00
Albert Krewinkel
78b142b880
data/pandoc.lua: cleanup code, remove cruft 2018-01-08 23:26:38 +01:00
Albert Krewinkel
b6cec3da3f
data/pandoc.lua: fix docstrings
Change: minor
2018-01-07 22:41:59 +01:00
Albert Krewinkel
f277ac1338
data/pandoc.lua: make Attr an AstElement
Attr is an AST element, which is now reflected in the type hierarchy.
2018-01-07 22:41:59 +01:00
Albert Krewinkel
967a54dea3
data/pandoc.lua: drop 'pandoc-api-version' from Pandoc objects
This attribute was out-of-sync with the actual version as is mostly
irrelevant in the context Lua filters and custom writers.  Use the
global `PANDOC_API_VERSION` instead.
2018-01-07 14:06:34 +01:00
Albert Krewinkel
458e633bc4
data/pandoc.lua: make all types subtypes of AstElement
*Pandoc*, *Meta*, and *Citation* were just plain functions and did not
set a metatable on the returned value, which made it difficult to amend
objects of these types with new behavior. They are now subtypes of
AstElement, meaning that all their objects can gain new features when a
method is added to the behavior object (e.g., `pandoc.Pandoc.behavior`).
2018-01-07 11:22:53 +01:00
Albert Krewinkel
b70079fbfa
data/pandoc.lua: split type and behavior tables
Clearly distinguish between a type and the behavioral properties of an instance
of that type. The behavior of a type (and all its subtypes) can now be amended
by adding methods to that types `behavior` object, without exposing the type
objects internals.

E.g.:

    pandoc.Inline.behavior.frob = function () print'42' end
    local str = pandoc.Str'hello'
    str.frob() -- outputs '42'
2018-01-06 23:25:08 +01:00
Albert Krewinkel
a2e327f0db
data/pandoc.lua: rename Element to AstElement
This avoids confusion with the Element type from Text.Pandoc.Shared.

Change: minor
2018-01-06 23:25:08 +01:00
Albert Krewinkel
5942da4ff7
data/pandoc.lua: remove dead code
A `Element:new` method was a left-over was never called.

Change: minor
2018-01-06 23:25:08 +01:00
Albert Krewinkel
f492f5a6dd
data/pandoc.lua: fix Element inheritance
Extending all elements of a given type (e.g., all inline elements) was
difficult, as the table used to lookup unknown methods would be reset
every time a new element of that type was created, preventing recursive
property lookup. This is was changed in that all methods and attributes
of supertypes are now available to their subtypes.
2018-01-06 23:25:08 +01:00
Albert Krewinkel
0d935bd081
Update copyright notices to include 2018 2018-01-05 20:39:12 +01:00
Albert Krewinkel
4f564b9203
data/pandoc.lua: fix attribute names of Citation
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-05 08:20:59 +01:00
Albert Krewinkel
9be2c7624c
data/pandoc.lua: drop function pandoc.global_filter
The function `global_filter` was used internally to get the implicitly
defined global filter. It was of little value to end-users, but caused
unnecessary code duplication in pandoc. The function has hence been
dropped. Internally, the global filter is now received by interpreting
the global table as lua filter.

This is a Lua API change.
2017-12-29 10:04:55 +01:00
Albert Krewinkel
ec068f2318
data/pandoc.lua: fix documentation for global_filter 2017-12-29 09:02:25 +01:00
John MacFarlane
108e429c88 Fixed some doc comments in data/pandoc.lua. 2017-12-28 21:55:46 -08:00
Albert Krewinkel
3b2282c962
data/sample.lua: use next instead of for loop
Each definition list item contains just a single key and the associated
value.  Using `next` to get the key/value pair is more idiomatic than
iterating over the single-element table.
2017-12-27 20:11:19 +01:00
John MacFarlane
e19526846f Removed extra comment. 2017-12-27 10:52:12 -08:00
John MacFarlane
cb4123841c Revert "data/sample.lua: Fixed problem with definition lists."
This reverts commit 0e3736422e
in favor of @tarleb's fix.
2017-12-27 10:48:34 -08:00
John MacFarlane
27ba06fe8f data/sample.lua: fixed problem with tables.
Closes #4202.
2017-12-27 09:16:29 -08:00
John MacFarlane
0e3736422e data/sample.lua: Fixed problem with definition lists. 2017-12-27 09:16:01 -08:00
John MacFarlane
596257f350 Updated reference.docx.
Instead of just "Hello, world", the document now contains
exemplars of most of the styles that have an effect on pandoc
documents.

This makes it easier to see the effect of style changes.

Closes #4175.
2017-12-26 22:02:49 -08:00
John MacFarlane
718b2c5837 HTML writer: Use br elements in line blocks...
instead of relying on CSS.  Closes #4162.  HTML-based templates have had
the custom CSS for div.line-block removed.  Those maintaining custom
templates will want to remove this too.

We still enclose line blocks in a div with class line-block.
2017-12-26 08:40:33 -08:00
Albert Krewinkel
ef4351c4d2
data/init.lua: load pandoc.utils by default 2017-12-23 13:42:35 +01:00
Albert Krewinkel
bd3ea72371
Lua modules: added pandoc.utils module
A new module `pandoc.utils` has been created. It holds utility functions
like `sha1`, which was moved from the main `pandoc` module.
2017-12-21 22:42:59 +01:00
John MacFarlane
117a672c4d Removed default.theme data file.
It is no longer needed now that we have `--print-highlight-style`.
See #4096.
2017-12-21 11:28:38 -08:00
Albert Krewinkel
5d3573e780
Lua modules: turn pipe, read into full Haskell functions
The `pipe` and `read` utility functions are converted from hybrid
lua/haskell functions into full Haskell functions. This avoids the need
for intermediate `_pipe`/`_read` helper functions, which have dropped.
2017-12-20 22:24:41 +01:00
Albert Krewinkel
46d3c95ecd
pandoc.lua: re-add missing MetaMap function
This was a bug introduced in version 2.0.4 (commit
3f1f9536d4).
2017-12-19 09:12:16 +01:00
John MacFarlane
17b667ec26 Update latex template to work with recent versions of beamer.
The old template produced numbered sections with some recent
versions of beamer.

Thanks to Thomas Hodgson.
2017-12-13 21:17:13 -08:00
Thomas Hodgson
166561cc8d Added support for LaTeX pagestyle variable (#4135)
* Add pagestyle support

* Add pagestyle option to MANUAL.txt

* Moved mention of pagestyle to the section on variables
2017-12-11 22:26:16 -07:00
Jesse Rosenthal
9734a598ea Add default pptx data for Powerpoint writer. 2017-12-11 07:00:17 -05:00
Albert Krewinkel
4066a385ac
Lua filters: use script to initialize the interpreter
The file `init.lua` is used to initialize the Lua interpreter which is
used in Lua filters. This gives users the option to require libraries
which they want to use in all of their filters, and to extend default
modules.
2017-12-06 22:50:56 +01:00
Albert Krewinkel
d5b1c7b767
Lua filters: refactor lua module handling
The integration with Lua's package/module system is improved: A
pandoc-specific package searcher is prepended to the searchers in
`package.searchers`. The modules `pandoc` and `pandoc.mediabag` can now
be loaded via `require`.
2017-12-02 23:07:29 +01:00
John MacFarlane
00f634ba80 reveal.js template: add title-slide identifier to title slide.
This allows it to be styled more easily.

Closes #4120.
2017-12-04 16:26:04 -08:00
John MacFarlane
c94b970ced Include default CSS for 'underline' class in HTML-based templates. 2017-12-03 20:36:08 -08:00
John MacFarlane
ecfb5a0838 revealjs template: added a necessary escape. 2017-12-01 22:02:07 -08:00
John MacFarlane
d9f0b816e2 reveal.js template: include tex2jax configuration.
This ensures that we don't use $..$ delimiters, which
gives bad results when $ is used as a currency sign.
This depends on the current dev version of reveal.js.
2017-12-01 21:41:48 -08:00
Albert Krewinkel
3f1f9536d4
pandoc.lua: set metatable on List MetaValues
The `List` metatable is assigned to the tables which get passed to the
constructors `MetaBlocks`, `MetaInline`, and `MetaList`. This enables
the use of the resulting objects as lists.  This is part of the changes
discussed in #4081.
2017-12-01 18:47:33 +01:00
Albert Krewinkel
6640506ddc
Lua/StackInstances: push Pandoc and Meta via constructor
Pandoc and Meta elements are now pushed by calling the respective
constructor functions of the pandoc Lua module. This makes serialization
consistent with the way blocks and inlines are pushed to lua and allows
to use List methods with the `blocks` value.
2017-12-01 17:58:12 +01:00
Albert Krewinkel
8473a151c5
List.lua: add missing fixes as discussed in #4099
The changes were missing due to an error while using git.
2017-12-01 17:12:56 +01:00
Albert Krewinkel
c65b514ed1
List.lua: add _VERSION to module, drop unused var 2017-11-29 21:13:10 +01:00
Albert Krewinkel
0105a3c293 Add basic lua List module (#4099)
The List module is automatically loaded, but not assigned to a global
variable. It can be included in filters by calling `List = require
'List'`.

Lists of blocks, lists of inlines, and lists of classes are now given
`List` as a metatable, making working with them more convenient. E.g.,
it is now possible to concatenate lists of inlines using Lua's
concatenation operator `..` (requires at least one of the operants to
have `List` as a metatable):

    function Emph (emph)
      local s = {pandoc.Space(), pandoc.Str 'emphasized'}
      return pandoc.Span(emph.content .. s)
    end

Closes: #4081
2017-11-28 17:20:01 -07:00
Albert Krewinkel
849900c516 data/pandoc.lua: enable table-like behavior of attributes (#4080)
Attribute lists are represented as associative lists in Lua. Pure
associative lists are awkward to work with. A metatable is attached to
attribute lists, allowing to access and use the associative list as if
the attributes were stored in as normal key-value pair in table.

Note that this changes the way `pairs` works on attribute lists. Instead
of producing integer keys and two-element tables, the resulting iterator
function now returns the key and value of those pairs.  Use `ipairs` to
get the old behavior.

Warning: the new iteration mechanism only works if pandoc has been
compiled with Lua 5.2 or later (current default: 5.3).

The `pandoc.Attr` function is altered to allow passing attributes as
key-values in a normal table. This is more convenient than having to
construct the associative list which is used internally.

Closes #4071
2017-11-20 09:37:40 -08:00
John MacFarlane
c9407f85a0 LaTeX template: include natbib/biblatex after polyglossia.
Otherwise we seem to get an error; biblatex wants polyglossia
language to be defined.

Closes #4073.
2017-11-14 20:50:13 -08:00
John MacFarlane
cf7d66c097 Fixed URIs in jats.csl.
They were being rendered twice, leading to invalid XML.
2017-11-11 16:23:41 -08:00
John MacFarlane
8d31e00010 Removed etc. from abbreviations file.
Reason:  often etc. ends a sentence, and we want the . to
be treated as a sentence-ending period.
2017-11-09 23:23:51 -05:00
Wandmalfarbe
62244713f5 Added a few abbreviations and sorted the list. (#3984) 2017-11-03 12:48:58 -04:00
John MacFarlane
642d603666 Improved support for columns in HTML.
* Move as much as possible to the CSS in the template.
* Ensure that all the HTML-based templates (including epub)
  contain the CSS for columns.
* Columns default to 50% width unless they are given a width
  attribute.

Closes #4028.
2017-11-02 20:57:05 -07:00
mb21
8d7ce0fdf0 HTML Writer: consistently use dashed class-names
see #3556
2017-10-31 10:40:16 +01:00