Age | Commit message (Collapse) | Author | Files | Lines |
|
Convert list of Pandoc blocks into (hierarchical) list of Elements.
|
|
The function parses a date and converts it (if possible) to "YYYY-MM-DD"
format.
|
|
The function allows conversion of numbers below 4000 into roman
numerals.
|
|
The new function `pandoc.utils.stringify` converts any AST element to a
string with formatting removed.
|
|
The stack now remains unaltered if `getRawInt` or `getTable` fail. This
is important when those functions are used in an operation that is part
of an Alternative.
Change: minor
|
|
A new module `pandoc.utils` has been created. It holds utility functions
like `sha1`, which was moved from the main `pandoc` module.
|
|
Definitions for the `pandoc.mediabag` modules are moved to a separate
Haskell module.
Change: minor
|
|
The Haskell module defining the Lua `pandoc` module is moved to
Text.Pandoc.Lua.Module.Pandoc.
Change: minor
|
|
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.
|
|
Change: minor
|
|
The same init file (`data/init`) that is used to setup the Lua
interpreter for Lua filters is also used to setup the interpreter of
custom writers.lua.
|
|
The list of package searchers is named `package.loaders` in Lua 5.1 and
LuaJIT, and `package.searchers` in Lua 5.2 and later.
|
|
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.
|
|
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`.
|
|
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.
|
|
The changes were missing due to an error while using git.
|
|
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
|
|
|
|
Refactored some code from Text.Pandoc.Lua.PandocModule
into new internal module Text.Pandoc.Lua.Filter.
Add `walk_inline` and `walk_block` in pandoc lua module.
|
|
|
|
|
|
|
|
|
|
The pipe command is wrapped in a lua function, throwing a lua error if
the command returns with an error. A wrapper is needed as Haskell
functions exposed to lua may not throw lua errors due to limitations of
hslua.
The error handling is written such that a table can be returned as an
error object in the future. This is potentially useful when finer
control is required while catching the error in lua code. Current
limitations of hslua require error objects to be strings.
|
|
This reduces some boilerplate.
|
|
This is hard to do in lua, so it's helpful to provide this.
|
|
|
|
Better to leave control over the extension to the user.
|
|
|
|
Now 'fetch' simply fetches content and mime type.
A new 'hashname' function is provided to get a filename based
on the sha1 hash of the contents and the mime type.
|
|
This is necessary because you may need to insert the filename
into an image or link element.
|
|
to insertResource (`fetch`).
|
|
Removed `writerSourceURL` from `WriterOptions` (API change).
Added `stSourceURL` to `CommonState`.
It is set automatically by `setInputFiles`.
Text.Pandoc.Class now exports `setInputFiles`, `setOutputFile`.
The type of `getInputFiles` has changed; it now returns `[FilePath]`
instead of `Maybe [FilePath]`.
Functions in Class that formerly took the source URL as a parameter
now have one fewer parameter (`fetchItem`, `downloadOrRead`,
`setMediaResource`, `fillMediaBag`).
Removed `WriterOptions` parameter from `makeSelfContained` in
`SelfContained`.
|
|
|
|
Closes: #3918
|
|
hslua no longer provides lua stack instances for Int and Double, the
necessary instances are added to the Custom writer and the lua filtering
system.
|
|
Stack instances for common data types are now provides by hslua. The
instance for Either was useful only for a very specific case; the
function that was using the `ToLuaStack Either` instance was rewritten
to work without it.
Closes: #3805
|
|
Raw table accessing functions never call back into haskell, which allows
the compiler to use more aggressive optimizations. This improves lua
filter performance considerably (⪆5% speedup).
|
|
|
|
* readDataFile, readDefaultDataFile, getReferenceDocx,
getReferenceODT have been removed from Shared and
moved into Class. They are now defined in terms of
PandocMonad primitives, rather than being primitve
methods of the class.
* toLang has been moved from BCP47 to Class.
* NoTranslation and CouldNotLoudTranslations have
been added to LogMessage.
* New module, Text.Pandoc.Translations, exporting
Term, Translations, readTranslations.
* New functions in Class: translateTerm, setTranslations.
Note that nothing is loaded from data files until
translateTerm is used; setTranslation just sets the
language to be used.
* Added two translation data files in data/translations.
* LaTeX reader: Support `\setmainlanguage` or `\setdefaultlanguage`
(polyglossia) and `\figurename`.
|
|
in Text.Pandoc.Lua. Also to pushPandocModule.
This change allows users to override pandoc.lua with a file
in their local data directory, adding custom functions, etc.
@tarleb, if you think this is a bad idea, you can revert this.
But in general our data files are all overridable.
|
|
Now these functions return a pair of a reader/writer and an
Extensions, instead of building the extensions into the
reader/writer. The calling code must explicitly set
readerExtensions or writerExtensions using the Extensions
returned.
The point of the change is to make it possible for the
calling code to determine what extensions are being used.
See #3659.
|
|
Readers: Renamed StringReader -> TextReader.
Updated tests.
API change.
|
|
|
|
This follows the suggestions given by the FSF for GPL licensed software.
<https://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html>
|
|
Attributes was written to behave much like a normal table, in order to
simplify working with it. However, all Attr containing elements were
changed to provide panflute-like accessors to Attr components, rendering
the previous approach unnecessary.
|
|
Attributes are always passed as the last element, making it possible to
omit this argument. Argument order for `Header` was wrong and is fixed.
|
|
A single `read` function parsing pandoc-supported formats is added to
the module. This is simpler and more convenient than the previous method
of exposing all reader functions individually.
|
|
Meta elements that are treated as lua tables (i.e. MetaList,
MetaInlines, MetaBlocks, and MetaMap), are no longer wrapped in an
additional table but simply marked via a metatable. This allows
treating those meta values just like normal tables, while still making
empty elements of those values distinguishable.
|
|
Element attributes are pushed to the stack via the `Attributes`
function. `Attributes` creates an Attr like triple, but the triple also
allows table-like access to key-value pairs.
|