aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/JATS/Table.hs
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2021-04-05 21:45:52 +0200
committerAlbert Krewinkel <albert@zeitkraut.de>2021-04-05 21:55:54 +0200
commit038261ea529bc4516d7cee501db70020938dbf2b (patch)
tree75d8d53a14b19df2cf3951ae7e669c1f0b9ea520 /src/Text/Pandoc/Writers/JATS/Table.hs
parent65a9d3a8786c23f79de9dcdf56ab7efb789726ff (diff)
downloadpandoc-038261ea529bc4516d7cee501db70020938dbf2b.tar.gz
JATS writer: escape disallows chars in identifiers
XML identifiers must start with an underscore or letter, and can contain only a limited set of punctuation characters. Any IDs not adhering to these rules are rewritten by writing the offending characters as Uxxxx, where `xxxx` is the character's hex code.
Diffstat (limited to 'src/Text/Pandoc/Writers/JATS/Table.hs')
-rw-r--r--src/Text/Pandoc/Writers/JATS/Table.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/JATS/Table.hs b/src/Text/Pandoc/Writers/JATS/Table.hs
index 465480f59..2e34900d2 100644
--- a/src/Text/Pandoc/Writers/JATS/Table.hs
+++ b/src/Text/Pandoc/Writers/JATS/Table.hs
@@ -24,7 +24,7 @@ import Text.Pandoc.Definition
import Text.Pandoc.Options (WriterOptions)
import Text.Pandoc.Shared (tshow)
import Text.Pandoc.Writers.JATS.Types
-import Text.Pandoc.XML (inTags, inTagsIndented, selfClosingTag)
+import Text.Pandoc.XML (escapeNCName, inTags, inTagsIndented, selfClosingTag)
import qualified Data.Text as T
import qualified Text.Pandoc.Writers.AnnotatedTable as Ann
@@ -216,7 +216,7 @@ cellToJats opts celltype (Ann.Cell (colspec :| _) _colNum cell) =
toAttribs :: Attr -> [Text] -> [(Text, Text)]
toAttribs (ident, _classes, kvs) knownAttribs =
- (if T.null ident then id else (("id", ident) :)) $
+ (if T.null ident then id else (("id", escapeNCName ident) :)) $
filter ((`elem` knownAttribs) . fst) kvs
tableCellToJats :: PandocMonad m