diff options
| author | Albert Krewinkel <[email protected]> | 2025-12-31 10:36:02 +0100 |
|---|---|---|
| committer | Albert Krewinkel <[email protected]> | 2025-12-31 10:43:07 +0100 |
| commit | 7b68846b921a26e7c5688eae9a87b4f4de9b9da5 (patch) | |
| tree | f6cec3d4ded14bf6d9e60947ffaad63c92cf0306 /pandoc-lua-engine | |
| parent | b7bd1210b0a3f724f5e9f64878d4a74deae03b98 (diff) | |
Lua: mark readers and writers with their types.
The `pandoc.readers` and `pandoc.writers` maps now have string values
instead of boolean values. The string signals the type of the
reader/writer, `"text"` for *TextReader*/*TextWriter* and `"bytestring"`
for *ByteStringReader*/*ByteStringWriter*.
Closes: #11367
Diffstat (limited to 'pandoc-lua-engine')
| -rw-r--r-- | pandoc-lua-engine/src/Text/Pandoc/Lua/Module/Pandoc.hs | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/Pandoc.hs b/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/Pandoc.hs index 850f9a925..7c0408d63 100644 --- a/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/Pandoc.hs +++ b/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/Pandoc.hs @@ -57,7 +57,6 @@ import Text.Pandoc.Writers (Writer (..), getWriter, writers) import qualified HsLua as Lua import qualified Data.ByteString.Lazy as BL import qualified Data.ByteString.Lazy.Char8 as BSL -import qualified Data.Set as Set import qualified Data.Text as T import qualified Text.Pandoc.UTF8 as UTF8 @@ -98,9 +97,13 @@ readersField = Field [ "Set of formats that pandoc can parse. All keys in this table can" , "be used as the `format` value in `pandoc.read`." ] - , fieldPushValue = pushSet pushText $ - Set.fromList (map fst (readers @PandocLua)) + , fieldPushValue = pushKeyValuePairs pushText (pushText . readerType) + (readers @PandocLua) } + where + readerType = \case + TextReader {} -> "text" + ByteStringReader {} -> "bytestring" -- | Set of input formats accepted by @write@. writersField :: Field PandocError @@ -111,9 +114,13 @@ writersField = Field [ "Set of formats that pandoc can generate. All keys in this table" , "can be used as the `format` value in `pandoc.write`." ] - , fieldPushValue = pushSet pushText $ - Set.fromList (map fst (writers @PandocLua)) + , fieldPushValue = pushKeyValuePairs pushText (pushText . writerType) + (writers @PandocLua) } + where + writerType = \case + TextWriter {} -> "text" + ByteStringWriter {} -> "bytestring" -- | Inline table field inlineField :: Field PandocError |
