git.iko.soy/typeable/pandoc
on master help sign in
Merged changes from docbook branch since r363.
a9e3250fiddlosopher
README+16−14
@@ -6,8 +6,8 @@ Pandoc is a [Haskell] library for converting from one markup format
6to another, and a command-line tool that uses this library. It can read
6to another, and a command-line tool that uses this library. It can read
7[markdown] and (subsets of) [reStructuredText], [HTML], and [LaTeX],
7[markdown] and (subsets of) [reStructuredText], [HTML], and [LaTeX],
8and it can write [markdown], [reStructuredText], [HTML], [LaTeX], [RTF],
8and it can write [markdown], [reStructuredText], [HTML], [LaTeX], [RTF],
9−and [S5] HTML slide shows. Pandoc's version of markdown contains some
9+[DocBook XML], and [S5] HTML slide shows. Pandoc's version of markdown
10−enhancements, like footnotes and embedded LaTeX.
10+contains some enhancements, like footnotes and embedded LaTeX.
11
11
12In contrast to existing tools for converting markdown to HTML, which
12In contrast to existing tools for converting markdown to HTML, which
13use regex substitutions, Pandoc has a modular design: it consists of a
13use regex substitutions, Pandoc has a modular design: it consists of a
@@ -22,6 +22,7 @@ or output format requires only adding a reader or writer.
22[HTML]: http://www.w3.org/TR/html40/
22[HTML]: http://www.w3.org/TR/html40/
23[LaTeX]: http://www.latex-project.org/
23[LaTeX]: http://www.latex-project.org/
24[RTF]: http://en.wikipedia.org/wiki/Rich_Text_Format
24[RTF]: http://en.wikipedia.org/wiki/Rich_Text_Format
25+[DocBook XML]: http://www.docbook.org/
25[Haskell]: http://www.haskell.org/
26[Haskell]: http://www.haskell.org/
26
27
27(c) 2006 John MacFarlane (jgm at berkeley dot edu). Released under the
28(c) 2006 John MacFarlane (jgm at berkeley dot edu). Released under the
@@ -107,17 +108,17 @@ To convert `hello.html` from html to markdown:
107 pandoc -f html -t markdown hello.html
108 pandoc -f html -t markdown hello.html
108
109
109Supported output formats include `markdown`, `latex`, `html`, `rtf`
110Supported output formats include `markdown`, `latex`, `html`, `rtf`
110−(rich text format), `rst` (reStructuredText), and `s5` (which produces
111+(rich text format), `rst` (reStructuredText), `docbook` (DocBook
111−an HTML file that acts like powerpoint). Supported input formats
112+XML), and `s5` (which produces an HTML file that acts like powerpoint).
112−include `markdown`, `html`, `latex`, and `rst`. Note that the `rst`
113+Supported input formats include `markdown`, `html`, `latex`, and `rst`.
113−reader only parses a subset of reStructuredText syntax. For example,
114+Note that the `rst` reader only parses a subset of reStructuredText
114−it doesn't handle tables, definition lists, option lists, or footnotes.
115+syntax. For example, it doesn't handle tables, definition lists, option
115−It handles only the constructs expressible in unextended markdown.
116+lists, or footnotes. It handles only the constructs expressible in
116−But for simple documents it should be adequate. The `latex` and `html`
117+unextended markdown. But for simple documents it should be adequate.
117−readers are also limited in what they can do. Because the `html`
118+The `latex` and `html` readers are also limited in what they can do.
118−reader is picky about the HTML it parses, it is recommended that you
119+Because the `html` reader is picky about the HTML it parses, it is
119−pipe HTML through [HTML Tidy] before sending it to `pandoc`, or use the
120+recommended that you pipe HTML through [HTML Tidy] before sending it to
120−`html2markdown` script described below.
121+`pandoc`, or use the `html2markdown` script described below.
121
122
122If you don't specify a reader or writer explicitly, `pandoc` will
123If you don't specify a reader or writer explicitly, `pandoc` will
123try to determine the input and output format from the extensions of
124try to determine the input and output format from the extensions of
@@ -200,7 +201,8 @@ formats are `native`, `markdown`, `rst`, `html`, and `latex`.
200
201
201`-t`, `--to`, `-w`, or `--write` can be used to specify the output
202`-t`, `--to`, `-w`, or `--write` can be used to specify the output
202format -- the format Pandoc will be converting *to*. Available formats
203format -- the format Pandoc will be converting *to*. Available formats
203−are `native`, `html`, `s5`, `latex`, `markdown`, `rst`, and `rtf`.
204+are `native`, `html`, `s5`, `docbook`, `latex`, `markdown`, `rst`, and
205+`rtf`.
204
206
205`-s` or `--standalone` indicates that a standalone document is to be
207`-s` or `--standalone` indicates that a standalone document is to be
206produced (with appropriate headers and footers), rather than a fragment.
208produced (with appropriate headers and footers), rather than a fragment.
debian/changelog+2
@@ -46,6 +46,8 @@ pandoc (0.3) unstable; urgency=low
46 + Removed extra blanks after '-h' and '-D' output.
46 + Removed extra blanks after '-h' and '-D' output.
47 + Added copyright message to '-v' output, modeled after FSF messages.
47 + Added copyright message to '-v' output, modeled after FSF messages.
48
48
49+ * Added docbook writer.
50+
49 * Added implicit setting of default input and output format based
51 * Added implicit setting of default input and output format based
50 on input and output filename extensions. These defaults are
52 on input and output filename extensions. These defaults are
51 overridden if explicit input and output formats are specified using
53 overridden if explicit input and output formats are specified using
man/man1/pandoc.1+5−3
@@ -6,8 +6,8 @@ pandoc \- general markup converter
6.SH DESCRIPTION
6.SH DESCRIPTION
7\fBPandoc\fR converts files from one markup format to another. It can
7\fBPandoc\fR converts files from one markup format to another. It can
8read markdown and (subsets of) reStructuredText, HTML, and LaTeX, and
8read markdown and (subsets of) reStructuredText, HTML, and LaTeX, and
9−it can write markdown, reStructuredText, HTML, LaTeX, RTF, and S5 HTML
9+it can write markdown, reStructuredText, HTML, LaTeX, RTF, DocBook
10−slide shows.
10+XML, and S5 HTML slide shows.
11.PP
11.PP
12If no \fIinput\-file\fR is specified, input is read from STDIN.
12If no \fIinput\-file\fR is specified, input is read from STDIN.
13Otherwise, the \fIinput\-files\fR are concatenated (with a blank
13Otherwise, the \fIinput\-files\fR are concatenated (with a blank
@@ -80,6 +80,8 @@ can be
80(HTML),
80(HTML),
81.B latex
81.B latex
82(LaTeX),
82(LaTeX),
83+.B docbook
84+(DocBook XML),
83.B s5
85.B s5
84(S5 HTML and javascript slide show),
86(S5 HTML and javascript slide show),
85or
87or
@@ -141,7 +143,7 @@ default header, which can be printed by using the \fB\-D\fR option).
141Implies \fB-s\fR.
143Implies \fB-s\fR.
142.TP
144.TP
143.B \-D \fIFORMAT\fB, \-\-print-default-header=\fIFORMAT\fB
145.B \-D \fIFORMAT\fB, \-\-print-default-header=\fIFORMAT\fB
144−Print the default header for \fIFORMAT\fR (\fIhtml, s5, latex,
146+Print the default header for \fIFORMAT\fR (\fIhtml, s5, latex, docbook,
145markdown, rst, rtf\fR).
147markdown, rst, rtf\fR).
146.TP
148.TP
147.B \-T \fISTRING\fB, \-\-title-prefix=\fISTRING\fB
149.B \-T \fISTRING\fB, \-\-title-prefix=\fISTRING\fB
src/Main.hs+7−1
@@ -37,12 +37,14 @@ import Text.Pandoc.Writers.RST ( writeRST )
37import Text.Pandoc.Readers.RST ( readRST )
37import Text.Pandoc.Readers.RST ( readRST )
38import Text.Pandoc.ASCIIMathML ( asciiMathMLScript )
38import Text.Pandoc.ASCIIMathML ( asciiMathMLScript )
39import Text.Pandoc.Writers.HTML ( writeHtml )
39import Text.Pandoc.Writers.HTML ( writeHtml )
40+import Text.Pandoc.Writers.Docbook ( writeDocbook )
40import Text.Pandoc.Writers.LaTeX ( writeLaTeX )
41import Text.Pandoc.Writers.LaTeX ( writeLaTeX )
41import Text.Pandoc.Readers.LaTeX ( readLaTeX )
42import Text.Pandoc.Readers.LaTeX ( readLaTeX )
42import Text.Pandoc.Writers.RTF ( writeRTF )
43import Text.Pandoc.Writers.RTF ( writeRTF )
43import Text.Pandoc.Writers.Markdown ( writeMarkdown )
44import Text.Pandoc.Writers.Markdown ( writeMarkdown )
44import Text.Pandoc.Writers.DefaultHeaders ( defaultHtmlHeader,
45import Text.Pandoc.Writers.DefaultHeaders ( defaultHtmlHeader,
45− defaultRTFHeader, defaultS5Header, defaultLaTeXHeader )
46+ defaultRTFHeader, defaultS5Header, defaultLaTeXHeader,
47+ defaultDocbookHeader )
46import Text.Pandoc.Definition
48import Text.Pandoc.Definition
47import Text.Pandoc.Shared
49import Text.Pandoc.Shared
48import Text.Regex ( mkRegex, matchRegex )
50import Text.Regex ( mkRegex, matchRegex )
@@ -79,6 +81,7 @@ writers :: [ ( String, ( WriterOptions -> Pandoc -> String, String ) ) ]
79writers = [("native" , (writeDoc, ""))
81writers = [("native" , (writeDoc, ""))
80 ,("html" , (writeHtml, defaultHtmlHeader))
82 ,("html" , (writeHtml, defaultHtmlHeader))
81 ,("s5" , (writeS5, defaultS5Header))
83 ,("s5" , (writeS5, defaultS5Header))
84+ ,("docbook" , (writeDocbook, defaultDocbookHeader))
82 ,("latex" , (writeLaTeX, defaultLaTeXHeader))
85 ,("latex" , (writeLaTeX, defaultLaTeXHeader))
83 ,("markdown" , (writeMarkdown, ""))
86 ,("markdown" , (writeMarkdown, ""))
84 ,("rst" , (writeRST, ""))
87 ,("rst" , (writeRST, ""))
@@ -331,6 +334,8 @@ defaultWriterName x =
331 Just ["text"] -> "markdown"
334 Just ["text"] -> "markdown"
332 Just ["md"] -> "markdown"
335 Just ["md"] -> "markdown"
333 Just ["markdown"] -> "markdown"
336 Just ["markdown"] -> "markdown"
337+ Just ["db"] -> "docbook"
338+ Just ["xml"] -> "docbook"
334 Just _ -> "html"
339 Just _ -> "html"
335
340
336main = do
341main = do
@@ -423,6 +428,7 @@ main = do
423 writerSmart = smart &&
428 writerSmart = smart &&
424 (not strict),
429 (not strict),
425 writerTabStop = tabStop,
430 writerTabStop = tabStop,
431+ writerNotes = [],
426 writerS5 = (writerName=="s5"),
432 writerS5 = (writerName=="s5"),
427 writerIncremental = incremental,
433 writerIncremental = incremental,
428 writerNumberSections = numberSections,
434 writerNumberSections = numberSections,
src/Text/Pandoc/Shared.hs+2−1
@@ -322,7 +322,7 @@ containsPara (x:rest) = containsPara rest
322
322
323-- | Options for writers
323-- | Options for writers
324data WriterOptions = WriterOptions
324data WriterOptions = WriterOptions
325− { writerStandalone :: Bool -- ^ If @True@, writer header and footer
325+ { writerStandalone :: Bool -- ^ Include header and footer
326 , writerTitlePrefix :: String -- ^ Prefix for HTML titles
326 , writerTitlePrefix :: String -- ^ Prefix for HTML titles
327 , writerHeader :: String -- ^ Header for the document
327 , writerHeader :: String -- ^ Header for the document
328 , writerIncludeBefore :: String -- ^ String to include before the body
328 , writerIncludeBefore :: String -- ^ String to include before the body
@@ -334,6 +334,7 @@ data WriterOptions = WriterOptions
334 , writerStrictMarkdown :: Bool -- ^ Use strict markdown syntax
334 , writerStrictMarkdown :: Bool -- ^ Use strict markdown syntax
335 , writerTabStop :: Int -- ^ Tabstop for conversion between
335 , writerTabStop :: Int -- ^ Tabstop for conversion between
336 -- spaces and tabs
336 -- spaces and tabs
337+ , writerNotes :: [Block] -- ^ List of note blocks
337 } deriving Show
338 } deriving Show
338
339
339--
340--
src/Text/Pandoc/Writers/Docbook.hsnew file+236
@@ -0,0 +1,236 @@
1+{-
2+Copyright (C) 2006 John MacFarlane <jgm at berkeley dot edu>
3+
4+This program is free software; you can redistribute it and/or modify
5+it under the terms of the GNU General Public License as published by
6+the Free Software Foundation; either version 2 of the License, or
7+(at your option) any later version.
8+
9+This program is distributed in the hope that it will be useful,
10+but WITHOUT ANY WARRANTY; without even the implied warranty of
11+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+GNU General Public License for more details.
13+
14+You should have received a copy of the GNU General Public License
15+along with this program; if not, write to the Free Software
16+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17+-}
18+
19+{- |
20+ Module : Text.Pandoc.Writers.Docbook
21+ Copyright : Copyright (C) 2006 John MacFarlane
22+ License : GNU GPL, version 2 or above
23+
24+ Maintainer : John MacFarlane <jgm at berkeley dot edu>
25+ Stability : alpha
26+ Portability : portable
27+
28+Conversion of 'Pandoc' documents to Docbook XML.
29+-}
30+module Text.Pandoc.Writers.Docbook (
31+ writeDocbook
32+ ) where
33+import Text.Pandoc.Definition
34+import Text.Pandoc.Shared
35+import Text.Pandoc.Writers.HTML ( stringToSmartHtml, stringToHtml )
36+import Text.Html ( stringToHtmlString )
37+import Text.Regex ( mkRegex, matchRegex )
38+import Data.Char ( toLower )
39+import Data.List ( isPrefixOf, partition )
40+import Text.PrettyPrint.HughesPJ hiding ( Str )
41+
42+-- | Data structure for defining hierarchical Pandoc documents
43+data Element = Blk Block
44+ | Sec [Inline] [Element] deriving (Eq, Read, Show)
45+
46+-- | Returns true on Header block with level at least 'level'
47+headerAtLeast :: Int -> Block -> Bool
48+headerAtLeast level (Header x _) = x <= level
49+headerAtLeast level _ = False
50+
51+-- | Convert list of Pandoc blocks into list of Elements (hierarchical)
52+hierarchicalize :: [Block] -> [Element]
53+hierarchicalize [] = []
54+hierarchicalize (block:rest) =
55+ case block of
56+ (Header level title) -> let (thisSection, rest') = break (headerAtLeast level) rest in
57+ (Sec title (hierarchicalize thisSection)):(hierarchicalize rest')
58+ x -> (Blk x):(hierarchicalize rest)
59+
60+-- | Convert list of authors to a docbook <author> section
61+authorToDocbook :: WriterOptions -> [Char] -> Doc
62+authorToDocbook options name = indentedInTags options "author" $
63+ if ',' `elem` name
64+ then -- last name first
65+ let (lastname, rest) = break (==',') name
66+ firstname = removeLeadingSpace rest in
67+ inTags "firstname" (text $ stringToXML options firstname) <>
68+ inTags "surname" (text $ stringToXML options lastname)
69+ else -- last name last
70+ let namewords = words name
71+ lengthname = length namewords
72+ (firstname, lastname) = case lengthname of
73+ 0 -> ("","")
74+ 1 -> ("", name)
75+ n -> (joinWithSep " " (take (n-1) namewords), last namewords) in
76+ inTags "firstname" (text $ stringToXML options firstname) $$
77+ inTags "surname" (text $ stringToXML options lastname)
78+
79+-- | Convert Pandoc document to string in Docbook format.
80+writeDocbook :: WriterOptions -> Pandoc -> String
81+writeDocbook options (Pandoc (Meta title authors date) blocks) =
82+ let head = if (writerStandalone options)
83+ then text (writerHeader options)
84+ else empty
85+ meta = if (writerStandalone options)
86+ then indentedInTags options "articleinfo" $
87+ (inTags "title" (inlinesToDocbook options title)) $$
88+ (vcat (map (authorToDocbook options) authors)) $$
89+ (inTags "date" (text date))
90+ else empty
91+ blocks' = replaceReferenceLinks blocks
92+ (noteBlocks, blocks'') = partition isNoteBlock blocks'
93+ options' = options {writerNotes = noteBlocks}
94+ elements = hierarchicalize blocks''
95+ body = text (writerIncludeBefore options') <>
96+ vcat (map (elementToDocbook options') elements) $$
97+ text (writerIncludeAfter options')
98+ body' = if writerStandalone options'
99+ then indentedInTags options' "article" (meta $$ body)
100+ else body in
101+ render $ head $$ body' <> text "\n"
102+
103+-- | Put the supplied contents between start and end tags of tagType,
104+-- with specified attributes.
105+inTagsWithAttrib :: String -> [(String, String)] -> Doc -> Doc
106+inTagsWithAttrib tagType attribs contents = text ("<" ++ tagType ++
107+ (concatMap (\(a, b) -> " " ++ attributeStringToXML a ++
108+ "=\"" ++ attributeStringToXML b ++ "\"") attribs)) <>
109+ if isEmpty contents
110+ then text " />" -- self-closing tag
111+ else text ">" <> contents <> text ("</" ++ tagType ++ ">")
112+
113+-- | Put the supplied contents between start and end tags of tagType.
114+inTags :: String -> Doc -> Doc
115+inTags tagType contents = inTagsWithAttrib tagType [] contents
116+
117+-- | Put the supplied contents in indented block btw start and end tags.
118+indentedInTags :: WriterOptions -> [Char] -> Doc -> Doc
119+indentedInTags options tagType contents = text ("<" ++ tagType ++ ">") $$
120+ nest 2 contents $$ text ("</" ++ tagType ++ ">")
121+
122+-- | Convert an Element to Docbook.
123+elementToDocbook :: WriterOptions -> Element -> Doc
124+elementToDocbook options (Blk block) = blockToDocbook options block
125+elementToDocbook options (Sec title elements) =
126+ -- Docbook doesn't allow sections with no content, so insert some if needed
127+ let elements' = if null elements
128+ then [Blk (Para [])]
129+ else elements in
130+ indentedInTags options "section" $
131+ inTags "title" (wrap options title) $$
132+ vcat (map (elementToDocbook options) elements')
133+
134+-- | Convert a list of Pandoc blocks to Docbook.
135+blocksToDocbook :: WriterOptions -> [Block] -> Doc
136+blocksToDocbook options = vcat . map (blockToDocbook options)
137+
138+-- | Convert a list of lists of blocks to a list of Docbook list items.
139+listItemsToDocbook :: WriterOptions -> [[Block]] -> Doc
140+listItemsToDocbook options items =
141+ vcat $ map (listItemToDocbook options) items
142+
143+-- | Convert a list of blocks into a Docbook list item.
144+listItemToDocbook :: WriterOptions -> [Block] -> Doc
145+listItemToDocbook options item =
146+ let plainToPara (Plain x) = Para x
147+ plainToPara y = y in
148+ let item' = map plainToPara item in
149+ indentedInTags options "listitem" (blocksToDocbook options item')
150+
151+-- | Convert a Pandoc block element to Docbook.
152+blockToDocbook :: WriterOptions -> Block -> Doc
153+blockToDocbook options Blank = text ""
154+blockToDocbook options Null = empty
155+blockToDocbook options (Plain lst) = wrap options lst
156+blockToDocbook options (Para lst) =
157+ indentedInTags options "para" (wrap options lst)
158+blockToDocbook options (BlockQuote blocks) =
159+ indentedInTags options "blockquote" (blocksToDocbook options blocks)
160+blockToDocbook options (CodeBlock str) =
161+ text "<programlisting>" <> (cdata str) <> text "</programlisting>"
162+blockToDocbook options (BulletList lst) =
163+ indentedInTags options "itemizedlist" $ listItemsToDocbook options lst
164+blockToDocbook options (OrderedList lst) =
165+ indentedInTags options "orderedlist" $ listItemsToDocbook options lst
166+blockToDocbook options (RawHtml str) = text str -- raw XML block
167+blockToDocbook options HorizontalRule = empty -- not semantic
168+blockToDocbook options (Note _ _) = empty -- shouldn't occur
169+blockToDocbook options (Key _ _) = empty -- shouldn't occur
170+blockToDocbook options _ = indentedInTags options "para" (text "Unknown block type")
171+
172+-- | Put string in CDATA section
173+cdata :: String -> Doc
174+cdata str = text $ "<![CDATA[" ++ str ++ "]]>"
175+
176+-- | Take list of inline elements and return wrapped doc.
177+wrap :: WriterOptions -> [Inline] -> Doc
178+wrap options lst = fsep $ map (hcat . (map (inlineToDocbook options))) (splitBySpace lst)
179+
180+-- | Escape a string for XML (with "smart" option if specified).
181+stringToXML :: WriterOptions -> String -> String
182+stringToXML options = if writerSmart options
183+ then stringToSmartHtml
184+ else stringToHtml
185+
186+-- | Escape string to XML appropriate for attributes
187+attributeStringToXML :: String -> String
188+attributeStringToXML = gsub "\"" "&quot;" . codeStringToXML
189+
190+-- | Escape a literal string for XML.
191+codeStringToXML :: String -> String
192+codeStringToXML = gsub "<" "&lt;" . gsub "&" "&amp;"
193+
194+-- | Convert a list of inline elements to Docbook.
195+inlinesToDocbook :: WriterOptions -> [Inline] -> Doc
196+inlinesToDocbook options lst = hcat (map (inlineToDocbook options) lst)
197+
198+-- | Convert an inline element to Docbook.
199+inlineToDocbook :: WriterOptions -> Inline -> Doc
200+inlineToDocbook options (Str str) = text $ stringToXML options str
201+inlineToDocbook options (Emph lst) =
202+ inTags "emphasis" (inlinesToDocbook options lst)
203+inlineToDocbook options (Strong lst) =
204+ inTagsWithAttrib "emphasis" [("role", "strong")]
205+ (inlinesToDocbook options lst)
206+inlineToDocbook options (Code str) =
207+ inTags "literal" $ text (codeStringToXML str)
208+inlineToDocbook options (TeX str) = inlineToDocbook options (Code str)
209+inlineToDocbook options (HtmlInline str) = empty
210+inlineToDocbook options LineBreak =
211+ text $ "<literallayout></literallayout>"
212+inlineToDocbook options Space = char ' '
213+inlineToDocbook options (Link txt (Src src tit)) =
214+ case (matchRegex (mkRegex "mailto:(.*)") src) of
215+ Just [addr] -> inTags "email" $ text (codeStringToXML addr)
216+ Nothing -> inTagsWithAttrib "ulink" [("url", src)] $
217+ inlinesToDocbook options txt
218+inlineToDocbook options (Link text (Ref ref)) = empty -- shouldn't occur
219+inlineToDocbook options (Image alt (Src src tit)) =
220+ let titleDoc = if null tit
221+ then empty
222+ else indentedInTags options "objectinfo" $
223+ indentedInTags options "title"
224+ (text $ stringToXML options tit) in
225+ indentedInTags options "inlinemediaobject" $
226+ indentedInTags options "imageobject" $
227+ titleDoc $$ inTagsWithAttrib "imagedata" [("fileref", src)] empty
228+inlineToDocbook options (Image alternate (Ref ref)) = empty --shouldn't occur
229+inlineToDocbook options (NoteRef ref) =
230+ let notes = writerNotes options
231+ hits = filter (\(Note r _) -> r == ref) notes in
232+ if null hits
233+ then empty
234+ else let (Note _ contents) = head hits in
235+ indentedInTags options "footnote" $ blocksToDocbook options contents
236+inlineToDocbook options _ = empty
src/Text/Pandoc/Writers/HTML.hs+3−1
@@ -28,7 +28,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28Conversion of 'Pandoc' documents to HTML.
28Conversion of 'Pandoc' documents to HTML.
29-}
29-}
30module Text.Pandoc.Writers.HTML (
30module Text.Pandoc.Writers.HTML (
31− writeHtml
31+ writeHtml,
32+ stringToSmartHtml,
33+ stringToHtml
32 ) where
34 ) where
33import Text.Pandoc.Definition
35import Text.Pandoc.Definition
34import Text.Pandoc.Shared
36import Text.Pandoc.Shared
src/headers/DocbookHeadernew file+3
@@ -0,0 +1,3 @@
1+<?xml version="1.0" encoding="utf-8" ?>
2+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3+ "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
src/templates/DefaultHeaders.hs+4
@@ -1,6 +1,7 @@
1-- | Default headers for Pandoc writers.
1-- | Default headers for Pandoc writers.
2module Text.Pandoc.Writers.DefaultHeaders (
2module Text.Pandoc.Writers.DefaultHeaders (
3 defaultLaTeXHeader,
3 defaultLaTeXHeader,
4+ defaultDocbookHeader,
4 defaultHtmlHeader,
5 defaultHtmlHeader,
5 defaultS5Header,
6 defaultS5Header,
6 defaultRTFHeader
7 defaultRTFHeader
@@ -10,6 +11,9 @@ import Text.Pandoc.Writers.S5
10defaultLaTeXHeader :: String
11defaultLaTeXHeader :: String
11defaultLaTeXHeader = "@LaTeXHeader@"
12defaultLaTeXHeader = "@LaTeXHeader@"
12
13
14+defaultDocbookHeader :: String
15+defaultDocbookHeader = "@DocbookHeader@"
16+
13defaultHtmlHeader :: String
17defaultHtmlHeader :: String
14defaultHtmlHeader = "@HtmlHeader@"
18defaultHtmlHeader = "@HtmlHeader@"
15
19
tests/generate.sh+1
@@ -7,4 +7,5 @@
7../pandoc -r native -s -w html -S testsuite.native > writer.smart.html
7../pandoc -r native -s -w html -S testsuite.native > writer.smart.html
8../pandoc -r native -s -w latex testsuite.native > writer.latex
8../pandoc -r native -s -w latex testsuite.native > writer.latex
9../pandoc -r native -s -w rtf testsuite.native > writer.rtf
9../pandoc -r native -s -w rtf testsuite.native > writer.rtf
10+sed -e '/^, Header 1 \[Str "HTML",Space,Str "Blocks"\]/,/^, HorizontalRule/d' testsuite.native | ../pandoc -r native -w docbook -s > writer.docbook
10
11
tests/runtests.pl+5
@@ -52,6 +52,11 @@ foreach my $format (@writeformats)
52 test_results("$format writer", "tmp.$extension", "writer.$format");
52 test_results("$format writer", "tmp.$extension", "writer.$format");
53}
53}
54
54
55+print "Testing docbook writer...";
56+# remove HTML block tests, as this produces invalid docbook...
57+`sed -e '/^, Header 1 \\[Str "HTML",Space,Str "Blocks"\\]/,/^, HorizontalRule/d' testsuite.native | $script -r native -w docbook -s > tmp.docbook`;
58+test_results("docbook writer", "tmp.docbook", "writer.docbook");
59+
55print "Testing s5 writer (basic)...";
60print "Testing s5 writer (basic)...";
56`$script -r native -w s5 -s s5.native > tmp.html`;
61`$script -r native -w s5 -s s5.native > tmp.html`;
57test_results("s5 writer (basic)", "tmp.html", "s5.basic.html");
62test_results("s5 writer (basic)", "tmp.html", "s5.basic.html");
tests/writer.docbooknew file+997
@@ -0,0 +1,997 @@
1+<?xml version="1.0" encoding="utf-8" ?>
2+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3+ "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
4+
5+<article>
6+ <articleinfo>
7+ <title>Pandoc Test Suite</title>
8+ <author>
9+ <firstname>John</firstname>
10+ <surname>MacFarlane</surname>
11+ </author>
12+ <author>
13+ <firstname></firstname>
14+ <surname>Anonymous</surname>
15+ </author>
16+ <date>July 17, 2006</date>
17+ </articleinfo>
18+ <para>
19+ This is a set of tests for pandoc. Most of them are adapted from
20+ John Gruber's markdown test suite.
21+ </para>
22+ <section>
23+ <title>Headers</title>
24+ <section>
25+ <title>Level 2 with an
26+ <ulink url="/url">embedded link</ulink></title>
27+ <section>
28+ <title>Level 3 with <emphasis>emphasis</emphasis></title>
29+ <section>
30+ <title>Level 4</title>
31+ <section>
32+ <title>Level 5</title>
33+ <para>
34+ </para>
35+ </section>
36+ </section>
37+ </section>
38+ </section>
39+ </section>
40+ <section>
41+ <title>Level 1</title>
42+ <section>
43+ <title>Level 2 with <emphasis>emphasis</emphasis></title>
44+ <section>
45+ <title>Level 3</title>
46+ <para>
47+ with no blank line
48+ </para>
49+ </section>
50+ </section>
51+ <section>
52+ <title>Level 2</title>
53+ <para>
54+ with no blank line
55+ </para>
56+ </section>
57+ </section>
58+ <section>
59+ <title>Paragraphs</title>
60+ <para>
61+ Here's a regular paragraph.
62+ </para>
63+ <para>
64+ In Markdown 1.0.0 and earlier. Version 8. This line turns into a
65+ list item. Because a hard-wrapped line in the middle of a paragraph
66+ looked like a list item.
67+ </para>
68+ <para>
69+ Here's one with a bullet. * criminey.
70+ </para>
71+ <para>
72+ There should be a hard line
73+ break<literallayout></literallayout>here.
74+ </para>
75+ </section>
76+ <section>
77+ <title>Block Quotes</title>
78+ <para>
79+ E-mail style:
80+ </para>
81+ <blockquote>
82+ <para>
83+ This is a block quote. It is pretty short.
84+ </para>
85+ </blockquote>
86+ <blockquote>
87+ <para>
88+ Code in a block quote:
89+ </para>
90+ <programlisting><![CDATA[sub status {
91+ print "working";
92+}]]></programlisting>
93+ <para>
94+ A list:
95+ </para>
96+ <orderedlist>
97+ <listitem>
98+ <para>
99+ item one
100+ </para>
101+ </listitem>
102+ <listitem>
103+ <para>
104+ item two
105+ </para>
106+ </listitem>
107+ </orderedlist>
108+ <para>
109+ Nested block quotes:
110+ </para>
111+ <blockquote>
112+ <para>
113+ nested
114+ </para>
115+ </blockquote>
116+ <blockquote>
117+ <para>
118+ nested
119+ </para>
120+ </blockquote>
121+ </blockquote>
122+ <para>
123+ This should not be a block quote: 2 &gt; 1.
124+ </para>
125+ <para>
126+ Box-style:
127+ </para>
128+ <blockquote>
129+ <para>
130+ Example:
131+ </para>
132+ <programlisting><![CDATA[sub status {
133+ print "working";
134+}]]></programlisting>
135+ </blockquote>
136+ <blockquote>
137+ <orderedlist>
138+ <listitem>
139+ <para>
140+ do laundry
141+ </para>
142+ </listitem>
143+ <listitem>
144+ <para>
145+ take out the trash
146+ </para>
147+ </listitem>
148+ </orderedlist>
149+ </blockquote>
150+ <para>
151+ Here's a nested one:
152+ </para>
153+ <blockquote>
154+ <para>
155+ Joe said:
156+ </para>
157+ <blockquote>
158+ <para>
159+ Don't quote me.
160+ </para>
161+ </blockquote>
162+ </blockquote>
163+ <para>
164+ And a following paragraph.
165+ </para>
166+ </section>
167+ <section>
168+ <title>Code Blocks</title>
169+ <para>
170+ Code:
171+ </para>
172+ <programlisting><![CDATA[---- (should be four hyphens)
173+
174+sub status {
175+ print "working";
176+}
177+
178+this code block is indented by one tab]]></programlisting>
179+ <para>
180+ And:
181+ </para>
182+ <programlisting><![CDATA[ this code block is indented by two tabs
183+
184+These should not be escaped: \$ \\ \> \[ \{]]></programlisting>
185+ </section>
186+ <section>
187+ <title>Lists</title>
188+ <section>
189+ <title>Unordered</title>
190+ <para>
191+ Asterisks tight:
192+ </para>
193+ <itemizedlist>
194+ <listitem>
195+ <para>
196+ asterisk 1
197+ </para>
198+ </listitem>
199+ <listitem>
200+ <para>
201+ asterisk 2
202+ </para>
203+ </listitem>
204+ <listitem>
205+ <para>
206+ asterisk 3
207+ </para>
208+ </listitem>
209+ </itemizedlist>
210+ <para>
211+ Asterisks loose:
212+ </para>
213+ <itemizedlist>
214+ <listitem>
215+ <para>
216+ asterisk 1
217+ </para>
218+ </listitem>
219+ <listitem>
220+ <para>
221+ asterisk 2
222+ </para>
223+ </listitem>
224+ <listitem>
225+ <para>
226+ asterisk 3
227+ </para>
228+ </listitem>
229+ </itemizedlist>
230+ <para>
231+ Pluses tight:
232+ </para>
233+ <itemizedlist>
234+ <listitem>
235+ <para>
236+ Plus 1
237+ </para>
238+ </listitem>
239+ <listitem>
240+ <para>
241+ Plus 2
242+ </para>
243+ </listitem>
244+ <listitem>
245+ <para>
246+ Plus 3
247+ </para>
248+ </listitem>
249+ </itemizedlist>
250+ <para>
251+ Pluses loose:
252+ </para>
253+ <itemizedlist>
254+ <listitem>
255+ <para>
256+ Plus 1
257+ </para>
258+ </listitem>
259+ <listitem>
260+ <para>
261+ Plus 2
262+ </para>
263+ </listitem>
264+ <listitem>
265+ <para>
266+ Plus 3
267+ </para>
268+ </listitem>
269+ </itemizedlist>
270+ <para>
271+ Minuses tight:
272+ </para>
273+ <itemizedlist>
274+ <listitem>
275+ <para>
276+ Minus 1
277+ </para>
278+ </listitem>
279+ <listitem>
280+ <para>
281+ Minus 2
282+ </para>
283+ </listitem>
284+ <listitem>
285+ <para>
286+ Minus 3
287+ </para>
288+ </listitem>
289+ </itemizedlist>
290+ <para>
291+ Minuses loose:
292+ </para>
293+ <itemizedlist>
294+ <listitem>
295+ <para>
296+ Minus 1
297+ </para>
298+ </listitem>
299+ <listitem>
300+ <para>
301+ Minus 2
302+ </para>
303+ </listitem>
304+ <listitem>
305+ <para>
306+ Minus 3
307+ </para>
308+ </listitem>
309+ </itemizedlist>
310+ </section>
311+ <section>
312+ <title>Ordered</title>
313+ <para>
314+ Tight:
315+ </para>
316+ <orderedlist>
317+ <listitem>
318+ <para>
319+ First
320+ </para>
321+ </listitem>
322+ <listitem>
323+ <para>
324+ Second
325+ </para>
326+ </listitem>
327+ <listitem>
328+ <para>
329+ Third
330+ </para>
331+ </listitem>
332+ </orderedlist>
333+ <para>
334+ and:
335+ </para>
336+ <orderedlist>
337+ <listitem>
338+ <para>
339+ One
340+ </para>
341+ </listitem>
342+ <listitem>
343+ <para>
344+ Two
345+ </para>
346+ </listitem>
347+ <listitem>
348+ <para>
349+ Three
350+ </para>
351+ </listitem>
352+ </orderedlist>
353+ <para>
354+ Loose using tabs:
355+ </para>
356+ <orderedlist>
357+ <listitem>
358+ <para>
359+ First
360+ </para>
361+ </listitem>
362+ <listitem>
363+ <para>
364+ Second
365+ </para>
366+ </listitem>
367+ <listitem>
368+ <para>
369+ Third
370+ </para>
371+ </listitem>
372+ </orderedlist>
373+ <para>
374+ and using spaces:
375+ </para>
376+ <orderedlist>
377+ <listitem>
378+ <para>
379+ One
380+ </para>
381+ </listitem>
382+ <listitem>
383+ <para>
384+ Two
385+ </para>
386+ </listitem>
387+ <listitem>
388+ <para>
389+ Three
390+ </para>
391+ </listitem>
392+ </orderedlist>
393+ <para>
394+ Multiple paragraphs:
395+ </para>
396+ <orderedlist>
397+ <listitem>
398+ <para>
399+ Item 1, graf one.
400+ </para>
401+ <para>
402+ Item 1. graf two. The quick brown fox jumped over the lazy dog's
403+ back.
404+ </para>
405+ </listitem>
406+ <listitem>
407+ <para>
408+ Item 2.
409+ </para>
410+ </listitem>
411+ <listitem>
412+ <para>
413+ Item 3.
414+ </para>
415+ </listitem>
416+ </orderedlist>
417+ </section>
418+ <section>
419+ <title>Nested</title>
420+ <itemizedlist>
421+ <listitem>
422+ <para>
423+ Tab
424+ </para>
425+ <itemizedlist>
426+ <listitem>
427+ <para>
428+ Tab
429+ </para>
430+ <itemizedlist>
431+ <listitem>
432+ <para>
433+ Tab
434+ </para>
435+ </listitem>
436+ </itemizedlist>
437+ </listitem>
438+ </itemizedlist>
439+ </listitem>
440+ </itemizedlist>
441+ <para>
442+ Here's another:
443+ </para>
444+ <orderedlist>
445+ <listitem>
446+ <para>
447+ First
448+ </para>
449+ </listitem>
450+ <listitem>
451+ <para>
452+ Second:
453+ </para>
454+ <itemizedlist>
455+ <listitem>
456+ <para>
457+ Fee
458+ </para>
459+ </listitem>
460+ <listitem>
461+ <para>
462+ Fie
463+ </para>
464+ </listitem>
465+ <listitem>
466+ <para>
467+ Foe
468+ </para>
469+ </listitem>
470+ </itemizedlist>
471+ </listitem>
472+ <listitem>
473+ <para>
474+ Third
475+ </para>
476+ </listitem>
477+ </orderedlist>
478+ <para>
479+ Same thing but with paragraphs:
480+ </para>
481+ <orderedlist>
482+ <listitem>
483+ <para>
484+ First
485+ </para>
486+ </listitem>
487+ <listitem>
488+ <para>
489+ Second:
490+ </para>
491+ <itemizedlist>
492+ <listitem>
493+ <para>
494+ Fee
495+ </para>
496+ </listitem>
497+ <listitem>
498+ <para>
499+ Fie
500+ </para>
501+ </listitem>
502+ <listitem>
503+ <para>
504+ Foe
505+ </para>
506+ </listitem>
507+ </itemizedlist>
508+ </listitem>
509+ <listitem>
510+ <para>
511+ Third
512+ </para>
513+ </listitem>
514+ </orderedlist>
515+ </section>
516+ <section>
517+ <title>Tabs and spaces</title>
518+ <itemizedlist>
519+ <listitem>
520+ <para>
521+ this is a list item indented with tabs
522+ </para>
523+ </listitem>
524+ <listitem>
525+ <para>
526+ this is a list item indented with spaces
527+ </para>
528+ <itemizedlist>
529+ <listitem>
530+ <para>
531+ this is an example list item indented with tabs
532+ </para>
533+ </listitem>
534+ <listitem>
535+ <para>
536+ this is an example list item indented with spaces
537+ </para>
538+ </listitem>
539+ </itemizedlist>
540+ </listitem>
541+ </itemizedlist>
542+ </section>
543+ </section>
544+ <section>
545+ <title>Inline Markup</title>
546+ <para>
547+ This is <emphasis>emphasized</emphasis>, and so
548+ <emphasis>is this</emphasis>.
549+ </para>
550+ <para>
551+ This is <emphasis role="strong">strong</emphasis>, and so
552+ <emphasis role="strong">is this</emphasis>.
553+ </para>
554+ <para>
555+ An <emphasis><ulink url="/url">emphasized link</ulink></emphasis>.
556+ </para>
557+ <para>
558+ <emphasis role="strong"><emphasis>This is strong and em.</emphasis></emphasis>
559+ </para>
560+ <para>
561+ So is <emphasis role="strong"><emphasis>this</emphasis></emphasis>
562+ word.
563+ </para>
564+ <para>
565+ <emphasis role="strong"><emphasis>This is strong and em.</emphasis></emphasis>
566+ </para>
567+ <para>
568+ So is <emphasis role="strong"><emphasis>this</emphasis></emphasis>
569+ word.
570+ </para>
571+ <para>
572+ This is code: <literal>></literal>, <literal>$</literal>,
573+ <literal>\</literal>, <literal>\$</literal>,
574+ <literal>&lt;html></literal>.
575+ </para>
576+ </section>
577+ <section>
578+ <title>Smart quotes, ellipses, dashes</title>
579+ <para>
580+ "Hello," said the spider. "'Shelob' is my name."
581+ </para>
582+ <para>
583+ 'A', 'B', and 'C' are letters.
584+ </para>
585+ <para>
586+ 'Oak,' 'elm,' and 'beech' are names of trees. So is 'pine.'
587+ </para>
588+ <para>
589+ 'He said, "I want to go."' Were you alive in the 70's?
590+ </para>
591+ <para>
592+ Here is some quoted '<literal>code</literal>' and a
593+ "<ulink url="http://example.com/?foo=1&amp;bar=2">quoted link</ulink>".
594+ </para>
595+ <para>
596+ Some dashes: one---two --- three--four -- five.
597+ </para>
598+ <para>
599+ Dashes between numbers: 5-7, 255-66, 1987-1999.
600+ </para>
601+ <para>
602+ Ellipses...and. . .and . . . .
603+ </para>
604+ </section>
605+ <section>
606+ <title>LaTeX</title>
607+ <itemizedlist>
608+ <listitem>
609+ <para>
610+ <literal>\cite[22-23]{smith.1899}</literal>
611+ </para>
612+ </listitem>
613+ <listitem>
614+ <para>
615+ <literal>\doublespacing</literal>
616+ </para>
617+ </listitem>
618+ <listitem>
619+ <para>
620+ <literal>$2+2=4$</literal>
621+ </para>
622+ </listitem>
623+ <listitem>
624+ <para>
625+ <literal>$x \in y$</literal>
626+ </para>
627+ </listitem>
628+ <listitem>
629+ <para>
630+ <literal>$\alpha \wedge \omega$</literal>
631+ </para>
632+ </listitem>
633+ <listitem>
634+ <para>
635+ <literal>$223$</literal>
636+ </para>
637+ </listitem>
638+ <listitem>
639+ <para>
640+ <literal>$p$</literal>-Tree
641+ </para>
642+ </listitem>
643+ <listitem>
644+ <para>
645+ <literal>$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</literal>
646+ </para>
647+ </listitem>
648+ <listitem>
649+ <para>
650+ Here's one that has a line break in it:
651+ <literal>$\alpha + \omega \times x^2$</literal>.
652+ </para>
653+ </listitem>
654+ </itemizedlist>
655+ <para>
656+ These shouldn't be math:
657+ </para>
658+ <itemizedlist>
659+ <listitem>
660+ <para>
661+ To get the famous equation, write <literal>$e = mc^2$</literal>.
662+ </para>
663+ </listitem>
664+ <listitem>
665+ <para>
666+ $22,000 is a <emphasis>lot</emphasis> of money. So is $34,000. (It
667+ worked if "lot" is emphasized.)
668+ </para>
669+ </listitem>
670+ <listitem>
671+ <para>
672+ Escaped <literal>$</literal>: $73
673+ <emphasis>this should be emphasized</emphasis> 23$.
674+ </para>
675+ </listitem>
676+ </itemizedlist>
677+ <para>
678+ Here's a LaTeX table:
679+ </para>
680+ <para>
681+ <literal>\begin{tabular}{|l|l|}\hline
682+Animal &amp; Number \\ \hline
683+Dog &amp; 2 \\
684+Cat &amp; 1 \\ \hline
685+\end{tabular}</literal>
686+ </para>
687+ </section>
688+ <section>
689+ <title>Special Characters</title>
690+ <para>
691+ Here is some unicode:
692+ </para>
693+ <itemizedlist>
694+ <listitem>
695+ <para>
696+ I hat: Î
697+ </para>
698+ </listitem>
699+ <listitem>
700+ <para>
701+ o umlaut: ö
702+ </para>
703+ </listitem>
704+ <listitem>
705+ <para>
706+ section: §
707+ </para>
708+ </listitem>
709+ <listitem>
710+ <para>
711+ set membership: ∈
712+ </para>
713+ </listitem>
714+ <listitem>
715+ <para>
716+ copyright: ©
717+ </para>
718+ </listitem>
719+ </itemizedlist>
720+ <para>
721+ AT&amp;T has an ampersand in their name.
722+ </para>
723+ <para>
724+ AT&amp;T is another way to write it.
725+ </para>
726+ <para>
727+ This &amp; that.
728+ </para>
729+ <para>
730+ 4 &lt; 5.
731+ </para>
732+ <para>
733+ 6 &gt; 5.
734+ </para>
735+ <para>
736+ Backslash: \
737+ </para>
738+ <para>
739+ Backtick: `
740+ </para>
741+ <para>
742+ Asterisk: *
743+ </para>
744+ <para>
745+ Underscore: _
746+ </para>
747+ <para>
748+ Left brace: {
749+ </para>
750+ <para>
751+ Right brace: }
752+ </para>
753+ <para>
754+ Left bracket: [
755+ </para>
756+ <para>
757+ Right bracket: ]
758+ </para>
759+ <para>
760+ Left paren: (
761+ </para>
762+ <para>
763+ Right paren: )
764+ </para>
765+ <para>
766+ Greater-than: &gt;
767+ </para>
768+ <para>
769+ Hash: #
770+ </para>
771+ <para>
772+ Period: .
773+ </para>
774+ <para>
775+ Bang: !
776+ </para>
777+ <para>
778+ Plus: +
779+ </para>
780+ <para>
781+ Minus: -
782+ </para>
783+ </section>
784+ <section>
785+ <title>Links</title>
786+ <section>
787+ <title>Explicit</title>
788+ <para>
789+ Just a <ulink url="/url/">URL</ulink>.
790+ </para>
791+ <para>
792+ <ulink url="/url/">URL and title</ulink>.
793+ </para>
794+ <para>
795+ <ulink url="/url/">URL and title</ulink>.
796+ </para>
797+ <para>
798+ <ulink url="/url/">URL and title</ulink>.
799+ </para>
800+ <para>
801+ <ulink url="/url/">URL and title</ulink>
802+ </para>
803+ <para>
804+ <ulink url="/url/">URL and title</ulink>
805+ </para>
806+ <para>
807+ <email>nobody@nowhere.net</email>
808+ </para>
809+ <para>
810+ <ulink url="">Empty</ulink>.
811+ </para>
812+ </section>
813+ <section>
814+ <title>Reference</title>
815+ <para>
816+ Foo <ulink url="/url/">bar</ulink>.
817+ </para>
818+ <para>
819+ Foo <ulink url="/url/">bar</ulink>.
820+ </para>
821+ <para>
822+ Foo <ulink url="/url/">bar</ulink>.
823+ </para>
824+ <para>
825+ With <ulink url="/url/">embedded [brackets]</ulink>.
826+ </para>
827+ <para>
828+ <ulink url="/url/">b</ulink> by itself should be a link.
829+ </para>
830+ <para>
831+ Indented <ulink url="/url">once</ulink>.
832+ </para>
833+ <para>
834+ Indented <ulink url="/url">twice</ulink>.
835+ </para>
836+ <para>
837+ Indented <ulink url="/url">thrice</ulink>.
838+ </para>
839+ <para>
840+ This should [not][] be a link.
841+ </para>
842+ <programlisting><![CDATA[[not]: /url]]></programlisting>
843+ <para>
844+ Foo <ulink url="/url/">bar</ulink>.
845+ </para>
846+ <para>
847+ Foo <ulink url="/url/">biz</ulink>.
848+ </para>
849+ </section>
850+ <section>
851+ <title>With ampersands</title>
852+ <para>
853+ Here's a
854+ <ulink url="http://example.com/?foo=1&amp;bar=2">link with an ampersand in the URL</ulink>.
855+ </para>
856+ <para>
857+ Here's a link with an amersand in the link text:
858+ <ulink url="http://att.com/">AT&amp;T</ulink>.
859+ </para>
860+ <para>
861+ Here's an <ulink url="/script?foo=1&amp;bar=2">inline link</ulink>.
862+ </para>
863+ <para>
864+ Here's an
865+ <ulink url="/script?foo=1&amp;bar=2">inline link in pointy braces</ulink>.
866+ </para>
867+ </section>
868+ <section>
869+ <title>Autolinks</title>
870+ <para>
871+ With an ampersand:
872+ <ulink url="http://example.com/?foo=1&amp;bar=2">http://example.com/?foo=1&amp;bar=2</ulink>
873+ </para>
874+ <itemizedlist>
875+ <listitem>
876+ <para>
877+ In a list?
878+ </para>
879+ </listitem>
880+ <listitem>
881+ <para>
882+ <ulink url="http://example.com/">http://example.com/</ulink>
883+ </para>
884+ </listitem>
885+ <listitem>
886+ <para>
887+ It should.
888+ </para>
889+ </listitem>
890+ </itemizedlist>
891+ <para>
892+ An e-mail address: <email>nobody@nowhere.net</email>
893+ </para>
894+ <blockquote>
895+ <para>
896+ Blockquoted:
897+ <ulink url="http://example.com/">http://example.com/</ulink>
898+ </para>
899+ </blockquote>
900+ <para>
901+ Auto-links should not occur here:
902+ <literal>&lt;http://example.com/></literal>
903+ </para>
904+ <programlisting><![CDATA[or here: <http://example.com/>]]></programlisting>
905+ </section>
906+ </section>
907+ <section>
908+ <title>Images</title>
909+ <para>
910+ From "Voyage dans la Lune" by Georges Melies (1902):
911+ </para>
912+ <para>
913+ <inlinemediaobject>
914+ <imageobject>
915+ <objectinfo>
916+ <title>
917+ Voyage dans la Lune
918+ </title>
919+ </objectinfo>
920+ <imagedata fileref="lalune.jpg" />
921+ </imageobject>
922+ </inlinemediaobject>
923+ </para>
924+ <para>
925+ Here is a movie
926+ <inlinemediaobject>
927+ <imageobject>
928+ <imagedata fileref="movie.jpg" />
929+ </imageobject>
930+ </inlinemediaobject>
931+ icon.
932+ </para>
933+ </section>
934+ <section>
935+ <title>Footnotes</title>
936+ <para>
937+ Here is a footnote
938+ reference,<footnote>
939+ <para>
940+ Here is the footnote. It can go anywhere after the footnote
941+ reference. It need not be placed at the end of the document.
942+ </para>
943+ </footnote>
944+ and
945+ another.<footnote>
946+ <para>
947+ Here's the long note. This one contains multiple blocks.
948+ </para>
949+ <para>
950+ Subsequent blocks are indented to show that they belong to the
951+ footnote (as with list items).
952+ </para>
953+ <programlisting><![CDATA[ { <code> }]]></programlisting>
954+ <para>
955+ If you want, you can indent every line, but you can also be lazy
956+ and just indent the first line of each block.
957+ </para>
958+ </footnote>
959+ This should <emphasis>not</emphasis> be a footnote reference,
960+ because it contains a space.[^my note] Here is an inline
961+ note.<footnote>
962+ <para>
963+ This is <emphasis>easier</emphasis> to type. Inline notes may
964+ contain <ulink url="http://google.com">links</ulink> and
965+ <literal>]</literal> verbatim characters.
966+ </para>
967+ </footnote>
968+ </para>
969+ <blockquote>
970+ <para>
971+ Notes can go in
972+ quotes.<footnote>
973+ <para>
974+ In quote.
975+ </para>
976+ </footnote>
977+ </para>
978+ </blockquote>
979+ <orderedlist>
980+ <listitem>
981+ <para>
982+ And in list
983+ items.<footnote>
984+ <para>
985+ In list.
986+ </para>
987+ </footnote>
988+ </para>
989+ </listitem>
990+ </orderedlist>
991+ <para>
992+ This paragraph should not be part of the note, as it is not
993+ indented.
994+ </para>
995+ </section>
996+
997+</article>
web/index.txt+3−2
@@ -4,8 +4,8 @@ Pandoc is a [Haskell] library for converting from one markup format
4to another, and a command-line tool that uses this library. It can read
4to another, and a command-line tool that uses this library. It can read
5[markdown] and (subsets of) [reStructuredText], [HTML], and [LaTeX],
5[markdown] and (subsets of) [reStructuredText], [HTML], and [LaTeX],
6and it can write [markdown], [reStructuredText], [HTML], [LaTeX], [RTF],
6and it can write [markdown], [reStructuredText], [HTML], [LaTeX], [RTF],
7−and [S5] HTML slide shows. Pandoc's version of markdown contains some
7+[DocBook XML], and [S5] HTML slide shows. Pandoc's version of markdown
8−enhancements, like footnotes and embedded LaTeX.
8+contains some enhancements, like footnotes and embedded LaTeX.
9
9
10In contrast to existing tools for converting markdown to HTML, which
10In contrast to existing tools for converting markdown to HTML, which
11use regex substitutions, Pandoc has a modular design: it consists of a
11use regex substitutions, Pandoc has a modular design: it consists of a
@@ -73,6 +73,7 @@ kind.
73[HTML]: http://www.w3.org/TR/html40/
73[HTML]: http://www.w3.org/TR/html40/
74[LaTeX]: http://www.latex-project.org/
74[LaTeX]: http://www.latex-project.org/
75[RTF]: http://en.wikipedia.org/wiki/Rich_Text_Format
75[RTF]: http://en.wikipedia.org/wiki/Rich_Text_Format
76+[DocBook XML]: http://www.docbook.org/
76[Haskell]: http://www.haskell.org/
77[Haskell]: http://www.haskell.org/
77[GHC]: http://www.haskell.org/ghc/
78[GHC]: http://www.haskell.org/ghc/
78[GPL]: http://www.gnu.org/copyleft/gpl.html
79[GPL]: http://www.gnu.org/copyleft/gpl.html
web/mkdemos.sh+1
@@ -16,6 +16,7 @@ pandoc -s README.tex -o example0.txt
16pandoc -s -w rst README -o example0.txt
16pandoc -s -w rst README -o example0.txt
17pandoc -s README -o example0.rtf
17pandoc -s README -o example0.rtf
18pandoc -s -m -i -w s5 S5DEMO -o example0.html
18pandoc -s -m -i -w s5 S5DEMO -o example0.html
19+pandoc -s -w docbook README -o example0.db
19html2markdown http://www.gnu.org/software/make/ -o example0.txt
20html2markdown http://www.gnu.org/software/make/ -o example0.txt
20markdown2pdf README -o example0.pdf
21markdown2pdf README -o example0.pdf
21markdown2pdf -C myheader.tex README -o example0.pdf'
22markdown2pdf -C myheader.tex README -o example0.pdf'