diff options
| author | Albert Krewinkel <[email protected]> | 2024-09-21 15:12:27 +0200 |
|---|---|---|
| committer | Albert Krewinkel <[email protected]> | 2024-09-21 15:20:34 +0200 |
| commit | 8aa796f30ad4e434c948f3961c59f98e8a58270b (patch) | |
| tree | f665231d00146da57b280fc72515e005b9042e1e /pandoc-lua-engine | |
| parent | bff35172e3119c1e023ea7fdf9a7d59cceb2804d (diff) | |
Lua: support character styling via `pandoc.layout`
The `Doc` values produced and handled by the `pandoc.layout` module can
now be styled using `bold`, `italic`, `underlined`, or `strikeout`. The
style is ignored in normal rendering, but becomes visible when rendering
to ANSI output. The `pandoc.layout.render` function now takes a third
parameter that defines the output style, either *plain* or *ansi*.
Diffstat (limited to 'pandoc-lua-engine')
| -rw-r--r-- | pandoc-lua-engine/pandoc-lua-engine.cabal | 2 | ||||
| -rw-r--r-- | pandoc-lua-engine/src/Text/Pandoc/Lua/Module.hs | 12 |
2 files changed, 11 insertions, 3 deletions
diff --git a/pandoc-lua-engine/pandoc-lua-engine.cabal b/pandoc-lua-engine/pandoc-lua-engine.cabal index 34a045bca..93ca4c935 100644 --- a/pandoc-lua-engine/pandoc-lua-engine.cabal +++ b/pandoc-lua-engine/pandoc-lua-engine.cabal @@ -115,7 +115,7 @@ library , doctemplates >= 0.11 && < 0.12 , exceptions >= 0.8 && < 0.11 , hslua >= 2.3 && < 2.4 - , hslua-module-doclayout>= 1.1 && < 1.2 + , hslua-module-doclayout>= 1.2 && < 1.3 , hslua-module-path >= 1.1 && < 1.2 , hslua-module-system >= 1.1 && < 1.2 , hslua-module-text >= 1.1 && < 1.2 diff --git a/pandoc-lua-engine/src/Text/Pandoc/Lua/Module.hs b/pandoc-lua-engine/src/Text/Pandoc/Lua/Module.hs index 8e601e378..5d2e1040a 100644 --- a/pandoc-lua-engine/src/Text/Pandoc/Lua/Module.hs +++ b/pandoc-lua-engine/src/Text/Pandoc/Lua/Module.hs @@ -91,8 +91,10 @@ submodules = , Pandoc.Text.documentedModule , Pandoc.Types.documentedModule , Pandoc.Utils.documentedModule - , Module.Layout.documentedModule { moduleName = "pandoc.layout" } - `allSince` [2,18] + , ((Module.Layout.documentedModule { moduleName = "pandoc.layout" } + `allSince` [2,18]) + `functionsSince` ["bold", "italic", "underlined", "strikeout", "fg", "bg"]) + [3, 4, 1] , Module.Path.documentedModule { moduleName = "pandoc.path" } `allSince` [2,12] , Module.Zip.documentedModule { moduleName = "pandoc.zip" } @@ -102,6 +104,12 @@ submodules = allSince mdl version = mdl { moduleFunctions = map (`since` makeVersion version) $ moduleFunctions mdl } + functionsSince mdl fns version = mdl + { moduleFunctions = map (\fn -> + if (functionName fn) `elem` fns + then fn `since` makeVersion version + else fn) $ moduleFunctions mdl + } -- | Load all global modules and set them to their global variables. setGlobalModules :: PandocLua () |
