aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulia Diaz <[email protected]>2023-10-26 23:18:33 +0100
committerGitHub <[email protected]>2023-10-26 15:18:33 -0700
commitf2a22e71dffef0e795d73ecffeaa195733dde67e (patch)
tree1edcccc2ead4e811b373dde2840d233f4026dad1
parentb671e0dfe5f578511954addaca84b832826d5915 (diff)
Modify JATS reader to handle BITS too (#9138)
Add provision for title-group, book, book-part-wrapper, book-meta, book-part-meta, book-title, book-title-group, index, toc, legend, title, collection-meta
-rw-r--r--src/Text/Pandoc/Readers/JATS.hs86
-rw-r--r--test/command/8867.md49
-rw-r--r--test/command/bits-book-meta.md104
-rw-r--r--test/command/bits-book-part-wrapper-meta.md95
-rw-r--r--test/command/bits-book-part-wrapper.md149
-rw-r--r--test/command/bits-book.md186
-rw-r--r--test/command/bits-index-elements.md83
-rw-r--r--test/command/bits-legend.md45
-rw-r--r--test/command/bits-named-boook-parts.md68
-rw-r--r--test/command/bits-title-display-as.md175
-rw-r--r--test/command/bits-title-supress.md122
-rw-r--r--test/command/bits-toc-elements.md69
12 files changed, 1217 insertions, 14 deletions
diff --git a/src/Text/Pandoc/Readers/JATS.hs b/src/Text/Pandoc/Readers/JATS.hs
index 6cadef306..781c10953 100644
--- a/src/Text/Pandoc/Readers/JATS.hs
+++ b/src/Text/Pandoc/Readers/JATS.hs
@@ -163,8 +163,10 @@ parseBlock (CRef x) = return $ plain $ str $ T.toUpper x
parseBlock (Elem e) = do
sectionLevel <- gets jatsSectionLevel
let parseBlockWithHeader = wrapWithHeader (sectionLevel+1) (getBlocks e)
-
+
case qName (elName e) of
+ "book" -> parseBook
+ "book-part-wrapper" -> parseBook
"p" -> parseMixed para (elContent e)
"code" -> codeBlockWithLang
"preformat" -> codeBlockWithLang
@@ -201,6 +203,7 @@ parseBlock (Elem e) = do
"article-meta" -> parseMetadata e
"custom-meta" -> parseMetadata e
"processing-meta" -> return mempty
+ "book-meta" -> parseMetadata e
"title" -> return mempty -- processed by header
"label" -> return mempty -- processed by header
"table" -> parseTable
@@ -223,6 +226,19 @@ parseBlock (Elem e) = do
then blockFormula displayMath e
else divWith (attrValue "id" e, ["disp-formula"], [])
<$> getBlocks e
+ "index" -> parseBlockWithHeader
+ "index-div" -> parseBlockWithHeader
+ "index-group" -> parseBlockWithHeader
+ "index-title-group" -> return mempty -- handled by index and index-div
+ "toc" -> parseBlockWithHeader
+ "toc-div" -> parseBlockWithHeader
+ "toc-entry" -> parseBlockWithHeader
+ "toc-group" -> parseBlockWithHeader
+ "toc-title-group" -> return mempty -- handled by toc
+ "legend" -> parseBlockWithHeader
+ "dedication" -> parseBlockWithHeader
+ "foreword" -> parseBlockWithHeader
+ "preface" -> parseBlockWithHeader
"?xml" -> return mempty
_ -> getBlocks e
where parseMixed container conts = do
@@ -368,19 +384,35 @@ parseBlock (Elem e) = do
parseElement = filterChildren isEntry
wrapWithHeader n mBlocks = do
isBook <- gets jatsBook
- let n' = if isBook || n == 0 then n + 1 else n
+ let n' = case (filterChild (named "title") e >>= maybeAttrValue "display-as") of
+ Just t -> read $ T.unpack t
+ Nothing -> if isBook || n == 0 then n + 1 else n
headerText <- case filterChild (named "title") e of
- Just t -> getInlines t
- Nothing -> return mempty
+ Just t -> case maybeAttrValue "supress" t of
+ Just s -> if s == "no"
+ then getInlines t
+ else return mempty
+ Nothing -> getInlines t
+ Nothing -> do
+ let name = qName (elName e)
+ if (name == "dedication" || name == "foreword" || name == "preface")
+ then return $ str $ T.toTitle name
+ else case filterChild (named "index-title-group") e >>= filterChild (named "title") of
+ Just i -> getInlines i
+ Nothing -> case filterChild (named "toc-title-group") e >>= filterChild (named "title") of
+ Just t -> getInlines t
+ Nothing -> return mempty
oldN <- gets jatsSectionLevel
modify $ \st -> st{ jatsSectionLevel = n }
blocks <- mBlocks
let ident = attrValue "id" e
modify $ \st -> st{ jatsSectionLevel = oldN }
- return $ (if
- headerText == mempty
- then mempty
- else headerWith (ident,[],[]) n' headerText) <> blocks
+ return $ (if headerText == mempty
+ then mempty
+ else headerWith (ident,[],[]) n' headerText) <> blocks
+ parseBook = do
+ modify $ \st -> st{ jatsBook = True }
+ getBlocks e
getInlines :: PandocMonad m => Element -> JATS m Inlines
getInlines e' = trimInlines . mconcat <$>
@@ -388,16 +420,17 @@ getInlines e' = trimInlines . mconcat <$>
parseMetadata :: PandocMonad m => Element -> JATS m Blocks
parseMetadata e = do
- getTitle e
- getAuthors e
+ isBook <- gets jatsBook
+ if isBook then getBookTitle e else getArticleTitle e
+ if isBook then getBookAuthors e else getArticleAuthors e
getAffiliations e
getAbstract e
getPubDate e
getPermissions e
return mempty
-getTitle :: PandocMonad m => Element -> JATS m ()
-getTitle e = do
+getArticleTitle :: PandocMonad m => Element -> JATS m ()
+getArticleTitle e = do
tit <- case filterElement (named "article-title") e of
Just s -> getInlines s
Nothing -> return mempty
@@ -408,8 +441,21 @@ getTitle e = do
when (tit /= mempty) $ addMeta "title" tit
when (subtit /= mempty) $ addMeta "subtitle" subtit
-getAuthors :: PandocMonad m => Element -> JATS m ()
-getAuthors e = do
+
+getBookTitle :: PandocMonad m => Element -> JATS m ()
+getBookTitle e = do
+ tit <- case (filterElement (named "book-title-group") e >>= filterElement (named "book-title")) of
+ Just s -> getInlines s
+ Nothing -> return mempty
+ subtit <- case (filterElement (named "book-title-group") e >>= filterElement (named "subtitle")) of
+ Just s -> (text ": " <>) <$>
+ getInlines s
+ Nothing -> return mempty
+ when (tit /= mempty) $ addMeta "title" tit
+ when (subtit /= mempty) $ addMeta "subtitle" subtit
+
+getArticleAuthors :: PandocMonad m => Element -> JATS m ()
+getArticleAuthors e = do
authors <- mapM getContrib $ filterElements
(\x -> named "contrib" x &&
attrValue "contrib-type" x == "author") e
@@ -420,6 +466,18 @@ getAuthors e = do
(a:as, ns) -> reverse as ++ [a <> mconcat ns]
unless (null authors) $ addMeta "author" authors'
+getBookAuthors :: PandocMonad m => Element -> JATS m ()
+getBookAuthors e = do
+ authors <- mapM getContrib $ filterElements (\x -> named "contrib-group" x) e
+ >>= filterElements (\x -> named "contrib" x &&
+ attrValue "contrib-type" x == "author")
+ authorNotes <- mapM getInlines $ filterElements (named "author-notes") e
+ let authors' = case (reverse authors, authorNotes) of
+ ([], _) -> []
+ (_, []) -> authors
+ (a:as, ns) -> reverse as ++ [a <> mconcat ns]
+ unless (null authors) $ addMeta "author" authors'
+
getAffiliations :: PandocMonad m => Element -> JATS m ()
getAffiliations x = do
affs <- mapM getInlines $ filterChildren (named "aff") x
diff --git a/test/command/8867.md b/test/command/8867.md
new file mode 100644
index 000000000..f5a5a901f
--- /dev/null
+++ b/test/command/8867.md
@@ -0,0 +1,49 @@
+```
+% pandoc -f jats -t native -s
+<article-meta>
+ <title-group>
+ <article-title></article-title>
+ </title-group>
+ <permissions>
+ <copyright-statement>© 2023, Ellerman et al</copyright-statement>
+ <copyright-year>2023</copyright-year>
+ <copyright-holder>Ellerman et al</copyright-holder>
+ <license license-type="open-access">
+ <ali:license_ref xmlns:ali="http://www.niso.org/schemas/ali/1.0/">https://creativecommons.org/licenses/by/4.0/</ali:license_ref>
+ <license-p>This document is distributed under a Creative Commons Attribution 4.0 International license.</license-p>
+ </license>
+ </permissions>
+</article-meta>
+^D
+Pandoc
+ Meta
+ { unMeta =
+ fromList
+ [ ( "copyright"
+ , MetaMap
+ (fromList
+ [ ( "holder" , MetaString "Ellerman et al" )
+ , ( "statement"
+ , MetaString "\169 2023, Ellerman et al"
+ )
+ , ( "year" , MetaString "2023" )
+ ])
+ )
+ , ( "license"
+ , MetaMap
+ (fromList
+ [ ( "link"
+ , MetaString
+ "https://creativecommons.org/licenses/by/4.0/"
+ )
+ , ( "text"
+ , MetaString
+ "This document is distributed under a Creative Commons Attribution 4.0 International license."
+ )
+ , ( "type" , MetaString "open-access" )
+ ])
+ )
+ ]
+ }
+ []
+``` \ No newline at end of file
diff --git a/test/command/bits-book-meta.md b/test/command/bits-book-meta.md
new file mode 100644
index 000000000..53a64c7d7
--- /dev/null
+++ b/test/command/bits-book-meta.md
@@ -0,0 +1,104 @@
+```
+% pandoc -f jats -t native -s
+<book>
+ <book-meta>
+ <book-id book-id-type="publisher">handbook-648</book-id>
+ <book-title-group>
+ <book-title>The NCBI Handbook</book-title>
+ </book-title-group>
+ <contrib-group>
+ <contrib contrib-type="author">
+ <name><surname>McEntyre</surname>
+ <given-names>Jo</given-names></name>
+ <xref ref-type="aff" rid="bid.m.1"/>
+ </contrib>
+ <contrib contrib-type="editor">
+ <name><surname>Ostell</surname>
+ <given-names>Jim</given-names></name>
+ <xref ref-type="aff" rid="bid.m.1"/>
+ </contrib>
+ </contrib-group>
+ <aff id="bid.m.1">
+ <institution>National Center for Biotechnology Information (NCBI), National Library of Medicine, National Institutes of Health</institution>, <addr-line>Bethesda, MD 20892-6510</addr-line>
+ </aff>
+ <pub-date iso-8601-date="2002-11">
+ <month>11</month>
+ <year>2002</year>
+ </pub-date>
+ <publisher>
+ <publisher-name>National Center for Biotechnology Information (NCBI), National Library of Medicine, National Institutes of Health</publisher-name>
+ <publisher-loc>Bethesda, MD</publisher-loc>
+ </publisher>
+ <edition>1</edition>
+ <counts>
+ <book-fig-count count="98"/>
+ <book-table-count count="40"/>
+ <book-equation-count count="0"/>
+ <book-ref-count count="115"/>
+ <book-page-count count="532"/>
+ <book-word-count count="149852"/>
+ </counts>
+ </book-meta>
+</book>
+^D
+Pandoc
+ Meta
+ { unMeta =
+ fromList
+ [ ( "author"
+ , MetaList
+ [ MetaInlines [ Str "Jo" , Space , Str "McEntyre" ] ]
+ )
+ , ( "date" , MetaInlines [ Str "2002-11" ] )
+ , ( "institute"
+ , MetaList
+ [ MetaInlines
+ [ Str "National"
+ , Space
+ , Str "Center"
+ , Space
+ , Str "for"
+ , Space
+ , Str "Biotechnology"
+ , Space
+ , Str "Information"
+ , Space
+ , Str "(NCBI),"
+ , Space
+ , Str "National"
+ , Space
+ , Str "Library"
+ , Space
+ , Str "of"
+ , Space
+ , Str "Medicine,"
+ , Space
+ , Str "National"
+ , Space
+ , Str "Institutes"
+ , Space
+ , Str "of"
+ , Space
+ , Str "Health,"
+ , Space
+ , Str "Bethesda,"
+ , Space
+ , Str "MD"
+ , Space
+ , Str "20892-6510"
+ ]
+ ]
+ )
+ , ( "title"
+ , MetaInlines
+ [ Str "The"
+ , Space
+ , Str "NCBI"
+ , Space
+ , Str "Handbook"
+ ]
+ )
+ ]
+ }
+ []
+``` \ No newline at end of file
diff --git a/test/command/bits-book-part-wrapper-meta.md b/test/command/bits-book-part-wrapper-meta.md
new file mode 100644
index 000000000..33f932068
--- /dev/null
+++ b/test/command/bits-book-part-wrapper-meta.md
@@ -0,0 +1,95 @@
+```
+% pandoc -f jats -t native -s
+<book-part-wrapper
+ dtd-version="2.1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:mml="http://www.w3.org/1998/Math/MathML"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+
+ <collection-meta>
+ <title-group>
+ <title>Balisage Series on Markup Technologies</title>
+ </title-group>
+
+ <abstract>
+ <p>The <italic>Balisage Series on Markup Technologies</italic>
+ is an occasional series...</p>
+ </abstract>
+ </collection-meta>
+
+ <book-meta>
+ <book-title-group>
+ <book-title>Proceedings of Balisage: The Markup Conference
+ 2013</book-title>
+ </book-title-group>
+
+ <abstract>
+ <p>Balisage is a peer-reviewed conference...</p></abstract>
+
+ </book-meta>
+</book-part-wrapper>
+^D
+Pandoc
+ Meta
+ { unMeta =
+ fromList
+ [ ( "abstract"
+ , MetaBlocks
+ [ Para
+ [ Str "Balisage"
+ , Space
+ , Str "is"
+ , Space
+ , Str "a"
+ , Space
+ , Str "peer-reviewed"
+ , Space
+ , Str "conference..."
+ ]
+ ]
+ )
+ , ( "title"
+ , MetaInlines
+ [ Str "Proceedings"
+ , Space
+ , Str "of"
+ , Space
+ , Str "Balisage:"
+ , Space
+ , Str "The"
+ , Space
+ , Str "Markup"
+ , Space
+ , Str "Conference"
+ , SoftBreak
+ , Str "2013"
+ ]
+ )
+ ]
+ }
+ [ Para
+ [ Str "The"
+ , Space
+ , Emph
+ [ Str "Balisage"
+ , Space
+ , Str "Series"
+ , Space
+ , Str "on"
+ , Space
+ , Str "Markup"
+ , Space
+ , Str "Technologies"
+ ]
+ , SoftBreak
+ , Str "is"
+ , Space
+ , Str "an"
+ , Space
+ , Str "occasional"
+ , Space
+ , Str "series..."
+ ]
+ ]
+``` \ No newline at end of file
diff --git a/test/command/bits-book-part-wrapper.md b/test/command/bits-book-part-wrapper.md
new file mode 100644
index 000000000..206ad951c
--- /dev/null
+++ b/test/command/bits-book-part-wrapper.md
@@ -0,0 +1,149 @@
+```
+% pandoc -f jats -t native
+<book-part-wrapper
+ dtd-version="2.1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:mml="http://www.w3.org/1998/Math/MathML"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+
+ <collection-meta>
+ <title-group>
+ <title>Balisage Series on Markup Technologies</title>
+ </title-group>
+
+ <abstract>
+ <p>The <italic>Balisage Series on Markup Technologies</italic>
+ is an occasional series...</p>
+ </abstract>
+ </collection-meta>
+
+ <book-meta>
+ <book-title-group>
+ <book-title>Proceedings of Balisage: The Markup Conference
+ 2013</book-title>
+ </book-title-group>
+
+ <abstract>
+ <p>Balisage is a peer-reviewed conference...</p></abstract>
+
+ </book-meta>
+
+ <book-part id="bid.1" book-part-type="part">
+ <book-part-meta>
+ <title-group>
+ <label>Part 1</label>
+ <title>The Databases</title>
+ </title-group>
+ </book-part-meta>
+ <body>
+ <sec id="bid.3">
+ <title>History</title>
+ <p>Initially, GenBank was built and maintained at Los Alamos
+ National Laboratory.</p>
+ </sec>
+ </body>
+ <back>
+ <title>Back matter of book part</title>
+ <ref-list>
+ <title>References</title>
+ <ref id="bid.41">
+ <label>1</label>
+ <element-citation>
+ <person-group>
+ <string-name>
+ <surname>Olson</surname>
+ <given-names>M</given-names>
+ </string-name>
+ <string-name>
+ <surname>Hood</surname>
+ <given-names>L</given-names>
+ </string-name>
+ <string-name>
+ <surname>Cantor</surname>
+ <given-names>C</given-names>
+ </string-name>
+ <string-name>
+ <surname>Botstein</surname>
+ <given-names>D</given-names>
+ </string-name>
+ </person-group>
+ <article-title>A common language for physical mapping of the human genome</article-title>
+ <source>Science</source>
+ <year iso-8601-date="1989">1989</year>
+ <volume>245</volume>
+ <issue>4925</issue>
+ <fpage>1434</fpage>
+ <lpage>1435</lpage>
+ <pub-id pub-id-type="pmid">2781285</pub-id>
+ </element-citation>
+ </ref>
+ </ref-list>
+ </back>
+ </book-part>
+</book-part-wrapper>
+^D
+[ Para
+ [ Str "The"
+ , Space
+ , Emph
+ [ Str "Balisage"
+ , Space
+ , Str "Series"
+ , Space
+ , Str "on"
+ , Space
+ , Str "Markup"
+ , Space
+ , Str "Technologies"
+ ]
+ , SoftBreak
+ , Str "is"
+ , Space
+ , Str "an"
+ , Space
+ , Str "occasional"
+ , Space
+ , Str "series..."
+ ]
+, Header 2 ( "bid.3" , [] , [] ) [ Str "History" ]
+, Para
+ [ Str "Initially,"
+ , Space
+ , Str "GenBank"
+ , Space
+ , Str "was"
+ , Space
+ , Str "built"
+ , Space
+ , Str "and"
+ , Space
+ , Str "maintained"
+ , Space
+ , Str "at"
+ , Space
+ , Str "Los"
+ , Space
+ , Str "Alamos"
+ , SoftBreak
+ , Str "National"
+ , Space
+ , Str "Laboratory."
+ ]
+, Header
+ 2
+ ( "" , [] , [] )
+ [ Str "Back"
+ , Space
+ , Str "matter"
+ , Space
+ , Str "of"
+ , Space
+ , Str "book"
+ , Space
+ , Str "part"
+ ]
+, Header 1 ( "" , [] , [] ) [ Str "References" ]
+, Div ( "refs" , [] , [] ) []
+]
+``` \ No newline at end of file
diff --git a/test/command/bits-book.md b/test/command/bits-book.md
new file mode 100644
index 000000000..6515d35ee
--- /dev/null
+++ b/test/command/bits-book.md
@@ -0,0 +1,186 @@
+```
+% pandoc -f jats -t native
+<book dtd-version="2.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mml="http://www.w3.org/1998/Math/MathML">
+ <front-matter>
+ <front-matter-part>
+ <book-part-meta>
+ <title-group>
+ <title>About this book</title>
+ </title-group>
+ </book-part-meta>
+ <named-book-part-body>
+ <sec sec-type="miscinfo">
+ <title>The NCBI Handbook</title>
+ <p>Bioinformatics consists of a computational approach
+ to biomedical information management and analysis.</p>
+ </sec>
+ </named-book-part-body>
+ </front-matter-part>
+ </front-matter>
+ <book-body>
+ <book-part id="bid.1" book-part-type="part">
+ <book-part-meta>
+ <title-group>
+ <label>Part 1</label>
+ <title>The Databases</title>
+ </title-group>
+ </book-part-meta>
+ <body>
+ <sec id="bid.3">
+ <title>History</title>
+ <p>Initially, GenBank was built and maintained at Los Alamos
+ National Laboratory.</p>
+ </sec>
+ </body>
+ <back>
+ <title>Back matter of book part</title>
+ <ref-list>
+ <title>References</title>
+ <ref id="bid.41">
+ <label>1</label>
+ <element-citation>
+ <person-group>
+ <string-name>
+ <surname>Olson</surname>
+ <given-names>M</given-names>
+ </string-name>
+ <string-name>
+ <surname>Hood</surname>
+ <given-names>L</given-names>
+ </string-name>
+ <string-name>
+ <surname>Cantor</surname>
+ <given-names>C</given-names>
+ </string-name>
+ <string-name>
+ <surname>Botstein</surname>
+ <given-names>D</given-names>
+ </string-name>
+ </person-group>
+ <article-title>A common language for physical mapping of the human genome</article-title>
+ <source>Science</source>
+ <year iso-8601-date="1989">1989</year>
+ <volume>245</volume>
+ <issue>4925</issue>
+ <fpage>1434</fpage>
+ <lpage>1435</lpage>
+ <pub-id pub-id-type="pmid">2781285</pub-id>
+ </element-citation>
+ </ref>
+ </ref-list>
+ </back>
+ </book-part>
+ </book-body>
+ <book-back>
+ <ack id="bid.394">
+ <title>Acknowledgments</title>
+ <p>We gratefully acknowledge the work of Vladimir Soussov,
+ as well as the entire NCBI Entrez team...</p>
+ </ack>
+ </book-back>
+</book>
+^D
+[ Header
+ 2
+ ( "" , [] , [] )
+ [ Str "The" , Space , Str "NCBI" , Space , Str "Handbook" ]
+, Para
+ [ Str "Bioinformatics"
+ , Space
+ , Str "consists"
+ , Space
+ , Str "of"
+ , Space
+ , Str "a"
+ , Space
+ , Str "computational"
+ , Space
+ , Str "approach"
+ , SoftBreak
+ , Str "to"
+ , Space
+ , Str "biomedical"
+ , Space
+ , Str "information"
+ , Space
+ , Str "management"
+ , Space
+ , Str "and"
+ , Space
+ , Str "analysis."
+ ]
+, Header 2 ( "bid.3" , [] , [] ) [ Str "History" ]
+, Para
+ [ Str "Initially,"
+ , Space
+ , Str "GenBank"
+ , Space
+ , Str "was"
+ , Space
+ , Str "built"
+ , Space
+ , Str "and"
+ , Space
+ , Str "maintained"
+ , Space
+ , Str "at"
+ , Space
+ , Str "Los"
+ , Space
+ , Str "Alamos"
+ , SoftBreak
+ , Str "National"
+ , Space
+ , Str "Laboratory."
+ ]
+, Header
+ 2
+ ( "" , [] , [] )
+ [ Str "Back"
+ , Space
+ , Str "matter"
+ , Space
+ , Str "of"
+ , Space
+ , Str "book"
+ , Space
+ , Str "part"
+ ]
+, Header 1 ( "" , [] , [] ) [ Str "References" ]
+, Div ( "refs" , [] , [] ) []
+, Header 2 ( "bid.394" , [] , [] ) [ Str "Acknowledgments" ]
+, Para
+ [ Str "We"
+ , Space
+ , Str "gratefully"
+ , Space
+ , Str "acknowledge"
+ , Space
+ , Str "the"
+ , Space
+ , Str "work"
+ , Space
+ , Str "of"
+ , Space
+ , Str "Vladimir"
+ , Space
+ , Str "Soussov,"
+ , SoftBreak
+ , Str "as"
+ , Space
+ , Str "well"
+ , Space
+ , Str "as"
+ , Space
+ , Str "the"
+ , Space
+ , Str "entire"
+ , Space
+ , Str "NCBI"
+ , Space
+ , Str "Entrez"
+ , Space
+ , Str "team..."
+ ]
+]
+``` \ No newline at end of file
diff --git a/test/command/bits-index-elements.md b/test/command/bits-index-elements.md
new file mode 100644
index 000000000..6ba03cc38
--- /dev/null
+++ b/test/command/bits-index-elements.md
@@ -0,0 +1,83 @@
+```
+% pandoc -f jats -t native
+<index-group>
+ <index-title-group>
+ <title>Index group</title>
+ </index-title-group>
+ <p>Content of index group</p>
+ <index>
+ <index-title-group>
+ <title>Index</title>
+ </index-title-group>
+ <p>Content of index</p>
+ <index-div>
+ <index-title-group>
+ <title>N</title>
+ </index-title-group>
+ <p>Content of index div</p>
+ <index-entry>
+ <term>Navy</term>
+ <x>.</x>
+ <see-entry>Armed forces</see-entry>
+ <x>.</x>
+ </index-entry>
+ <index-entry>
+ <term>Necessary and proper clause, congressional power</term>
+ </index-entry>
+ <index-entry>
+ <term>Newsgathering as commerce</term>
+ </index-entry>
+ </index-div>
+ </index>
+</index-group>
+^D
+[ Header
+ 1 ( "" , [] , [] ) [ Str "Index" , Space , Str "group" ]
+, Para
+ [ Str "Content"
+ , Space
+ , Str "of"
+ , Space
+ , Str "index"
+ , Space
+ , Str "group"
+ ]
+, Header 2 ( "" , [] , [] ) [ Str "Index" ]
+, Para
+ [ Str "Content" , Space , Str "of" , Space , Str "index" ]
+, Header 3 ( "" , [] , [] ) [ Str "N" ]
+, Para
+ [ Str "Content"
+ , Space
+ , Str "of"
+ , Space
+ , Str "index"
+ , Space
+ , Str "div"
+ ]
+, Plain [ Str "Navy" ]
+, Plain [ Str "." ]
+, Plain [ Str "Armed" , Space , Str "forces" ]
+, Plain [ Str "." ]
+, Plain
+ [ Str "Necessary"
+ , Space
+ , Str "and"
+ , Space
+ , Str "proper"
+ , Space
+ , Str "clause,"
+ , Space
+ , Str "congressional"
+ , Space
+ , Str "power"
+ ]
+, Plain
+ [ Str "Newsgathering"
+ , Space
+ , Str "as"
+ , Space
+ , Str "commerce"
+ ]
+]
+``` \ No newline at end of file
diff --git a/test/command/bits-legend.md b/test/command/bits-legend.md
new file mode 100644
index 000000000..0217e68fe
--- /dev/null
+++ b/test/command/bits-legend.md
@@ -0,0 +1,45 @@
+```
+% pandoc -f jats -t native
+<fig id="fig_A.1" orientation="portrait">
+ <label>Figure A.1</label>
+ <caption>
+ <title>Field of Application</title>
+ </caption>
+ <legend>
+ <title>Key</title>
+ <def-list>
+ <def-item>
+ <term>I</term>
+ <def><p>input</p></def>
+ </def-item>
+ <def-item>
+ <term>O</term>
+ <def><p>output</p></def>
+ </def-item>
+ ...
+ </def-list>
+ </legend>
+ <graphic xlink:href="1234"/>
+</fig>
+^D
+[ Figure
+ ( "fig_A.1" , [] , [] )
+ (Caption
+ Nothing
+ [ Plain
+ [ Str "Field"
+ , Space
+ , Str "of"
+ , Space
+ , Str "Application"
+ ]
+ ])
+ [ Header 1 ( "" , [] , [] ) [ Str "Key" ]
+ , DefinitionList
+ [ ( [ Str "I" ] , [ [ Para [ Str "input" ] ] ] )
+ , ( [ Str "O" ] , [ [ Para [ Str "output" ] ] ] )
+ ]
+ , Para [ Image ( "" , [] , [] ) [] ( "1234" , "" ) ]
+ ]
+]
+``` \ No newline at end of file
diff --git a/test/command/bits-named-boook-parts.md b/test/command/bits-named-boook-parts.md
new file mode 100644
index 000000000..8a879423e
--- /dev/null
+++ b/test/command/bits-named-boook-parts.md
@@ -0,0 +1,68 @@
+```
+% pandoc -f jats -t native
+<dedication>
+ <named-book-part-body>
+ <p>This is the dedication text.</p>
+ </named-book-part-body>
+</dedication>
+^D
+[ Header 1 ( "" , [] , [] ) [ Str "Dedication" ]
+, Para
+ [ Str "This"
+ , Space
+ , Str "is"
+ , Space
+ , Str "the"
+ , Space
+ , Str "dedication"
+ , Space
+ , Str "text."
+ ]
+]
+```
+
+```
+% pandoc -f jats -t native
+<foreword>
+ <named-book-part-body>
+ <p>This is the foreword text.</p>
+ </named-book-part-body>
+</foreword>
+^D
+[ Header 1 ( "" , [] , [] ) [ Str "Foreword" ]
+, Para
+ [ Str "This"
+ , Space
+ , Str "is"
+ , Space
+ , Str "the"
+ , Space
+ , Str "foreword"
+ , Space
+ , Str "text."
+ ]
+]
+```
+
+```
+% pandoc -f jats -t native
+<preface>
+ <named-book-part-body>
+ <p>This is the preface text.</p>
+ </named-book-part-body>
+</preface>
+^D
+[ Header 1 ( "" , [] , [] ) [ Str "Preface" ]
+, Para
+ [ Str "This"
+ , Space
+ , Str "is"
+ , Space
+ , Str "the"
+ , Space
+ , Str "preface"
+ , Space
+ , Str "text."
+ ]
+]
+``` \ No newline at end of file
diff --git a/test/command/bits-title-display-as.md b/test/command/bits-title-display-as.md
new file mode 100644
index 000000000..88bec9bc0
--- /dev/null
+++ b/test/command/bits-title-display-as.md
@@ -0,0 +1,175 @@
+```
+% pandoc -f jats -t native
+<sec>
+ <title>THE EUROPEAN UNION EXPLAINED</title>
+</sec>
+^D
+[ Header
+ 1
+ ( "" , [] , [] )
+ [ Str "THE"
+ , Space
+ , Str "EUROPEAN"
+ , Space
+ , Str "UNION"
+ , Space
+ , Str "EXPLAINED"
+ ]
+]
+```
+
+```
+% pandoc -f jats -t native
+<sec>
+ <title display-as="3">THE EUROPEAN UNION EXPLAINED</title>
+</sec>
+^D
+[ Header
+ 3
+ ( "" , [] , [] )
+ [ Str "THE"
+ , Space
+ , Str "EUROPEAN"
+ , Space
+ , Str "UNION"
+ , Space
+ , Str "EXPLAINED"
+ ]
+]
+```
+
+```
+% pandoc -f jats -t native
+<body>
+ <sec>
+ <title>The European Parliament</title>
+ <p>Members of the European Parliament (MEPs) are directly elected by EU citizens.</p>
+ <sec>
+ <title display-as="3">Composition of the European Parliament</title>
+ <p>The seats in the European Parliament are allocated among the Member States.</p>
+ </sec>
+ <sec>
+ <title>Composition of the European Parliament - II </title>
+ <p>Most MEPs are associated with a national political party in their home country.</p>
+ </sec>
+ </sec>
+</body>
+^D
+[ Header
+ 1
+ ( "" , [] , [] )
+ [ Str "The"
+ , Space
+ , Str "European"
+ , Space
+ , Str "Parliament"
+ ]
+, Para
+ [ Str "Members"
+ , Space
+ , Str "of"
+ , Space
+ , Str "the"
+ , Space
+ , Str "European"
+ , Space
+ , Str "Parliament"
+ , Space
+ , Str "(MEPs)"
+ , Space
+ , Str "are"
+ , Space
+ , Str "directly"
+ , Space
+ , Str "elected"
+ , Space
+ , Str "by"
+ , Space
+ , Str "EU"
+ , Space
+ , Str "citizens."
+ ]
+, Header
+ 3
+ ( "" , [] , [] )
+ [ Str "Composition"
+ , Space
+ , Str "of"
+ , Space
+ , Str "the"
+ , Space
+ , Str "European"
+ , Space
+ , Str "Parliament"
+ ]
+, Para
+ [ Str "The"
+ , Space
+ , Str "seats"
+ , Space
+ , Str "in"
+ , Space
+ , Str "the"
+ , Space
+ , Str "European"
+ , Space
+ , Str "Parliament"
+ , Space
+ , Str "are"
+ , Space
+ , Str "allocated"
+ , Space
+ , Str "among"
+ , Space
+ , Str "the"
+ , Space
+ , Str "Member"
+ , Space
+ , Str "States."
+ ]
+, Header
+ 2
+ ( "" , [] , [] )
+ [ Str "Composition"
+ , Space
+ , Str "of"
+ , Space
+ , Str "the"
+ , Space
+ , Str "European"
+ , Space
+ , Str "Parliament"
+ , Space
+ , Str "-"
+ , Space
+ , Str "II"
+ ]
+, Para
+ [ Str "Most"
+ , Space
+ , Str "MEPs"
+ , Space
+ , Str "are"
+ , Space
+ , Str "associated"
+ , Space
+ , Str "with"
+ , Space
+ , Str "a"
+ , Space
+ , Str "national"
+ , Space
+ , Str "political"
+ , Space
+ , Str "party"
+ , Space
+ , Str "in"
+ , Space
+ , Str "their"
+ , Space
+ , Str "home"
+ , Space
+ , Str "country."
+ ]
+]
+``` \ No newline at end of file
diff --git a/test/command/bits-title-supress.md b/test/command/bits-title-supress.md
new file mode 100644
index 000000000..e30841e10
--- /dev/null
+++ b/test/command/bits-title-supress.md
@@ -0,0 +1,122 @@
+```
+% pandoc -f jats -t native
+<sec>
+ <title>The European Parliament</title>
+ <p>Members of the European Parliament (MEPs) are directly elected by EU citizens.</p>
+</sec>
+^D
+[ Header
+ 1
+ ( "" , [] , [] )
+ [ Str "The"
+ , Space
+ , Str "European"
+ , Space
+ , Str "Parliament"
+ ]
+, Para
+ [ Str "Members"
+ , Space
+ , Str "of"
+ , Space
+ , Str "the"
+ , Space
+ , Str "European"
+ , Space
+ , Str "Parliament"
+ , Space
+ , Str "(MEPs)"
+ , Space
+ , Str "are"
+ , Space
+ , Str "directly"
+ , Space
+ , Str "elected"
+ , Space
+ , Str "by"
+ , Space
+ , Str "EU"
+ , Space
+ , Str "citizens."
+ ]
+]
+```
+
+```
+% pandoc -f jats -t native
+<sec>
+ <title supress="no">The European Parliament</title>
+ <p>Members of the European Parliament (MEPs) are directly elected by EU citizens.</p>
+</sec>
+^D
+[ Header
+ 1
+ ( "" , [] , [] )
+ [ Str "The"
+ , Space
+ , Str "European"
+ , Space
+ , Str "Parliament"
+ ]
+, Para
+ [ Str "Members"
+ , Space
+ , Str "of"
+ , Space
+ , Str "the"
+ , Space
+ , Str "European"
+ , Space
+ , Str "Parliament"
+ , Space
+ , Str "(MEPs)"
+ , Space
+ , Str "are"
+ , Space
+ , Str "directly"
+ , Space
+ , Str "elected"
+ , Space
+ , Str "by"
+ , Space
+ , Str "EU"
+ , Space
+ , Str "citizens."
+ ]
+]
+```
+
+```
+% pandoc -f jats -t native
+<sec>
+ <title supress="yes">The European Parliament</title>
+ <p>Members of the European Parliament (MEPs) are directly elected by EU citizens.</p>
+</sec>
+^D
+[ Para
+ [ Str "Members"
+ , Space
+ , Str "of"
+ , Space
+ , Str "the"
+ , Space
+ , Str "European"
+ , Space
+ , Str "Parliament"
+ , Space
+ , Str "(MEPs)"
+ , Space
+ , Str "are"
+ , Space
+ , Str "directly"
+ , Space
+ , Str "elected"
+ , Space
+ , Str "by"
+ , Space
+ , Str "EU"
+ , Space
+ , Str "citizens."
+ ]
+]
+``` \ No newline at end of file
diff --git a/test/command/bits-toc-elements.md b/test/command/bits-toc-elements.md
new file mode 100644
index 000000000..415a255e1
--- /dev/null
+++ b/test/command/bits-toc-elements.md
@@ -0,0 +1,69 @@
+```
+% pandoc -f jats -t native
+<toc-group>
+ <toc-title-group>
+ <title>TOC group</title>
+ </toc-title-group>
+ <p>Content of toc group</p>
+ <toc>
+ <toc-title-group>
+ <title>TOC</title>
+ </toc-title-group>
+ <p>Content of TOC</p>
+ <toc-div content-type="sections">
+ <toc-title-group>
+ <title>Mental Health Services</title>
+ </toc-title-group>
+ <toc-entry>
+ <label>Section 1</label>
+ <title>Introduction</title>
+ <nav-pointer rid="tc3"/>
+ </toc-entry>
+ <toc-entry>
+ <label>Section 2</label>
+ <title>Mental Health of the Population</title>
+ <nav-pointer rid="tc4"/>
+ </toc-entry>
+ </toc-div>
+ </toc>
+</toc-group>
+^D
+[ Header
+ 1 ( "" , [] , [] ) [ Str "TOC" , Space , Str "group" ]
+, Para
+ [ Str "Content"
+ , Space
+ , Str "of"
+ , Space
+ , Str "toc"
+ , Space
+ , Str "group"
+ ]
+, Header 2 ( "" , [] , [] ) [ Str "TOC" ]
+, Para
+ [ Str "Content" , Space , Str "of" , Space , Str "TOC" ]
+, Header
+ 3
+ ( "" , [] , [] )
+ [ Str "Mental"
+ , Space
+ , Str "Health"
+ , Space
+ , Str "Services"
+ ]
+, Header 4 ( "" , [] , [] ) [ Str "Introduction" ]
+, Header
+ 4
+ ( "" , [] , [] )
+ [ Str "Mental"
+ , Space
+ , Str "Health"
+ , Space
+ , Str "of"
+ , Space
+ , Str "the"
+ , Space
+ , Str "Population"
+ ]
+]
+``` \ No newline at end of file