aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-04-14 21:50:06 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-04-14 21:50:06 -0700
commite5c4d7002eb5b9c73211186f5f15a82c2731fe31 (patch)
tree184b214f5218e1c9d5e7d5aeb4a5c58facf73beb /src/Text/Pandoc
parentf0a1760d41f206eec99b44199e99db046def4d08 (diff)
downloadpandoc-e5c4d7002eb5b9c73211186f5f15a82c2731fe31.tar.gz
Implemented quoted in docbook reader.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/DocBook.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/DocBook.hs b/src/Text/Pandoc/Readers/DocBook.hs
index 53260e279..a4f0ee9c4 100644
--- a/src/Text/Pandoc/Readers/DocBook.hs
+++ b/src/Text/Pandoc/Readers/DocBook.hs
@@ -12,6 +12,7 @@ import Control.Applicative ((<$>))
type DB = State DBState
data DBState = DBState{ dbSectionLevel :: Int
+ , dbQuoteType :: QuoteType
, dbDocTitle :: Inlines
, dbDocAuthors :: [Inlines]
, dbDocDate :: Inlines
@@ -24,6 +25,7 @@ readDocBook st inp = setTitle (dbDocTitle st')
$ doc $ mconcat bs
where (bs, st') = runState (mapM parseBlock $ parseXML inp)
DBState{ dbSectionLevel = 0
+ , dbQuoteType = DoubleQuote
, dbDocTitle = mempty
, dbDocAuthors = []
, dbDocDate = mempty
@@ -95,6 +97,15 @@ parseInline (Elem e) =
case qName (elName e) of
"subscript" -> subscript <$> innerInlines
"superscript" -> superscript <$> innerInlines
+ "quote" -> do
+ qt <- gets dbQuoteType
+ let qt' = if qt == SingleQuote then DoubleQuote else SingleQuote
+ modify $ \st -> st{ dbQuoteType = qt' }
+ contents <- innerInlines
+ modify $ \st -> st{ dbQuoteType = qt }
+ return $ if qt == SingleQuote
+ then singleQuoted contents
+ else doubleQuoted contents
"ulink" -> link
(fromMaybe "" (lookupAttrBy (\attr -> qName attr == "url")
(elAttribs e))) "" <$> innerInlines