git.iko.soy/typeable/pandoc
on master help sign in
Merge branch 'jats'
commit9575dfc97012e52656c7147e66ec093b9479e8e0 authorJohn MacFarlane <jgm@berkeley.edu> dateThu 30 Mar 2017, 01:17 (10 years ago) parent5fe734d831e1c5
9 files changed+2683−6
COPYRIGHT+4 MANUAL.txt+6−6 data/templates/default.jats+193 pandoc.cabal+4 src/Text/Pandoc.hs+3 src/Text/Pandoc/Writers/JATS.hs+429 test/Tests/Old.hs+3 test/tables.jats+616 test/writer.jats+1425
COPYRIGHT+4
@@ -106,3 +106,7 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
106106LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
107107OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
108108WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
109+
110+------------------------------------------------------------------------
111+The template pandoc.jats is Copyright 2013--15 Martin Fenner,
112+released under GPL version 2 or later.
MANUAL.txt+6−6
@@ -291,9 +291,9 @@ General options
291291 (LaTeX), `beamer` (LaTeX beamer slide show), `context` (ConTeXt),
292292 `man` (groff man), `mediawiki` (MediaWiki markup),
293293 `dokuwiki` (DokuWiki markup), `zimwiki` (ZimWiki markup),
294− `textile` (Textile), `org` (Emacs Org mode),
295− `texinfo` (GNU Texinfo), `opml` (OPML), `docbook` or `docbook4`
296− (DocBook 4), `docbook5` (DocBook 5), `opendocument` (OpenDocument),
294+ `textile` (Textile), `org` (Emacs Org mode), `texinfo` (GNU Texinfo),
295+ `opml` (OPML), `docbook` or `docbook4` (DocBook 4), `docbook5`
296+ (DocBook 5), `jats` (JATS XML), `opendocument` (OpenDocument),
297297 `odt` (OpenOffice text document), `docx` (Word docx), `haddock`
298298 (Haddock markup), `rtf` (rich text format), `epub2` (EPUB v2 book),
299299 `epub` or `epub3` (EPUB v3), `fb2` (FictionBook2 e-book),
@@ -616,8 +616,8 @@ General writer options
616616: Include an automatically generated table of contents (or, in
617617 the case of `latex`, `context`, `docx`, `rst`, or `ms`,
618618 an instruction to create one) in the output document. This
619− option has no effect on `man`, `docbook4`, `docbook5`, `slidy`,
620− `slideous`, `s5`, or `odt` output.
619+ option has no effect on `man`, `docbook4`, `docbook5`, `jats`,
620+ `slidy`, `slideous`, `s5`, or `odt` output.
621621
622622`--toc-depth=`*NUMBER*
623623
@@ -1000,7 +1000,7 @@ Math rendering in HTML
10001000
10011001`--mathml`
10021002
1003−: Convert TeX math to [MathML] (in `docbook4`, `docbook5`,
1003+: Convert TeX math to [MathML] (in `docbook4`, `docbook5`, `jats`,
10041004 `html4` and `html5`).
10051005
10061006`--jsmath`[`=`*URL*]
data/templates/default.jatsnew file+193
@@ -0,0 +1,193 @@
1+<?xml version="1.0" encoding="utf-8" ?>
2+<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v1.0 20120330//EN"
3+ "JATS-journalpublishing1.dtd">
4+$if(article.type)$
5+<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.0" article-type="$article.type$">
6+$else$
7+<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.0" article-type="other">
8+$endif$
9+<front>
10+<journal-meta>
11+$if(journal.publisher-id)$
12+<journal-id journal-id-type="publisher-id">$journal.publisher-id$</journal-id>
13+$endif$
14+$if(journal.nlm-ta)$
15+<journal-id journal-id-type="nlm-ta">$journal.nlm-ta$</journal-id>
16+$endif$
17+$if(journal.pmc)$
18+<journal-id journal-id-type="pmc">$journal.pmc$</journal-id>
19+$endif$
20+<journal-title-group>
21+$if(journal.title)$
22+<journal-title>$journal.title$</journal-title>
23+$endif$
24+$if(journal.abbrev-title)$
25+<abbrev-journal-title>$journal.abbrev-title$</abbrev-journal-title>
26+$endif$
27+</journal-title-group>
28+$if(journal.pissn)$
29+<issn pub-type="ppub">$journal.pissn$</issn>
30+$endif$
31+$if(journal.eissn)$
32+<issn pub-type="epub">$journal.eissn$</issn>
33+$endif$
34+<publisher>
35+<publisher-name>$journal.publisher-name$</publisher-name>
36+$if(journal.publisher-loc)$
37+<publisher-loc>$journal.publisher-loc$</publisher-loc>
38+$endif$
39+</publisher>
40+</journal-meta>
41+<article-meta>
42+$if(article.publisher-id)$
43+<article-id pub-id-type="publisher-id">$article.publisher-id$</article-id>
44+$endif$
45+$if(article.doi)$
46+<article-id pub-id-type="doi">$article.doi$</article-id>
47+$endif$
48+$if(article.pmid)$
49+<article-id pub-id-type="pmid">$article.pmid$</article-id>
50+$endif$
51+$if(article.pmcid)$
52+<article-id pub-id-type="pmcid">$article.pmcid$</article-id>
53+$endif$
54+$if(article.art-access-id)$
55+<article-id pub-id-type="art-access-id">$article.art-access-id$</article-id>
56+$endif$
57+$if(article.heading)$
58+<article-categories>
59+<subj-group subj-group-type="heading">
60+<subject>$article.heading$</subject>
61+</subj-group>
62+$if(article.categories)$
63+<subj-group subj-group-type="categories">
64+$for(article.categories)$
65+<subject>$article.categories$</subject>
66+$endfor$
67+</subj-group>
68+$endif$
69+</article-categories>
70+$endif$
71+$if(title)$
72+<title-group>
73+<article-title>$title$</article-title>
74+</title-group>
75+$endif$
76+$if(author)$
77+<contrib-group>
78+$for(author)$
79+<contrib contrib-type="author">
80+$if(author.orcid)$
81+<contrib-id contrib-id-type="orcid">$author.orcid$</contrib-id>
82+$endif$
83+<name>
84+$if(author.surname)$
85+<surname>$author.surname$</surname>
86+<given-names>$author.given-names$</given-names>
87+$else$
88+<string-name>$author$</string-name>
89+$endif$
90+</name>
91+$if(author.email)$
92+<email>$author.email$</email>
93+$endif$
94+$if(author.aff-id)$
95+<xref ref-type="aff" rid="aff-$contrib.aff-id$"/>
96+$endif$
97+$if(author.cor-id)$
98+<xref ref-type="corresp" rid="cor-$author.cor-id$"><sup>*</sup></xref>
99+$endif$
100+</contrib>
101+$endfor$
102+</contrib-group>
103+$endif$
104+$if(article.author-notes)$
105+<author-notes>
106+$if(article.author-notes.corresp)$
107+$for(article.author-notes.corresp)$
108+<corresp id="cor-$article.author-notes.corresp.id$">* E-mail: <email>$article.author-notes.corresp.email$</email></corresp>
109+$endfor$
110+$endif$
111+$if(article.author-notes.conflict)$
112+<fn fn-type="conflict"><p>$article.author-notes.conflict$</p></fn>
113+$endif$
114+$if(article.author-notes.con)$
115+<fn fn-type="con"><p>$article.author-notes.con$</p></fn>
116+$endif$
117+</author-notes>
118+$endif$
119+$if(date)$
120+$if(date.iso-8601)$
121+<pub-date pub-type="epub" iso-8601-date="$date.iso-8601$">
122+$else$
123+<pub-date pub-type="epub">
124+$endif$
125+$if(date.day)$
126+<day>$pub-date.day$</day>
127+$endif$
128+$if(date.month)$
129+<month>$pub-date.month$</month>
130+$endif$
131+$if(date.year)$
132+<year>$pub-date.year$</year>
133+$else$
134+<string-date>$date$</string-date>
135+$endif$
136+</pub-date>
137+$endif$
138+$if(article.volume)$
139+<volume>$article.volume$</volume>
140+$endif$
141+$if(article.issue)$
142+<issue>$article.issue$</issue>
143+$endif$
144+$if(article.fpage)$
145+<fpage>$article.fpage$</fpage>
146+$endif$
147+$if(article.lpage)$
148+<lpage>$article.lpage$</lpage>
149+$endif$
150+$if(article.elocation-id)$
151+<elocation-id>$article.elocation-id$</elocation-id>
152+$endif$
153+$if(history)$
154+<history>
155+</history>
156+$endif$
157+$if(copyright)$
158+<permissions>
159+$if(copyright.statement)$
160+<copyright-statement>$copyright.statement$</copyright-statement>
161+$endif$
162+$if(copyright.year)$
163+<copyright-year>$copyright.year$</copyright-year>
164+$endif$
165+$if(copyright.holder)$
166+<copyright-holder>$copyright.holder$</copyright-holder>
167+$endif$
168+$if(copyright.text)$
169+<license license-type="$copyright.type$" xlink:href="$copyright.link$">
170+<license-p>$copyright.text$</license-p>
171+</license>
172+</permissions>
173+$endif$
174+$endif$
175+$if(tags)$
176+<kwd-group kwd-group-type="author">
177+$for(tags)$
178+<kwd>$tags$</kwd>
179+$endfor$
180+</kwd-group>
181+$endif$
182+$if(article.funding-statement)$
183+<funding-group>
184+<funding-statement>$article.funding-statement$</funding-statement>
185+</funding-group>
186+$endif$
187+</article-meta>
188+$if(notes)$
189+<notes>$notes$</notes>
190+$endif$
191+</front>
192+$body$
193+</article>
pandoc.cabal+4
@@ -41,6 +41,7 @@ Data-Files:
4141 data/templates/default.html5
4242 data/templates/default.docbook4
4343 data/templates/default.docbook5
44+ data/templates/default.jats
4445 data/templates/default.tei
4546 data/templates/default.beamer
4647 data/templates/default.opendocument
@@ -158,6 +159,7 @@ Extra-Source-Files:
158159 test/tables.context
159160 test/tables.docbook4
160161 test/tables.docbook5
162+ test/tables.jats
161163 test/tables.dokuwiki
162164 test/tables.zimwiki
163165 test/tables.icml
@@ -186,6 +188,7 @@ Extra-Source-Files:
186188 test/writer.context
187189 test/writer.docbook4
188190 test/writer.docbook5
191+ test/writer.jats
189192 test/writer.html4
190193 test/writer.html5
191194 test/writer.man
@@ -380,6 +383,7 @@ Library
380383 Text.Pandoc.Readers.EPUB,
381384 Text.Pandoc.Writers.Native,
382385 Text.Pandoc.Writers.Docbook,
386+ Text.Pandoc.Writers.JATS,
383387 Text.Pandoc.Writers.OPML,
384388 Text.Pandoc.Writers.HTML,
385389 Text.Pandoc.Writers.ICML,
src/Text/Pandoc.hs+3
@@ -117,6 +117,7 @@ module Text.Pandoc
117117 , writeICML
118118 , writeDocbook4
119119 , writeDocbook5
120+ , writeJATS
120121 , writeOPML
121122 , writeOpenDocument
122123 , writeMan
@@ -182,6 +183,7 @@ import Text.Pandoc.Writers.CommonMark
182183import Text.Pandoc.Writers.ConTeXt
183184import Text.Pandoc.Writers.Custom
184185import Text.Pandoc.Writers.Docbook
186+import Text.Pandoc.Writers.JATS
185187import Text.Pandoc.Writers.Docx
186188import Text.Pandoc.Writers.DokuWiki
187189import Text.Pandoc.Writers.EPUB
@@ -287,6 +289,7 @@ writers = [
287289 ,("docbook" , StringWriter writeDocbook5)
288290 ,("docbook4" , StringWriter writeDocbook4)
289291 ,("docbook5" , StringWriter writeDocbook5)
292+ ,("jats" , StringWriter writeJATS)
290293 ,("opml" , StringWriter writeOPML)
291294 ,("opendocument" , StringWriter writeOpenDocument)
292295 ,("latex" , StringWriter writeLaTeX)
src/Text/Pandoc/Writers/JATS.hsnew file+429
@@ -0,0 +1,429 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+{-# LANGUAGE PatternGuards #-}
3+{-
4+Copyright (C) 2006-2015 John MacFarlane <jgm@berkeley.edu>
5+
6+This program is free software; you can redistribute it and/or modify
7+it under the terms of the GNU General Public License as published by
8+the Free Software Foundation; either version 2 of the License, or
9+(at your option) any later version.
10+
11+This program is distributed in the hope that it will be useful,
12+but WITHOUT ANY WARRANTY; without even the implied warranty of
13+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+GNU General Public License for more details.
15+
16+You should have received a copy of the GNU General Public License
17+along with this program; if not, write to the Free Software
18+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19+-}
20+{- |
21+ Module : Text.Pandoc.Writers.JATS
22+ Copyright : Copyright (C) 2017 John MacFarlane
23+ License : GNU GPL, version 2 or above
24+
25+ Maintainer : John MacFarlane <jgm@berkeley.edu>
26+ Stability : alpha
27+ Portability : portable
28+
29+Conversion of 'Pandoc' documents to JATS XML.
30+Reference:
31+https://jats.nlm.nih.gov/publishing/tag-library/1.1d3/element/mml-math.html
32+-}
33+module Text.Pandoc.Writers.JATS ( writeJATS ) where
34+import Control.Monad.Reader
35+import Data.Char (toLower)
36+import Data.Generics (everywhere, mkT)
37+import Data.List (intercalate, isSuffixOf)
38+import Data.Maybe (fromMaybe)
39+import qualified Text.Pandoc.Builder as B
40+import Text.Pandoc.Class (PandocMonad, report)
41+import Text.Pandoc.Definition
42+import Text.Pandoc.Highlighting (languages, languagesByExtension)
43+import Text.Pandoc.Logging
44+import Text.Pandoc.Options
45+import Text.Pandoc.Pretty
46+import Text.Pandoc.Shared
47+import Text.Pandoc.Templates (renderTemplate')
48+import Text.Pandoc.Writers.Math
49+import Text.Pandoc.Writers.Shared
50+import Text.Pandoc.XML
51+import Text.Pandoc.MIME (getMimeType)
52+import Text.TeXMath
53+import qualified Text.XML.Light as Xml
54+
55+data JATSVersion = JATS1_1
56+ deriving (Eq, Show)
57+
58+type DB = ReaderT JATSVersion
59+
60+-- | Convert list of authors to a docbook <author> section
61+authorToJATS :: PandocMonad m => WriterOptions -> [Inline] -> DB m B.Inlines
62+authorToJATS opts name' = do
63+ name <- render Nothing <$> inlinesToJATS opts name'
64+ let colwidth = if writerWrapText opts == WrapAuto
65+ then Just $ writerColumns opts
66+ else Nothing
67+ return $ B.rawInline "docbook" $ render colwidth $
68+ if ',' `elem` name
69+ then -- last name first
70+ let (lastname, rest) = break (==',') name
71+ firstname = triml rest in
72+ inTagsSimple "firstname" (text $ escapeStringForXML firstname) <>
73+ inTagsSimple "surname" (text $ escapeStringForXML lastname)
74+ else -- last name last
75+ let namewords = words name
76+ lengthname = length namewords
77+ (firstname, lastname) = case lengthname of
78+ 0 -> ("","")
79+ 1 -> ("", name)
80+ n -> (intercalate " " (take (n-1) namewords), last namewords)
81+ in inTagsSimple "firstname" (text $ escapeStringForXML firstname) $$
82+ inTagsSimple "surname" (text $ escapeStringForXML lastname)
83+
84+writeJATS :: PandocMonad m => WriterOptions -> Pandoc -> m String
85+writeJATS opts d =
86+ runReaderT (docToJATS opts d) JATS1_1
87+
88+-- | Convert Pandoc document to string in JATS format.
89+docToJATS :: PandocMonad m => WriterOptions -> Pandoc -> DB m String
90+docToJATS opts (Pandoc meta blocks) = do
91+ let elements = hierarchicalize blocks
92+ let colwidth = if writerWrapText opts == WrapAuto
93+ then Just $ writerColumns opts
94+ else Nothing
95+ let render' = render colwidth
96+ let opts' = if (maybe False (("/book>" `isSuffixOf`) . trimr)
97+ (writerTemplate opts) &&
98+ TopLevelDefault == writerTopLevelDivision opts)
99+ then opts{ writerTopLevelDivision = TopLevelChapter }
100+ else opts
101+ -- The numbering here follows LaTeX's internal numbering
102+ let startLvl = case writerTopLevelDivision opts' of
103+ TopLevelPart -> -1
104+ TopLevelChapter -> 0
105+ TopLevelSection -> 1
106+ TopLevelDefault -> 1
107+ auths' <- mapM (authorToJATS opts) $ docAuthors meta
108+ let meta' = B.setMeta "author" auths' meta
109+ metadata <- metaToJSON opts
110+ (fmap (render colwidth . vcat) .
111+ (mapM (elementToJATS opts' startLvl) .
112+ hierarchicalize))
113+ (fmap (render colwidth) . inlinesToJATS opts')
114+ meta'
115+ main <- (render' . inTagsIndented "body" . vcat) <$>
116+ (mapM (elementToJATS opts' startLvl) elements)
117+ let context = defField "body" main
118+ $ defField "mathml" (case writerHTMLMathMethod opts of
119+ MathML -> True
120+ _ -> False)
121+ $ metadata
122+ return $ case writerTemplate opts of
123+ Nothing -> main
124+ Just tpl -> renderTemplate' tpl context
125+
126+-- | Convert an Element to JATS.
127+elementToJATS :: PandocMonad m => WriterOptions -> Int -> Element -> DB m Doc
128+elementToJATS opts _ (Blk block) = blockToJATS opts block
129+elementToJATS opts lvl (Sec _ _num (id',_,kvs) title elements) = do
130+ let idAttr = [("id", writerIdentifierPrefix opts ++ id') | not (null id')]
131+ let otherAttrs = ["sec-type", "specific-use"]
132+ let attribs = idAttr ++ [(k,v) | (k,v) <- kvs, k `elem` otherAttrs]
133+ contents <- mapM (elementToJATS opts (lvl + 1)) elements
134+ title' <- inlinesToJATS opts title
135+ return $ inTags True "sec" attribs $
136+ inTagsSimple "title" title' $$ vcat contents
137+
138+-- | Convert a list of Pandoc blocks to JATS.
139+blocksToJATS :: PandocMonad m => WriterOptions -> [Block] -> DB m Doc
140+blocksToJATS opts = fmap vcat . mapM (blockToJATS opts)
141+
142+-- | Auxiliary function to convert Plain block to Para.
143+plainToPara :: Block -> Block
144+plainToPara (Plain x) = Para x
145+plainToPara x = x
146+
147+-- | Convert a list of pairs of terms and definitions into a list of
148+-- JATS varlistentrys.
149+deflistItemsToJATS :: PandocMonad m
150+ => WriterOptions -> [([Inline],[[Block]])] -> DB m Doc
151+deflistItemsToJATS opts items =
152+ vcat <$> mapM (\(term, defs) -> deflistItemToJATS opts term defs) items
153+
154+-- | Convert a term and a list of blocks into a JATS varlistentry.
155+deflistItemToJATS :: PandocMonad m
156+ => WriterOptions -> [Inline] -> [[Block]] -> DB m Doc
157+deflistItemToJATS opts term defs = do
158+ term' <- inlinesToJATS opts term
159+ def' <- blocksToJATS opts $ concatMap (map plainToPara) defs
160+ return $ inTagsIndented "def-item" $
161+ inTagsIndented "term" term' $$
162+ inTagsIndented "def" def'
163+
164+-- | Convert a list of lists of blocks to a list of JATS list items.
165+listItemsToJATS :: PandocMonad m
166+ => WriterOptions -> (Maybe [String]) -> [[Block]] -> DB m Doc
167+listItemsToJATS opts markers items =
168+ case markers of
169+ Nothing -> vcat <$> mapM (listItemToJATS opts Nothing) items
170+ Just ms -> vcat <$> zipWithM (listItemToJATS opts) (map Just ms) items
171+
172+-- | Convert a list of blocks into a JATS list item.
173+listItemToJATS :: PandocMonad m
174+ => WriterOptions -> (Maybe String) -> [Block] -> DB m Doc
175+listItemToJATS opts mbmarker item = do
176+ contents <- blocksToJATS opts item
177+ return $ inTagsIndented "list-item" $
178+ maybe empty (\lbl -> inTagsIndented "label" (text lbl)) mbmarker
179+ $$ contents
180+
181+-- | Convert a Pandoc block element to JATS.
182+blockToJATS :: PandocMonad m => WriterOptions -> Block -> DB m Doc
183+blockToJATS _ Null = return empty
184+-- Add ids to paragraphs in divs with ids - this is needed for
185+-- pandoc-citeproc to get link anchors in bibliographies:
186+blockToJATS opts (Div (ident,_,_) [Para lst]) =
187+ let attribs = [("id", ident) | not (null ident)] in
188+ inTags True "p" attribs <$> inlinesToJATS opts lst
189+blockToJATS opts (Div (ident,_,kvs) bs) = do
190+ contents <- blocksToJATS opts bs
191+ let attr = [("id", ident) | not (null ident)] ++
192+ [("xml:lang",l) | ("lang",l) <- kvs] ++
193+ [(k,v) | (k,v) <- kvs, k `elem` ["specific-use",
194+ "content-type", "orientation", "position"]]
195+ return $ inTags True "boxed-text" attr contents
196+blockToJATS _ (Header _ _ _) =
197+ return empty -- should not occur after hierarchicalize
198+-- No Plain, everything needs to be in a block-level tag
199+blockToJATS opts (Plain lst) = blockToJATS opts (Para lst)
200+-- title beginning with fig: indicates that the image is a figure
201+blockToJATS opts (Para [Image (ident,_,kvs) txt
202+ (src,'f':'i':'g':':':tit)]) = do
203+ alt <- inlinesToJATS opts txt
204+ let capt = if null txt
205+ then empty
206+ else inTagsSimple "caption" alt
207+ let attr = [("id", ident) | not (null ident)] ++
208+ [(k,v) | (k,v) <- kvs, k `elem` ["fig-type", "orientation",
209+ "position", "specific-use"]]
210+ let mbMT = getMimeType src
211+ let maintype = fromMaybe "image" $
212+ lookup "mimetype" kvs `mplus`
213+ (takeWhile (/='/') <$> mbMT)
214+ let subtype = fromMaybe "" $
215+ lookup "mime-subtype" kvs `mplus`
216+ ((drop 1 . dropWhile (/='/')) <$> mbMT)
217+ let graphicattr = [("mimetype",maintype),
218+ ("mime-subtype",drop 1 subtype),
219+ ("xlink:href",src), -- do we need to URL escape this?
220+ ("xlink:title",tit)]
221+ return $ inTags True "fig" attr $
222+ capt $$ selfClosingTag "graphic" graphicattr
223+blockToJATS opts (Para lst) =
224+ inTagsIndented "p" <$> inlinesToJATS opts lst
225+blockToJATS opts (LineBlock lns) =
226+ blockToJATS opts $ linesToPara lns
227+blockToJATS opts (BlockQuote blocks) =
228+ inTagsIndented "disp-quote" <$> blocksToJATS opts blocks
229+blockToJATS _ (CodeBlock (ident,classes,kvs) str) = return $
230+ inTags False tag attr (flush (text (escapeStringForXML str)))
231+ where attr = [("id",ident) | not (null ident)] ++
232+ [("language",lang) | not (null lang)] ++
233+ [(k,v) | (k,v) <- kvs, k `elem` ["code-type",
234+ "code-version", "executable",
235+ "language-version", "orientation",
236+ "platforms", "position", "specific-use"]]
237+ tag = if null lang then "preformat" else "code"
238+ lang = case langs of
239+ (l:_) -> escapeStringForXML l
240+ [] -> ""
241+ isLang l = map toLower l `elem` map (map toLower) languages
242+ langsFrom s = if isLang s
243+ then [s]
244+ else languagesByExtension . map toLower $ s
245+ langs = concatMap langsFrom classes
246+blockToJATS _ (BulletList []) = return empty
247+blockToJATS opts (BulletList lst) = do
248+ inTags True "list" [("list-type", "bullet")] <$>
249+ listItemsToJATS opts Nothing lst
250+blockToJATS _ (OrderedList _ []) = return empty
251+blockToJATS opts (OrderedList (start, numstyle, delimstyle) items) = do
252+ let listType = case numstyle of
253+ DefaultStyle -> "order"
254+ Decimal -> "order"
255+ Example -> "order"
256+ UpperAlpha -> "alpha-upper"
257+ LowerAlpha -> "alpha-lower"
258+ UpperRoman -> "roman-upper"
259+ LowerRoman -> "roman-lower"
260+ let simpleList = start == 1 && (delimstyle == DefaultDelim ||
261+ delimstyle == Period)
262+ let markers = if simpleList
263+ then Nothing
264+ else Just $
265+ orderedListMarkers (start, numstyle, delimstyle)
266+ inTags True "list" [("list-type", listType)] <$>
267+ listItemsToJATS opts markers items
268+blockToJATS opts (DefinitionList lst) = do
269+ inTags True "def-list" [] <$> deflistItemsToJATS opts lst
270+blockToJATS _ b@(RawBlock f str)
271+ | f == "jats" = return $ text str -- raw XML block
272+ | otherwise = do
273+ report $ BlockNotRendered b
274+ return empty
275+blockToJATS _ HorizontalRule = return empty -- not semantic
276+blockToJATS opts (Table [] aligns widths headers rows) = do
277+ let percent w = show (truncate (100*w) :: Integer) ++ "*"
278+ let coltags = vcat $ zipWith (\w al -> selfClosingTag "col"
279+ ([("width", percent w) | w > 0] ++
280+ [("align", alignmentToString al)])) widths aligns
281+ thead <- if all null headers
282+ then return empty
283+ else inTagsIndented "thead" <$> tableRowToJATS opts True headers
284+ tbody <- (inTagsIndented "tbody" . vcat) <$>
285+ mapM (tableRowToJATS opts False) rows
286+ return $ inTags True "table" [] $ coltags $$ thead $$ tbody
287+blockToJATS opts (Table caption aligns widths headers rows) = do
288+ captionDoc <- inTagsIndented "caption" <$> blockToJATS opts (Para caption)
289+ tbl <- blockToJATS opts (Table [] aligns widths headers rows)
290+ return $ inTags True "table-wrap" [] $ captionDoc $$ tbl
291+
292+alignmentToString :: Alignment -> [Char]
293+alignmentToString alignment = case alignment of
294+ AlignLeft -> "left"
295+ AlignRight -> "right"
296+ AlignCenter -> "center"
297+ AlignDefault -> "left"
298+
299+tableRowToJATS :: PandocMonad m
300+ => WriterOptions
301+ -> Bool
302+ -> [[Block]]
303+ -> DB m Doc
304+tableRowToJATS opts isHeader cols =
305+ (inTagsIndented "tr" . vcat) <$> mapM (tableItemToJATS opts isHeader) cols
306+
307+tableItemToJATS :: PandocMonad m
308+ => WriterOptions
309+ -> Bool
310+ -> [Block]
311+ -> DB m Doc
312+tableItemToJATS opts isHeader item =
313+ (inTags True (if isHeader then "th" else "td") [] . vcat) <$>
314+ mapM (blockToJATS opts) item
315+
316+-- | Convert a list of inline elements to JATS.
317+inlinesToJATS :: PandocMonad m => WriterOptions -> [Inline] -> DB m Doc
318+inlinesToJATS opts lst = hcat <$> mapM (inlineToJATS opts) lst
319+
320+-- | Convert an inline element to JATS.
321+inlineToJATS :: PandocMonad m => WriterOptions -> Inline -> DB m Doc
322+inlineToJATS _ (Str str) = return $ text $ escapeStringForXML str
323+inlineToJATS opts (Emph lst) =
324+ inTagsSimple "italic" <$> inlinesToJATS opts lst
325+inlineToJATS opts (Strong lst) =
326+ inTags False "bold" [("role", "strong")] <$> inlinesToJATS opts lst
327+inlineToJATS opts (Strikeout lst) =
328+ inTagsSimple "strike" <$> inlinesToJATS opts lst
329+inlineToJATS opts (Superscript lst) =
330+ inTagsSimple "sup" <$> inlinesToJATS opts lst
331+inlineToJATS opts (Subscript lst) =
332+ inTagsSimple "sub" <$> inlinesToJATS opts lst
333+inlineToJATS opts (SmallCaps lst) =
334+ inTags False "sc" [("role", "smallcaps")] <$>
335+ inlinesToJATS opts lst
336+inlineToJATS opts (Quoted SingleQuote lst) = do
337+ contents <- inlinesToJATS opts lst
338+ return $ char '‘' <> contents <> char '’'
339+inlineToJATS opts (Quoted DoubleQuote lst) = do
340+ contents <- inlinesToJATS opts lst
341+ return $ char '“' <> contents <> char '”'
342+inlineToJATS _ (Code _ str) =
343+ return $ inTagsSimple "monospace" $ text (escapeStringForXML str)
344+inlineToJATS _ il@(RawInline f x)
345+ | f == "jats" = return $ text x
346+ | otherwise = do
347+ report $ InlineNotRendered il
348+ return empty
349+inlineToJATS _ LineBreak = return $ selfClosingTag "break" []
350+inlineToJATS _ Space = return space
351+inlineToJATS opts SoftBreak
352+ | writerWrapText opts == WrapPreserve = return cr
353+ | otherwise = return space
354+inlineToJATS opts (Note contents) =
355+ -- TODO technically only <p> tags are allowed inside
356+ inTagsIndented "fn" <$> blocksToJATS opts contents
357+inlineToJATS opts (Cite _ lst) =
358+ -- TODO revisit this after examining the jats.csl pipeline
359+ inlinesToJATS opts lst
360+inlineToJATS opts (Span ("",_,[]) ils) = inlinesToJATS opts ils
361+inlineToJATS opts (Span (ident,_,kvs) ils) = do
362+ contents <- inlinesToJATS opts ils
363+ let attr = [("id",ident) | not (null ident)] ++
364+ [("xml:lang",l) | ("lang",l) <- kvs] ++
365+ [(k,v) | (k,v) <- kvs
366+ , k `elem` ["content-type", "rationale",
367+ "rid", "specific-use"]]
368+ return $ selfClosingTag "milestone-start" attr <> contents <>
369+ selfClosingTag "milestone-end" []
370+inlineToJATS _ (Math t str) = do
371+ let addPref (Xml.Attr q v)
372+ | Xml.qName q == "xmlns" = Xml.Attr q{ Xml.qName = "xmlns:mml" } v
373+ | otherwise = Xml.Attr q v
374+ let fixNS' e = e{ Xml.elName =
375+ (Xml.elName e){ Xml.qPrefix = Just "mml" } }
376+ let fixNS = everywhere (mkT fixNS') .
377+ (\e -> e{ Xml.elAttribs = map addPref (Xml.elAttribs e) })
378+ let conf = Xml.useShortEmptyTags (const False) Xml.defaultConfigPP
379+ res <- convertMath writeMathML t str
380+ let tagtype = case t of
381+ DisplayMath -> "disp-formula"
382+ InlineMath -> "inline-formula"
383+ return $ inTagsSimple tagtype $
384+ case res of
385+ Right r -> text $ Xml.ppcElement conf
386+ $ fixNS r
387+ Left _ -> inTagsSimple "tex-math"
388+ $ text "<![CDATA[" <>
389+ text str <>
390+ text "]]>"
391+inlineToJATS _ (Link _attr [Str t] ('m':'a':'i':'l':'t':'o':':':email, _))
392+ | escapeURI t == email =
393+ return $ inTagsSimple "email" $ text (escapeStringForXML email)
394+inlineToJATS opts (Link (ident,_,kvs) txt ('#':src, _)) = do
395+ let attr = [("id", ident) | not (null ident)] ++
396+ [("alt", stringify txt),
397+ ("rid", src)] ++
398+ [(k,v) | (k,v) <- kvs, k `elem` ["ref-type", "specific-use"]]
399+ contents <- inlinesToJATS opts txt
400+ return $ inTags False "xref" attr contents
401+inlineToJATS opts (Link (ident,_,kvs) txt (src, tit)) = do
402+ let attr = [("id", ident) | not (null ident)] ++
403+ [("ext-link-type", "uri"),
404+ ("xlink:href", src)] ++
405+ [("xlink:title", tit) | not (null tit)] ++
406+ [(k,v) | (k,v) <- kvs, k `elem` ["assigning-authority",
407+ "specific-use", "xlink:actuate",
408+ "xlink:role", "xlink:show",
409+ "xlink:type"]]
410+ contents <- inlinesToJATS opts txt
411+ return $ inTags False "ext-link" attr contents
412+inlineToJATS _ (Image (ident,_,kvs) _ (src, tit)) = do
413+ let mbMT = getMimeType src
414+ let maintype = fromMaybe "image" $
415+ lookup "mimetype" kvs `mplus`
416+ (takeWhile (/='/') <$> mbMT)
417+ let subtype = fromMaybe "" $
418+ lookup "mime-subtype" kvs `mplus`
419+ ((drop 1 . dropWhile (/='/')) <$> mbMT)
420+ let attr = [("id", ident) | not (null ident)] ++
421+ [("mimetype", maintype),
422+ ("mime-subtype", subtype),
423+ ("xlink:href", src)] ++
424+ [("xlink:title", tit) | not (null tit)] ++
425+ [(k,v) | (k,v) <- kvs, k `elem` ["baseline-shift",
426+ "content-type", "specific-use", "xlink:actuate",
427+ "xlink:href", "xlink:role", "xlink:show",
428+ "xlink:type"]]
429+ return $ selfClosingTag "inline-graphic" attr
test/Tests/Old.hs+3
@@ -77,6 +77,9 @@ tests = [ testGroup "markdown"
7777 , testGroup "docbook5"
7878 [ testGroup "writer" $ writerTests "docbook5"
7979 ]
80+ , testGroup "jats"
81+ [ testGroup "writer" $ writerTests "jats"
82+ ]
8083 , testGroup "native"
8184 [ testGroup "writer" $ writerTests "native"
8285 , test "reader" ["-r", "native", "-w", "native", "-s"]
test/tables.jatsnew file+616
@@ -0,0 +1,616 @@
1+<body>
2+ <p>
3+ Simple table with caption:
4+ </p>
5+ <table-wrap>
6+ <caption>
7+ <p>
8+ Demonstration of simple table syntax.
9+ </p>
10+ </caption>
11+ <table>
12+ <col align="right" />
13+ <col align="left" />
14+ <col align="center" />
15+ <col align="left" />
16+ <thead>
17+ <tr>
18+ <th>
19+ <p>
20+ Right
21+ </p>
22+ </th>
23+ <th>
24+ <p>
25+ Left
26+ </p>
27+ </th>
28+ <th>
29+ <p>
30+ Center
31+ </p>
32+ </th>
33+ <th>
34+ <p>
35+ Default
36+ </p>
37+ </th>
38+ </tr>
39+ </thead>
40+ <tbody>
41+ <tr>
42+ <td>
43+ <p>
44+ 12
45+ </p>
46+ </td>
47+ <td>
48+ <p>
49+ 12
50+ </p>
51+ </td>
52+ <td>
53+ <p>
54+ 12
55+ </p>
56+ </td>
57+ <td>
58+ <p>
59+ 12
60+ </p>
61+ </td>
62+ </tr>
63+ <tr>
64+ <td>
65+ <p>
66+ 123
67+ </p>
68+ </td>
69+ <td>
70+ <p>
71+ 123
72+ </p>
73+ </td>
74+ <td>
75+ <p>
76+ 123
77+ </p>
78+ </td>
79+ <td>
80+ <p>
81+ 123
82+ </p>
83+ </td>
84+ </tr>
85+ <tr>
86+ <td>
87+ <p>
88+ 1
89+ </p>
90+ </td>
91+ <td>
92+ <p>
93+ 1
94+ </p>
95+ </td>
96+ <td>
97+ <p>
98+ 1
99+ </p>
100+ </td>
101+ <td>
102+ <p>
103+ 1
104+ </p>
105+ </td>
106+ </tr>
107+ </tbody>
108+ </table>
109+ </table-wrap>
110+ <p>
111+ Simple table without caption:
112+ </p>
113+ <table>
114+ <col align="right" />
115+ <col align="left" />
116+ <col align="center" />
117+ <col align="left" />
118+ <thead>
119+ <tr>
120+ <th>
121+ <p>
122+ Right
123+ </p>
124+ </th>
125+ <th>
126+ <p>
127+ Left
128+ </p>
129+ </th>
130+ <th>
131+ <p>
132+ Center
133+ </p>
134+ </th>
135+ <th>
136+ <p>
137+ Default
138+ </p>
139+ </th>
140+ </tr>
141+ </thead>
142+ <tbody>
143+ <tr>
144+ <td>
145+ <p>
146+ 12
147+ </p>
148+ </td>
149+ <td>
150+ <p>
151+ 12
152+ </p>
153+ </td>
154+ <td>
155+ <p>
156+ 12
157+ </p>
158+ </td>
159+ <td>
160+ <p>
161+ 12
162+ </p>
163+ </td>
164+ </tr>
165+ <tr>
166+ <td>
167+ <p>
168+ 123
169+ </p>
170+ </td>
171+ <td>
172+ <p>
173+ 123
174+ </p>
175+ </td>
176+ <td>
177+ <p>
178+ 123
179+ </p>
180+ </td>
181+ <td>
182+ <p>
183+ 123
184+ </p>
185+ </td>
186+ </tr>
187+ <tr>
188+ <td>
189+ <p>
190+ 1
191+ </p>
192+ </td>
193+ <td>
194+ <p>
195+ 1
196+ </p>
197+ </td>
198+ <td>
199+ <p>
200+ 1
201+ </p>
202+ </td>
203+ <td>
204+ <p>
205+ 1
206+ </p>
207+ </td>
208+ </tr>
209+ </tbody>
210+ </table>
211+ <p>
212+ Simple table indented two spaces:
213+ </p>
214+ <table-wrap>
215+ <caption>
216+ <p>
217+ Demonstration of simple table syntax.
218+ </p>
219+ </caption>
220+ <table>
221+ <col align="right" />
222+ <col align="left" />
223+ <col align="center" />
224+ <col align="left" />
225+ <thead>
226+ <tr>
227+ <th>
228+ <p>
229+ Right
230+ </p>
231+ </th>
232+ <th>
233+ <p>
234+ Left
235+ </p>
236+ </th>
237+ <th>
238+ <p>
239+ Center
240+ </p>
241+ </th>
242+ <th>
243+ <p>
244+ Default
245+ </p>
246+ </th>
247+ </tr>
248+ </thead>
249+ <tbody>
250+ <tr>
251+ <td>
252+ <p>
253+ 12
254+ </p>
255+ </td>
256+ <td>
257+ <p>
258+ 12
259+ </p>
260+ </td>
261+ <td>
262+ <p>
263+ 12
264+ </p>
265+ </td>
266+ <td>
267+ <p>
268+ 12
269+ </p>
270+ </td>
271+ </tr>
272+ <tr>
273+ <td>
274+ <p>
275+ 123
276+ </p>
277+ </td>
278+ <td>
279+ <p>
280+ 123
281+ </p>
282+ </td>
283+ <td>
284+ <p>
285+ 123
286+ </p>
287+ </td>
288+ <td>
289+ <p>
290+ 123
291+ </p>
292+ </td>
293+ </tr>
294+ <tr>
295+ <td>
296+ <p>
297+ 1
298+ </p>
299+ </td>
300+ <td>
301+ <p>
302+ 1
303+ </p>
304+ </td>
305+ <td>
306+ <p>
307+ 1
308+ </p>
309+ </td>
310+ <td>
311+ <p>
312+ 1
313+ </p>
314+ </td>
315+ </tr>
316+ </tbody>
317+ </table>
318+ </table-wrap>
319+ <p>
320+ Multiline table with caption:
321+ </p>
322+ <table-wrap>
323+ <caption>
324+ <p>
325+ Here’s the caption. It may span multiple lines.
326+ </p>
327+ </caption>
328+ <table>
329+ <col width="15*" align="center" />
330+ <col width="13*" align="left" />
331+ <col width="16*" align="right" />
332+ <col width="33*" align="left" />
333+ <thead>
334+ <tr>
335+ <th>
336+ <p>
337+ Centered Header
338+ </p>
339+ </th>
340+ <th>
341+ <p>
342+ Left Aligned
343+ </p>
344+ </th>
345+ <th>
346+ <p>
347+ Right Aligned
348+ </p>
349+ </th>
350+ <th>
351+ <p>
352+ Default aligned
353+ </p>
354+ </th>
355+ </tr>
356+ </thead>
357+ <tbody>
358+ <tr>
359+ <td>
360+ <p>
361+ First
362+ </p>
363+ </td>
364+ <td>
365+ <p>
366+ row
367+ </p>
368+ </td>
369+ <td>
370+ <p>
371+ 12.0
372+ </p>
373+ </td>
374+ <td>
375+ <p>
376+ Example of a row that spans multiple lines.
377+ </p>
378+ </td>
379+ </tr>
380+ <tr>
381+ <td>
382+ <p>
383+ Second
384+ </p>
385+ </td>
386+ <td>
387+ <p>
388+ row
389+ </p>
390+ </td>
391+ <td>
392+ <p>
393+ 5.0
394+ </p>
395+ </td>
396+ <td>
397+ <p>
398+ Here’s another one. Note the blank line between rows.
399+ </p>
400+ </td>
401+ </tr>
402+ </tbody>
403+ </table>
404+ </table-wrap>
405+ <p>
406+ Multiline table without caption:
407+ </p>
408+ <table>
409+ <col width="15*" align="center" />
410+ <col width="13*" align="left" />
411+ <col width="16*" align="right" />
412+ <col width="33*" align="left" />
413+ <thead>
414+ <tr>
415+ <th>
416+ <p>
417+ Centered Header
418+ </p>
419+ </th>
420+ <th>
421+ <p>
422+ Left Aligned
423+ </p>
424+ </th>
425+ <th>
426+ <p>
427+ Right Aligned
428+ </p>
429+ </th>
430+ <th>
431+ <p>
432+ Default aligned
433+ </p>
434+ </th>
435+ </tr>
436+ </thead>
437+ <tbody>
438+ <tr>
439+ <td>
440+ <p>
441+ First
442+ </p>
443+ </td>
444+ <td>
445+ <p>
446+ row
447+ </p>
448+ </td>
449+ <td>
450+ <p>
451+ 12.0
452+ </p>
453+ </td>
454+ <td>
455+ <p>
456+ Example of a row that spans multiple lines.
457+ </p>
458+ </td>
459+ </tr>
460+ <tr>
461+ <td>
462+ <p>
463+ Second
464+ </p>
465+ </td>
466+ <td>
467+ <p>
468+ row
469+ </p>
470+ </td>
471+ <td>
472+ <p>
473+ 5.0
474+ </p>
475+ </td>
476+ <td>
477+ <p>
478+ Here’s another one. Note the blank line between rows.
479+ </p>
480+ </td>
481+ </tr>
482+ </tbody>
483+ </table>
484+ <p>
485+ Table without column headers:
486+ </p>
487+ <table>
488+ <col align="right" />
489+ <col align="left" />
490+ <col align="center" />
491+ <col align="right" />
492+ <tbody>
493+ <tr>
494+ <td>
495+ <p>
496+ 12
497+ </p>
498+ </td>
499+ <td>
500+ <p>
501+ 12
502+ </p>
503+ </td>
504+ <td>
505+ <p>
506+ 12
507+ </p>
508+ </td>
509+ <td>
510+ <p>
511+ 12
512+ </p>
513+ </td>
514+ </tr>
515+ <tr>
516+ <td>
517+ <p>
518+ 123
519+ </p>
520+ </td>
521+ <td>
522+ <p>
523+ 123
524+ </p>
525+ </td>
526+ <td>
527+ <p>
528+ 123
529+ </p>
530+ </td>
531+ <td>
532+ <p>
533+ 123
534+ </p>
535+ </td>
536+ </tr>
537+ <tr>
538+ <td>
539+ <p>
540+ 1
541+ </p>
542+ </td>
543+ <td>
544+ <p>
545+ 1
546+ </p>
547+ </td>
548+ <td>
549+ <p>
550+ 1
551+ </p>
552+ </td>
553+ <td>
554+ <p>
555+ 1
556+ </p>
557+ </td>
558+ </tr>
559+ </tbody>
560+ </table>
561+ <p>
562+ Multiline table without column headers:
563+ </p>
564+ <table>
565+ <col width="15*" align="center" />
566+ <col width="13*" align="left" />
567+ <col width="16*" align="right" />
568+ <col width="33*" align="left" />
569+ <tbody>
570+ <tr>
571+ <td>
572+ <p>
573+ First
574+ </p>
575+ </td>
576+ <td>
577+ <p>
578+ row
579+ </p>
580+ </td>
581+ <td>
582+ <p>
583+ 12.0
584+ </p>
585+ </td>
586+ <td>
587+ <p>
588+ Example of a row that spans multiple lines.
589+ </p>
590+ </td>
591+ </tr>
592+ <tr>
593+ <td>
594+ <p>
595+ Second
596+ </p>
597+ </td>
598+ <td>
599+ <p>
600+ row
601+ </p>
602+ </td>
603+ <td>
604+ <p>
605+ 5.0
606+ </p>
607+ </td>
608+ <td>
609+ <p>
610+ Here’s another one. Note the blank line between rows.
611+ </p>
612+ </td>
613+ </tr>
614+ </tbody>
615+ </table>
616+</body>
test/writer.jatsnew file+1425
@@ -0,0 +1,1425 @@
1+<?xml version="1.0" encoding="utf-8" ?>
2+<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v1.0 20120330//EN"
3+ "JATS-journalpublishing1.dtd">
4+<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.0" article-type="other">
5+<front>
6+<journal-meta>
7+<journal-title-group>
8+</journal-title-group>
9+<publisher>
10+<publisher-name></publisher-name>
11+</publisher>
12+</journal-meta>
13+<article-meta>
14+<title-group>
15+<article-title>Pandoc Test Suite</article-title>
16+</title-group>
17+<pub-date pub-type="epub">
18+<string-date>July 17, 2006</string-date>
19+</pub-date>
20+</article-meta>
21+</front>
22+<body>
23+ <p>
24+ This is a set of tests for pandoc. Most of them are adapted from John
25+ Gruber’s markdown test suite.
26+ </p>
27+ <sec id="headers">
28+ <title>Headers</title>
29+ <sec id="level-2-with-an-embedded-link">
30+ <title>Level 2 with an
31+ <ext-link ext-link-type="uri" xlink:href="/url">embedded
32+ link</ext-link></title>
33+ <sec id="level-3-with-emphasis">
34+ <title>Level 3 with <italic>emphasis</italic></title>
35+ <sec id="level-4">
36+ <title>Level 4</title>
37+ <sec id="level-5">
38+ <title>Level 5</title>
39+ </sec>
40+ </sec>
41+ </sec>
42+ </sec>
43+ </sec>
44+ <sec id="level-1">
45+ <title>Level 1</title>
46+ <sec id="level-2-with-emphasis">
47+ <title>Level 2 with <italic>emphasis</italic></title>
48+ <sec id="level-3">
49+ <title>Level 3</title>
50+ <p>
51+ with no blank line
52+ </p>
53+ </sec>
54+ </sec>
55+ <sec id="level-2">
56+ <title>Level 2</title>
57+ <p>
58+ with no blank line
59+ </p>
60+ </sec>
61+ </sec>
62+ <sec id="paragraphs">
63+ <title>Paragraphs</title>
64+ <p>
65+ Here’s a regular paragraph.
66+ </p>
67+ <p>
68+ In Markdown 1.0.0 and earlier. Version 8. This line turns into a list
69+ item. Because a hard-wrapped line in the middle of a paragraph looked
70+ like a list item.
71+ </p>
72+ <p>
73+ Here’s one with a bullet. * criminey.
74+ </p>
75+ <p>
76+ There should be a hard line break<break />here.
77+ </p>
78+ </sec>
79+ <sec id="block-quotes">
80+ <title>Block Quotes</title>
81+ <p>
82+ E-mail style:
83+ </p>
84+ <disp-quote>
85+ <p>
86+ This is a block quote. It is pretty short.
87+ </p>
88+ </disp-quote>
89+ <disp-quote>
90+ <p>
91+ Code in a block quote:
92+ </p>
93+ <preformat>sub status {
94+ print &quot;working&quot;;
95+}</preformat>
96+ <p>
97+ A list:
98+ </p>
99+ <list list-type="order">
100+ <list-item>
101+ <p>
102+ item one
103+ </p>
104+ </list-item>
105+ <list-item>
106+ <p>
107+ item two
108+ </p>
109+ </list-item>
110+ </list>
111+ <p>
112+ Nested block quotes:
113+ </p>
114+ <disp-quote>
115+ <p>
116+ nested
117+ </p>
118+ </disp-quote>
119+ <disp-quote>
120+ <p>
121+ nested
122+ </p>
123+ </disp-quote>
124+ </disp-quote>
125+ <p>
126+ This should not be a block quote: 2 &gt; 1.
127+ </p>
128+ <p>
129+ And a following paragraph.
130+ </p>
131+ </sec>
132+ <sec id="code-blocks">
133+ <title>Code Blocks</title>
134+ <p>
135+ Code:
136+ </p>
137+ <preformat>---- (should be four hyphens)
138+
139+sub status {
140+ print &quot;working&quot;;
141+}
142+
143+this code block is indented by one tab</preformat>
144+ <p>
145+ And:
146+ </p>
147+ <preformat> this code block is indented by two tabs
148+
149+These should not be escaped: \$ \\ \&gt; \[ \{</preformat>
150+ </sec>
151+ <sec id="lists">
152+ <title>Lists</title>
153+ <sec id="unordered">
154+ <title>Unordered</title>
155+ <p>
156+ Asterisks tight:
157+ </p>
158+ <list list-type="bullet">
159+ <list-item>
160+ <p>
161+ asterisk 1
162+ </p>
163+ </list-item>
164+ <list-item>
165+ <p>
166+ asterisk 2
167+ </p>
168+ </list-item>
169+ <list-item>
170+ <p>
171+ asterisk 3
172+ </p>
173+ </list-item>
174+ </list>
175+ <p>
176+ Asterisks loose:
177+ </p>
178+ <list list-type="bullet">
179+ <list-item>
180+ <p>
181+ asterisk 1
182+ </p>
183+ </list-item>
184+ <list-item>
185+ <p>
186+ asterisk 2
187+ </p>
188+ </list-item>
189+ <list-item>
190+ <p>
191+ asterisk 3
192+ </p>
193+ </list-item>
194+ </list>
195+ <p>
196+ Pluses tight:
197+ </p>
198+ <list list-type="bullet">
199+ <list-item>
200+ <p>
201+ Plus 1
202+ </p>
203+ </list-item>
204+ <list-item>
205+ <p>
206+ Plus 2
207+ </p>
208+ </list-item>
209+ <list-item>
210+ <p>
211+ Plus 3
212+ </p>
213+ </list-item>
214+ </list>
215+ <p>
216+ Pluses loose:
217+ </p>
218+ <list list-type="bullet">
219+ <list-item>
220+ <p>
221+ Plus 1
222+ </p>
223+ </list-item>
224+ <list-item>
225+ <p>
226+ Plus 2
227+ </p>
228+ </list-item>
229+ <list-item>
230+ <p>
231+ Plus 3
232+ </p>
233+ </list-item>
234+ </list>
235+ <p>
236+ Minuses tight:
237+ </p>
238+ <list list-type="bullet">
239+ <list-item>
240+ <p>
241+ Minus 1
242+ </p>
243+ </list-item>
244+ <list-item>
245+ <p>
246+ Minus 2
247+ </p>
248+ </list-item>
249+ <list-item>
250+ <p>
251+ Minus 3
252+ </p>
253+ </list-item>
254+ </list>
255+ <p>
256+ Minuses loose:
257+ </p>
258+ <list list-type="bullet">
259+ <list-item>
260+ <p>
261+ Minus 1
262+ </p>
263+ </list-item>
264+ <list-item>
265+ <p>
266+ Minus 2
267+ </p>
268+ </list-item>
269+ <list-item>
270+ <p>
271+ Minus 3
272+ </p>
273+ </list-item>
274+ </list>
275+ </sec>
276+ <sec id="ordered">
277+ <title>Ordered</title>
278+ <p>
279+ Tight:
280+ </p>
281+ <list list-type="order">
282+ <list-item>
283+ <p>
284+ First
285+ </p>
286+ </list-item>
287+ <list-item>
288+ <p>
289+ Second
290+ </p>
291+ </list-item>
292+ <list-item>
293+ <p>
294+ Third
295+ </p>
296+ </list-item>
297+ </list>
298+ <p>
299+ and:
300+ </p>
301+ <list list-type="order">
302+ <list-item>
303+ <p>
304+ One
305+ </p>
306+ </list-item>
307+ <list-item>
308+ <p>
309+ Two
310+ </p>
311+ </list-item>
312+ <list-item>
313+ <p>
314+ Three
315+ </p>
316+ </list-item>
317+ </list>
318+ <p>
319+ Loose using tabs:
320+ </p>
321+ <list list-type="order">
322+ <list-item>
323+ <p>
324+ First
325+ </p>
326+ </list-item>
327+ <list-item>
328+ <p>
329+ Second
330+ </p>
331+ </list-item>
332+ <list-item>
333+ <p>
334+ Third
335+ </p>
336+ </list-item>
337+ </list>
338+ <p>
339+ and using spaces:
340+ </p>
341+ <list list-type="order">
342+ <list-item>
343+ <p>
344+ One
345+ </p>
346+ </list-item>
347+ <list-item>
348+ <p>
349+ Two
350+ </p>
351+ </list-item>
352+ <list-item>
353+ <p>
354+ Three
355+ </p>
356+ </list-item>
357+ </list>
358+ <p>
359+ Multiple paragraphs:
360+ </p>
361+ <list list-type="order">
362+ <list-item>
363+ <p>
364+ Item 1, graf one.
365+ </p>
366+ <p>
367+ Item 1. graf two. The quick brown fox jumped over the lazy dog’s
368+ back.
369+ </p>
370+ </list-item>
371+ <list-item>
372+ <p>
373+ Item 2.
374+ </p>
375+ </list-item>
376+ <list-item>
377+ <p>
378+ Item 3.
379+ </p>
380+ </list-item>
381+ </list>
382+ </sec>
383+ <sec id="nested">
384+ <title>Nested</title>
385+ <list list-type="bullet">
386+ <list-item>
387+ <p>
388+ Tab
389+ </p>
390+ <list list-type="bullet">
391+ <list-item>
392+ <p>
393+ Tab
394+ </p>
395+ <list list-type="bullet">
396+ <list-item>
397+ <p>
398+ Tab
399+ </p>
400+ </list-item>
401+ </list>
402+ </list-item>
403+ </list>
404+ </list-item>
405+ </list>
406+ <p>
407+ Here’s another:
408+ </p>
409+ <list list-type="order">
410+ <list-item>
411+ <p>
412+ First
413+ </p>
414+ </list-item>
415+ <list-item>
416+ <p>
417+ Second:
418+ </p>
419+ <list list-type="bullet">
420+ <list-item>
421+ <p>
422+ Fee
423+ </p>
424+ </list-item>
425+ <list-item>
426+ <p>
427+ Fie
428+ </p>
429+ </list-item>
430+ <list-item>
431+ <p>
432+ Foe
433+ </p>
434+ </list-item>
435+ </list>
436+ </list-item>
437+ <list-item>
438+ <p>
439+ Third
440+ </p>
441+ </list-item>
442+ </list>
443+ <p>
444+ Same thing but with paragraphs:
445+ </p>
446+ <list list-type="order">
447+ <list-item>
448+ <p>
449+ First
450+ </p>
451+ </list-item>
452+ <list-item>
453+ <p>
454+ Second:
455+ </p>
456+ <list list-type="bullet">
457+ <list-item>
458+ <p>
459+ Fee
460+ </p>
461+ </list-item>
462+ <list-item>
463+ <p>
464+ Fie
465+ </p>
466+ </list-item>
467+ <list-item>
468+ <p>
469+ Foe
470+ </p>
471+ </list-item>
472+ </list>
473+ </list-item>
474+ <list-item>
475+ <p>
476+ Third
477+ </p>
478+ </list-item>
479+ </list>
480+ </sec>
481+ <sec id="tabs-and-spaces">
482+ <title>Tabs and spaces</title>
483+ <list list-type="bullet">
484+ <list-item>
485+ <p>
486+ this is a list item indented with tabs
487+ </p>
488+ </list-item>
489+ <list-item>
490+ <p>
491+ this is a list item indented with spaces
492+ </p>
493+ <list list-type="bullet">
494+ <list-item>
495+ <p>
496+ this is an example list item indented with tabs
497+ </p>
498+ </list-item>
499+ <list-item>
500+ <p>
501+ this is an example list item indented with spaces
502+ </p>
503+ </list-item>
504+ </list>
505+ </list-item>
506+ </list>
507+ </sec>
508+ <sec id="fancy-list-markers">
509+ <title>Fancy list markers</title>
510+ <list list-type="order">
511+ <list-item>
512+ <label>
513+ (2)
514+ </label>
515+ <p>
516+ begins with 2
517+ </p>
518+ </list-item>
519+ <list-item>
520+ <label>
521+ (3)
522+ </label>
523+ <p>
524+ and now 3
525+ </p>
526+ <p>
527+ with a continuation
528+ </p>
529+ <list list-type="roman-lower">
530+ <list-item>
531+ <label>
532+ iv.
533+ </label>
534+ <p>
535+ sublist with roman numerals, starting with 4
536+ </p>
537+ </list-item>
538+ <list-item>
539+ <label>
540+ v.
541+ </label>
542+ <p>
543+ more items
544+ </p>
545+ <list list-type="alpha-upper">
546+ <list-item>
547+ <label>
548+ (A)
549+ </label>
550+ <p>
551+ a subsublist
552+ </p>
553+ </list-item>
554+ <list-item>
555+ <label>
556+ (B)
557+ </label>
558+ <p>
559+ a subsublist
560+ </p>
561+ </list-item>
562+ </list>
563+ </list-item>
564+ </list>
565+ </list-item>
566+ </list>
567+ <p>
568+ Nesting:
569+ </p>
570+ <list list-type="alpha-upper">
571+ <list-item>
572+ <p>
573+ Upper Alpha
574+ </p>
575+ <list list-type="roman-upper">
576+ <list-item>
577+ <p>
578+ Upper Roman.
579+ </p>
580+ <list list-type="order">
581+ <list-item>
582+ <label>
583+ (6)
584+ </label>
585+ <p>
586+ Decimal start with 6
587+ </p>
588+ <list list-type="alpha-lower">
589+ <list-item>
590+ <label>
591+ c)
592+ </label>
593+ <p>
594+ Lower alpha with paren
595+ </p>
596+ </list-item>
597+ </list>
598+ </list-item>
599+ </list>
600+ </list-item>
601+ </list>
602+ </list-item>
603+ </list>
604+ <p>
605+ Autonumbering:
606+ </p>
607+ <list list-type="order">
608+ <list-item>
609+ <p>
610+ Autonumber.
611+ </p>
612+ </list-item>
613+ <list-item>
614+ <p>
615+ More.
616+ </p>
617+ <list list-type="order">
618+ <list-item>
619+ <p>
620+ Nested.
621+ </p>
622+ </list-item>
623+ </list>
624+ </list-item>
625+ </list>
626+ <p>
627+ Should not be a list item:
628+ </p>
629+ <p>
630+ M.A. 2007
631+ </p>
632+ <p>
633+ B. Williams
634+ </p>
635+ </sec>
636+ </sec>
637+ <sec id="definition-lists">
638+ <title>Definition Lists</title>
639+ <p>
640+ Tight using spaces:
641+ </p>
642+ <def-list>
643+ <def-item>
644+ <term>
645+ apple
646+ </term>
647+ <def>
648+ <p>
649+ red fruit
650+ </p>
651+ </def>
652+ </def-item>
653+ <def-item>
654+ <term>
655+ orange
656+ </term>
657+ <def>
658+ <p>
659+ orange fruit
660+ </p>
661+ </def>
662+ </def-item>
663+ <def-item>
664+ <term>
665+ banana
666+ </term>
667+ <def>
668+ <p>
669+ yellow fruit
670+ </p>
671+ </def>
672+ </def-item>
673+ </def-list>
674+ <p>
675+ Tight using tabs:
676+ </p>
677+ <def-list>
678+ <def-item>
679+ <term>
680+ apple
681+ </term>
682+ <def>
683+ <p>
684+ red fruit
685+ </p>
686+ </def>
687+ </def-item>
688+ <def-item>
689+ <term>
690+ orange
691+ </term>
692+ <def>
693+ <p>
694+ orange fruit
695+ </p>
696+ </def>
697+ </def-item>
698+ <def-item>
699+ <term>
700+ banana
701+ </term>
702+ <def>
703+ <p>
704+ yellow fruit
705+ </p>
706+ </def>
707+ </def-item>
708+ </def-list>
709+ <p>
710+ Loose:
711+ </p>
712+ <def-list>
713+ <def-item>
714+ <term>
715+ apple
716+ </term>
717+ <def>
718+ <p>
719+ red fruit
720+ </p>
721+ </def>
722+ </def-item>
723+ <def-item>
724+ <term>
725+ orange
726+ </term>
727+ <def>
728+ <p>
729+ orange fruit
730+ </p>
731+ </def>
732+ </def-item>
733+ <def-item>
734+ <term>
735+ banana
736+ </term>
737+ <def>
738+ <p>
739+ yellow fruit
740+ </p>
741+ </def>
742+ </def-item>
743+ </def-list>
744+ <p>
745+ Multiple blocks with italics:
746+ </p>
747+ <def-list>
748+ <def-item>
749+ <term>
750+ <italic>apple</italic>
751+ </term>
752+ <def>
753+ <p>
754+ red fruit
755+ </p>
756+ <p>
757+ contains seeds, crisp, pleasant to taste
758+ </p>
759+ </def>
760+ </def-item>
761+ <def-item>
762+ <term>
763+ <italic>orange</italic>
764+ </term>
765+ <def>
766+ <p>
767+ orange fruit
768+ </p>
769+ <preformat>{ orange code block }</preformat>
770+ <disp-quote>
771+ <p>
772+ orange block quote
773+ </p>
774+ </disp-quote>
775+ </def>
776+ </def-item>
777+ </def-list>
778+ <p>
779+ Multiple definitions, tight:
780+ </p>
781+ <def-list>
782+ <def-item>
783+ <term>
784+ apple
785+ </term>
786+ <def>
787+ <p>
788+ red fruit
789+ </p>
790+ <p>
791+ computer
792+ </p>
793+ </def>
794+ </def-item>
795+ <def-item>
796+ <term>
797+ orange
798+ </term>
799+ <def>
800+ <p>
801+ orange fruit
802+ </p>
803+ <p>
804+ bank
805+ </p>
806+ </def>
807+ </def-item>
808+ </def-list>
809+ <p>
810+ Multiple definitions, loose:
811+ </p>
812+ <def-list>
813+ <def-item>
814+ <term>
815+ apple
816+ </term>
817+ <def>
818+ <p>
819+ red fruit
820+ </p>
821+ <p>
822+ computer
823+ </p>
824+ </def>
825+ </def-item>
826+ <def-item>
827+ <term>
828+ orange
829+ </term>
830+ <def>
831+ <p>
832+ orange fruit
833+ </p>
834+ <p>
835+ bank
836+ </p>
837+ </def>
838+ </def-item>
839+ </def-list>
840+ <p>
841+ Blank line after term, indented marker, alternate markers:
842+ </p>
843+ <def-list>
844+ <def-item>
845+ <term>
846+ apple
847+ </term>
848+ <def>
849+ <p>
850+ red fruit
851+ </p>
852+ <p>
853+ computer
854+ </p>
855+ </def>
856+ </def-item>
857+ <def-item>
858+ <term>
859+ orange
860+ </term>
861+ <def>
862+ <p>
863+ orange fruit
864+ </p>
865+ <list list-type="order">
866+ <list-item>
867+ <p>
868+ sublist
869+ </p>
870+ </list-item>
871+ <list-item>
872+ <p>
873+ sublist
874+ </p>
875+ </list-item>
876+ </list>
877+ </def>
878+ </def-item>
879+ </def-list>
880+ </sec>
881+ <sec id="html-blocks">
882+ <title>HTML Blocks</title>
883+ <p>
884+ Simple block on one line:
885+ </p>
886+ <boxed-text>
887+ <p>
888+ foo
889+ </p>
890+ </boxed-text>
891+ <p>
892+ And nested without indentation:
893+ </p>
894+ <boxed-text>
895+ <boxed-text>
896+ <p>
897+ foo
898+ </p>
899+ </boxed-text>
900+ <boxed-text>
901+ <p>
902+ bar
903+ </p>
904+ </boxed-text>
905+ </boxed-text>
906+ <p>
907+ Interpreted markdown in a table:
908+ </p>
909+ <p>
910+ This is <italic>emphasized</italic>
911+ </p>
912+ <p>
913+ And this is <bold role="strong">strong</bold>
914+ </p>
915+ <p>
916+ Here’s a simple block:
917+ </p>
918+ <p>
919+ foo
920+ </p>
921+ <p>
922+ This should be a code block, though:
923+ </p>
924+ <preformat>&lt;div&gt;
925+ foo
926+&lt;/div&gt;</preformat>
927+ <p>
928+ As should this:
929+ </p>
930+ <preformat>&lt;div&gt;foo&lt;/div&gt;</preformat>
931+ <p>
932+ Now, nested:
933+ </p>
934+ <boxed-text>
935+ <boxed-text>
936+ <boxed-text>
937+ <p>
938+ foo
939+ </p>
940+ </boxed-text>
941+ </boxed-text>
942+ </boxed-text>
943+ <p>
944+ This should just be an HTML comment:
945+ </p>
946+ <p>
947+ Multiline:
948+ </p>
949+ <p>
950+ Code block:
951+ </p>
952+ <preformat>&lt;!-- Comment --&gt;</preformat>
953+ <p>
954+ Just plain comment, with trailing spaces on the line:
955+ </p>
956+ <p>
957+ Code:
958+ </p>
959+ <preformat>&lt;hr /&gt;</preformat>
960+ <p>
961+ Hr’s:
962+ </p>
963+ </sec>
964+ <sec id="inline-markup">
965+ <title>Inline Markup</title>
966+ <p>
967+ This is <italic>emphasized</italic>, and so <italic>is this</italic>.
968+ </p>
969+ <p>
970+ This is <bold role="strong">strong</bold>, and so <bold role="strong">is
971+ this</bold>.
972+ </p>
973+ <p>
974+ An <italic><ext-link ext-link-type="uri" xlink:href="/url">emphasized
975+ link</ext-link></italic>.
976+ </p>
977+ <p>
978+ <bold role="strong"><italic>This is strong and em.</italic></bold>
979+ </p>
980+ <p>
981+ So is <bold role="strong"><italic>this</italic></bold> word.
982+ </p>
983+ <p>
984+ <bold role="strong"><italic>This is strong and em.</italic></bold>
985+ </p>
986+ <p>
987+ So is <bold role="strong"><italic>this</italic></bold> word.
988+ </p>
989+ <p>
990+ This is code: <monospace>&gt;</monospace>, <monospace>$</monospace>,
991+ <monospace>\</monospace>, <monospace>\$</monospace>,
992+ <monospace>&lt;html&gt;</monospace>.
993+ </p>
994+ <p>
995+ <strike>This is <italic>strikeout</italic>.</strike>
996+ </p>
997+ <p>
998+ Superscripts: a<sup>bc</sup>d a<sup><italic>hello</italic></sup>
999+ a<sup>hello there</sup>.
1000+ </p>
1001+ <p>
1002+ Subscripts: H<sub>2</sub>O, H<sub>23</sub>O, H<sub>many of them</sub>O.
1003+ </p>
1004+ <p>
1005+ These should not be superscripts or subscripts, because of the unescaped
1006+ spaces: a^b c^d, a~b c~d.
1007+ </p>
1008+ </sec>
1009+ <sec id="smart-quotes-ellipses-dashes">
1010+ <title>Smart quotes, ellipses, dashes</title>
1011+ <p>
1012+ “Hello,” said the spider. “‘Shelob’ is my name.”
1013+ </p>
1014+ <p>
1015+ ‘A’, ‘B’, and ‘C’ are letters.
1016+ </p>
1017+ <p>
1018+ ‘Oak,’ ‘elm,’ and ‘beech’ are names of trees. So is ‘pine.’
1019+ </p>
1020+ <p>
1021+ ‘He said, “I want to go.”’ Were you alive in the 70’s?
1022+ </p>
1023+ <p>
1024+ Here is some quoted ‘<monospace>code</monospace>’ and a
1025+ “<ext-link ext-link-type="uri" xlink:href="http://example.com/?foo=1&amp;bar=2">quoted
1026+ link</ext-link>”.
1027+ </p>
1028+ <p>
1029+ Some dashes: one—two — three—four — five.
1030+ </p>
1031+ <p>
1032+ Dashes between numbers: 5–7, 255–66, 1987–1999.
1033+ </p>
1034+ <p>
1035+ Ellipses…and…and….
1036+ </p>
1037+ </sec>
1038+ <sec id="latex">
1039+ <title>LaTeX</title>
1040+ <list list-type="bullet">
1041+ <list-item>
1042+ <p>
1043+ </p>
1044+ </list-item>
1045+ <list-item>
1046+ <p>
1047+ <inline-formula><mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mn>2</mml:mn><mml:mo>+</mml:mo><mml:mn>2</mml:mn><mml:mo>=</mml:mo><mml:mn>4</mml:mn></mml:mrow></mml:math></inline-formula>
1048+ </p>
1049+ </list-item>
1050+ <list-item>
1051+ <p>
1052+ <inline-formula><mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mi>x</mml:mi><mml:mo>∈</mml:mo><mml:mi>y</mml:mi></mml:mrow></mml:math></inline-formula>
1053+ </p>
1054+ </list-item>
1055+ <list-item>
1056+ <p>
1057+ <inline-formula><mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mi>α</mml:mi><mml:mo>∧</mml:mo><mml:mi>ω</mml:mi></mml:mrow></mml:math></inline-formula>
1058+ </p>
1059+ </list-item>
1060+ <list-item>
1061+ <p>
1062+ <inline-formula><mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mn>223</mml:mn></mml:math></inline-formula>
1063+ </p>
1064+ </list-item>
1065+ <list-item>
1066+ <p>
1067+ <inline-formula><mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>p</mml:mi></mml:math></inline-formula>-Tree
1068+ </p>
1069+ </list-item>
1070+ <list-item>
1071+ <p>
1072+ Here’s some display math:
1073+ <disp-formula><mml:math display="block" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mfrac><mml:mi>d</mml:mi><mml:mrow><mml:mi>d</mml:mi><mml:mi>x</mml:mi></mml:mrow></mml:mfrac><mml:mi>f</mml:mi><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo stretchy="false" form="postfix">)</mml:mo><mml:mo>=</mml:mo><mml:munder><mml:mo>lim</mml:mo><mml:mrow><mml:mi>h</mml:mi><mml:mo accent="false">→</mml:mo><mml:mn>0</mml:mn></mml:mrow></mml:munder><mml:mfrac><mml:mrow><mml:mi>f</mml:mi><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo>+</mml:mo><mml:mi>h</mml:mi><mml:mo stretchy="false" form="postfix">)</mml:mo><mml:mo>−</mml:mo><mml:mi>f</mml:mi><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo stretchy="false" form="postfix">)</mml:mo></mml:mrow><mml:mi>h</mml:mi></mml:mfrac></mml:mrow></mml:math></disp-formula>
1074+ </p>
1075+ </list-item>
1076+ <list-item>
1077+ <p>
1078+ Here’s one that has a line break in it:
1079+ <inline-formula><mml:math display="inline" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mi>α</mml:mi><mml:mo>+</mml:mo><mml:mi>ω</mml:mi><mml:mo>×</mml:mo><mml:msup><mml:mi>x</mml:mi><mml:mn>2</mml:mn></mml:msup></mml:mrow></mml:math></inline-formula>.
1080+ </p>
1081+ </list-item>
1082+ </list>
1083+ <p>
1084+ These shouldn’t be math:
1085+ </p>
1086+ <list list-type="bullet">
1087+ <list-item>
1088+ <p>
1089+ To get the famous equation, write <monospace>$e = mc^2$</monospace>.
1090+ </p>
1091+ </list-item>
1092+ <list-item>
1093+ <p>
1094+ $22,000 is a <italic>lot</italic> of money. So is $34,000. (It
1095+ worked if “lot” is emphasized.)
1096+ </p>
1097+ </list-item>
1098+ <list-item>
1099+ <p>
1100+ Shoes ($20) and socks ($5).
1101+ </p>
1102+ </list-item>
1103+ <list-item>
1104+ <p>
1105+ Escaped <monospace>$</monospace>: $73 <italic>this should be
1106+ emphasized</italic> 23$.
1107+ </p>
1108+ </list-item>
1109+ </list>
1110+ <p>
1111+ Here’s a LaTeX table:
1112+ </p>
1113+ </sec>
1114+ <sec id="special-characters">
1115+ <title>Special Characters</title>
1116+ <p>
1117+ Here is some unicode:
1118+ </p>
1119+ <list list-type="bullet">
1120+ <list-item>
1121+ <p>
1122+ I hat: Î
1123+ </p>
1124+ </list-item>
1125+ <list-item>
1126+ <p>
1127+ o umlaut: ö
1128+ </p>
1129+ </list-item>
1130+ <list-item>
1131+ <p>
1132+ section: §
1133+ </p>
1134+ </list-item>
1135+ <list-item>
1136+ <p>
1137+ set membership: ∈
1138+ </p>
1139+ </list-item>
1140+ <list-item>
1141+ <p>
1142+ copyright: ©
1143+ </p>
1144+ </list-item>
1145+ </list>
1146+ <p>
1147+ AT&amp;T has an ampersand in their name.
1148+ </p>
1149+ <p>
1150+ AT&amp;T is another way to write it.
1151+ </p>
1152+ <p>
1153+ This &amp; that.
1154+ </p>
1155+ <p>
1156+ 4 &lt; 5.
1157+ </p>
1158+ <p>
1159+ 6 &gt; 5.
1160+ </p>
1161+ <p>
1162+ Backslash: \
1163+ </p>
1164+ <p>
1165+ Backtick: `
1166+ </p>
1167+ <p>
1168+ Asterisk: *
1169+ </p>
1170+ <p>
1171+ Underscore: _
1172+ </p>
1173+ <p>
1174+ Left brace: {
1175+ </p>
1176+ <p>
1177+ Right brace: }
1178+ </p>
1179+ <p>
1180+ Left bracket: [
1181+ </p>
1182+ <p>
1183+ Right bracket: ]
1184+ </p>
1185+ <p>
1186+ Left paren: (
1187+ </p>
1188+ <p>
1189+ Right paren: )
1190+ </p>
1191+ <p>
1192+ Greater-than: &gt;
1193+ </p>
1194+ <p>
1195+ Hash: #
1196+ </p>
1197+ <p>
1198+ Period: .
1199+ </p>
1200+ <p>
1201+ Bang: !
1202+ </p>
1203+ <p>
1204+ Plus: +
1205+ </p>
1206+ <p>
1207+ Minus: -
1208+ </p>
1209+ </sec>
1210+ <sec id="links">
1211+ <title>Links</title>
1212+ <sec id="explicit">
1213+ <title>Explicit</title>
1214+ <p>
1215+ Just a
1216+ <ext-link ext-link-type="uri" xlink:href="/url/">URL</ext-link>.
1217+ </p>
1218+ <p>
1219+ <ext-link ext-link-type="uri" xlink:href="/url/" xlink:title="title">URL
1220+ and title</ext-link>.
1221+ </p>
1222+ <p>
1223+ <ext-link ext-link-type="uri" xlink:href="/url/" xlink:title="title preceded by two spaces">URL
1224+ and title</ext-link>.
1225+ </p>
1226+ <p>
1227+ <ext-link ext-link-type="uri" xlink:href="/url/" xlink:title="title preceded by a tab">URL
1228+ and title</ext-link>.
1229+ </p>
1230+ <p>
1231+ <ext-link ext-link-type="uri" xlink:href="/url/" xlink:title="title with &quot;quotes&quot; in it">URL
1232+ and title</ext-link>
1233+ </p>
1234+ <p>
1235+ <ext-link ext-link-type="uri" xlink:href="/url/" xlink:title="title with single quotes">URL
1236+ and title</ext-link>
1237+ </p>
1238+ <p>
1239+ <ext-link ext-link-type="uri" xlink:href="/url/with_underscore">with_underscore</ext-link>
1240+ </p>
1241+ <p>
1242+ <ext-link ext-link-type="uri" xlink:href="mailto:nobody@nowhere.net">Email
1243+ link</ext-link>
1244+ </p>
1245+ <p>
1246+ <ext-link ext-link-type="uri" xlink:href="">Empty</ext-link>.
1247+ </p>
1248+ </sec>
1249+ <sec id="reference">
1250+ <title>Reference</title>
1251+ <p>
1252+ Foo <ext-link ext-link-type="uri" xlink:href="/url/">bar</ext-link>.
1253+ </p>
1254+ <p>
1255+ Foo <ext-link ext-link-type="uri" xlink:href="/url/">bar</ext-link>.
1256+ </p>
1257+ <p>
1258+ Foo <ext-link ext-link-type="uri" xlink:href="/url/">bar</ext-link>.
1259+ </p>
1260+ <p>
1261+ With <ext-link ext-link-type="uri" xlink:href="/url/">embedded
1262+ [brackets]</ext-link>.
1263+ </p>
1264+ <p>
1265+ <ext-link ext-link-type="uri" xlink:href="/url/">b</ext-link> by
1266+ itself should be a link.
1267+ </p>
1268+ <p>
1269+ Indented
1270+ <ext-link ext-link-type="uri" xlink:href="/url">once</ext-link>.
1271+ </p>
1272+ <p>
1273+ Indented
1274+ <ext-link ext-link-type="uri" xlink:href="/url">twice</ext-link>.
1275+ </p>
1276+ <p>
1277+ Indented
1278+ <ext-link ext-link-type="uri" xlink:href="/url">thrice</ext-link>.
1279+ </p>
1280+ <p>
1281+ This should [not][] be a link.
1282+ </p>
1283+ <preformat>[not]: /url</preformat>
1284+ <p>
1285+ Foo
1286+ <ext-link ext-link-type="uri" xlink:href="/url/" xlink:title="Title with &quot;quotes&quot; inside">bar</ext-link>.
1287+ </p>
1288+ <p>
1289+ Foo
1290+ <ext-link ext-link-type="uri" xlink:href="/url/" xlink:title="Title with &quot;quote&quot; inside">biz</ext-link>.
1291+ </p>
1292+ </sec>
1293+ <sec id="with-ampersands">
1294+ <title>With ampersands</title>
1295+ <p>
1296+ Here’s a
1297+ <ext-link ext-link-type="uri" xlink:href="http://example.com/?foo=1&amp;bar=2">link
1298+ with an ampersand in the URL</ext-link>.
1299+ </p>
1300+ <p>
1301+ Here’s a link with an amersand in the link text:
1302+ <ext-link ext-link-type="uri" xlink:href="http://att.com/" xlink:title="AT&amp;T">AT&amp;T</ext-link>.
1303+ </p>
1304+ <p>
1305+ Here’s an
1306+ <ext-link ext-link-type="uri" xlink:href="/script?foo=1&amp;bar=2">inline
1307+ link</ext-link>.
1308+ </p>
1309+ <p>
1310+ Here’s an
1311+ <ext-link ext-link-type="uri" xlink:href="/script?foo=1&amp;bar=2">inline
1312+ link in pointy braces</ext-link>.
1313+ </p>
1314+ </sec>
1315+ <sec id="autolinks">
1316+ <title>Autolinks</title>
1317+ <p>
1318+ With an ampersand:
1319+ <ext-link ext-link-type="uri" xlink:href="http://example.com/?foo=1&amp;bar=2">http://example.com/?foo=1&amp;bar=2</ext-link>
1320+ </p>
1321+ <list list-type="bullet">
1322+ <list-item>
1323+ <p>
1324+ In a list?
1325+ </p>
1326+ </list-item>
1327+ <list-item>
1328+ <p>
1329+ <ext-link ext-link-type="uri" xlink:href="http://example.com/">http://example.com/</ext-link>
1330+ </p>
1331+ </list-item>
1332+ <list-item>
1333+ <p>
1334+ It should.
1335+ </p>
1336+ </list-item>
1337+ </list>
1338+ <p>
1339+ An e-mail address: <email>nobody@nowhere.net</email>
1340+ </p>
1341+ <disp-quote>
1342+ <p>
1343+ Blockquoted:
1344+ <ext-link ext-link-type="uri" xlink:href="http://example.com/">http://example.com/</ext-link>
1345+ </p>
1346+ </disp-quote>
1347+ <p>
1348+ Auto-links should not occur here:
1349+ <monospace>&lt;http://example.com/&gt;</monospace>
1350+ </p>
1351+ <preformat>or here: &lt;http://example.com/&gt;</preformat>
1352+ </sec>
1353+ </sec>
1354+ <sec id="images">
1355+ <title>Images</title>
1356+ <p>
1357+ From “Voyage dans la Lune” by Georges Melies (1902):
1358+ </p>
1359+ <fig>
1360+ <caption>lalune</caption>
1361+ <graphic mimetype="image" mime-subtype="peg" xlink:href="lalune.jpg" xlink:title="Voyage dans la Lune" />
1362+ </fig>
1363+ <p>
1364+ Here is a movie
1365+ <inline-graphic mimetype="image" mime-subtype="jpeg" xlink:href="movie.jpg" />
1366+ icon.
1367+ </p>
1368+ </sec>
1369+ <sec id="footnotes">
1370+ <title>Footnotes</title>
1371+ <p>
1372+ Here is a footnote reference,<fn>
1373+ <p>
1374+ Here is the footnote. It can go anywhere after the footnote
1375+ reference. It need not be placed at the end of the document.
1376+ </p>
1377+ </fn> and another.<fn>
1378+ <p>
1379+ Here’s the long note. This one contains multiple blocks.
1380+ </p>
1381+ <p>
1382+ Subsequent blocks are indented to show that they belong to the
1383+ footnote (as with list items).
1384+ </p>
1385+ <preformat> { &lt;code&gt; }</preformat>
1386+ <p>
1387+ If you want, you can indent every line, but you can also be lazy and
1388+ just indent the first line of each block.
1389+ </p>
1390+ </fn> This should <italic>not</italic> be a footnote reference, because
1391+ it contains a space.[^my note] Here is an inline note.<fn>
1392+ <p>
1393+ This is <italic>easier</italic> to type. Inline notes may contain
1394+ <ext-link ext-link-type="uri" xlink:href="http://google.com">links</ext-link>
1395+ and <monospace>]</monospace> verbatim characters, as well as
1396+ [bracketed text].
1397+ </p>
1398+ </fn>
1399+ </p>
1400+ <disp-quote>
1401+ <p>
1402+ Notes can go in quotes.<fn>
1403+ <p>
1404+ In quote.
1405+ </p>
1406+ </fn>
1407+ </p>
1408+ </disp-quote>
1409+ <list list-type="order">
1410+ <list-item>
1411+ <p>
1412+ And in list items.<fn>
1413+ <p>
1414+ In list.
1415+ </p>
1416+ </fn>
1417+ </p>
1418+ </list-item>
1419+ </list>
1420+ <p>
1421+ This paragraph should not be part of the note, as it is not indented.
1422+ </p>
1423+ </sec>
1424+</body>
1425+</article>