mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-28 17:20:47 +08:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user