aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2021-12-31 20:12:23 +0100
committerJohn MacFarlane <[email protected]>2022-01-04 11:55:59 -0800
commit6a5ac90bf18f46beb6df4921f428dfb48ccb1fa8 (patch)
treeb358acdadb46c61cb06d29b88259ef4957a8d0eb /src
parent0d1d52f0a00753691663572da5f87dd4791d65fd (diff)
Lua: add `pandoc.WriterOptions` constructor
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Lua/Marshal/WriterOptions.hs13
-rw-r--r--src/Text/Pandoc/Lua/Module/Pandoc.hs9
2 files changed, 16 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Lua/Marshal/WriterOptions.hs b/src/Text/Pandoc/Lua/Marshal/WriterOptions.hs
index 781ae3f7c..b5b1f715e 100644
--- a/src/Text/Pandoc/Lua/Marshal/WriterOptions.hs
+++ b/src/Text/Pandoc/Lua/Marshal/WriterOptions.hs
@@ -93,7 +93,8 @@ typeWriterOptions = deftype "WriterOptions"
(pushText, writerEpubSubdirectory)
(peekText, \opts x -> opts{ writerEpubSubdirectory = x })
- , property "extensions" "Markdown extensions that can be used"
+ , property "extensions"
+ "Markdown extensions that can be used"
(pushViaJSON, writerExtensions)
(peekViaJSON, \opts x -> opts{ writerExtensions = x })
@@ -147,16 +148,16 @@ typeWriterOptions = deftype "WriterOptions"
(maybe pushnil pushString, writerReferenceDoc)
(optional . peekString, \opts x -> opts{ writerReferenceDoc = x })
- , property "reference_location"
- "Location of footnotes and references for writing markdown"
- (pushViaJSON, writerReferenceLocation)
- (peekViaJSON, \opts x -> opts{ writerReferenceLocation = x })
-
, property "reference_links"
"Use reference links in writing markdown, rst"
(pushBool, writerReferenceLinks)
(peekBool, \opts x -> opts{ writerReferenceLinks = x })
+ , property "reference_location"
+ "Location of footnotes and references for writing markdown"
+ (pushViaJSON, writerReferenceLocation)
+ (peekViaJSON, \opts x -> opts{ writerReferenceLocation = x })
+
, property "section_divs"
"Put sections in div tags in HTML"
(pushBool, writerSectionDivs)
diff --git a/src/Text/Pandoc/Lua/Module/Pandoc.hs b/src/Text/Pandoc/Lua/Module/Pandoc.hs
index e9603f827..c0127cdfe 100644
--- a/src/Text/Pandoc/Lua/Module/Pandoc.hs
+++ b/src/Text/Pandoc/Lua/Module/Pandoc.hs
@@ -34,6 +34,8 @@ import Text.Pandoc.Lua.Marshal.AST
import Text.Pandoc.Lua.Marshal.Filter (peekFilter)
import Text.Pandoc.Lua.Marshal.ReaderOptions ( peekReaderOptions
, pushReaderOptions)
+import Text.Pandoc.Lua.Marshal.WriterOptions ( peekWriterOptions
+ , pushWriterOptions)
import Text.Pandoc.Lua.Module.Utils (sha1)
import Text.Pandoc.Lua.PandocLua (PandocLua (unPandocLua), liftPandocLua)
import Text.Pandoc.Options ( ReaderOptions (readerExtensions)
@@ -129,6 +131,13 @@ otherConstructors =
<#> parameter peekReaderOptions "ReaderOptions|table" "opts" "reader options"
=#> functionResult pushReaderOptions "ReaderOptions" "new object"
#? "Creates a new ReaderOptions value."
+
+ , defun "WriterOptions"
+ ### liftPure id
+ <#> parameter peekWriterOptions "WriterOptions|table" "opts"
+ "writer options"
+ =#> functionResult pushWriterOptions "WriterOptions" "new object"
+ #? "Creates a new WriterOptions value."
]
stringConstants :: [Field e]