git.iko.soy/typeable/pandoc
on master help sign in
Update Docx writer for 1cb601d reference.docx
commit13daf3ed6a66698722fce7020bb64ee8700b5613 authorNikolay Yakimov <root@livid.pp.ru> dateSun 1 Mar 2015, 18:49 (12 years ago) parent1cb601d
1 file changed+14−13
src/Text/Pandoc/Writers/Docx.hs+14−13
src/Text/Pandoc/Writers/Docx.hs+14−13
@@ -652,16 +652,16 @@ pCustomStyle sty = mknode "w:pStyle" [("w:val",sty)] ()
652652pStyleM :: String -> WS XML.Element
653653pStyleM = flip fmap (gets stParaStyles) . pStyle
654654
655−-- rStyle :: String -> CharStyleMap -> Element
656−-- rStyle sty (CharStyleMap m) = mknode "w:rStyle" [("w:val",sty')] ()
657−-- where
658−-- sty' = getStyleId sty m
655+rStyle :: String -> CharStyleMap -> Element
656+rStyle sty (CharStyleMap m) = mknode "w:rStyle" [("w:val",sty')] ()
657+ where
658+ sty' = getStyleId sty m
659659
660660rCustomStyle :: String -> Element
661661rCustomStyle sty = mknode "w:rStyle" [("w:val",sty)] ()
662662
663−-- rStyleM :: String -> WS XML.Element
664−-- rStyleM = flip fmap (gets stCharStyles) . rStyle
663+rStyleM :: String -> WS XML.Element
664+rStyleM = flip fmap (gets stCharStyles) . rStyle
665665
666666getUniqueId :: MonadIO m => m String
667667-- the + 20 is to ensure that there are no clashes with the rIds
@@ -722,7 +722,7 @@ blockToOpenXML _ (RawBlock format str)
722722 | format == Format "openxml" = return [ x | Elem x <- parseXML str ]
723723 | otherwise = return []
724724blockToOpenXML opts (BlockQuote blocks) = do
725− p <- withParaPropM (pStyleM "Block Quote") $ blocksToOpenXML opts blocks
725+ p <- withParaPropM (pStyleM "Block Text") $ blocksToOpenXML opts blocks
726726 setFirstPara
727727 return p
728728blockToOpenXML opts (CodeBlock attrs str) = do
@@ -866,8 +866,8 @@ withTextProp d p = do
866866 popTextProp
867867 return res
868868
869−-- withTextPropM :: WS Element -> WS a -> WS a
870−-- withTextPropM = (. flip withTextProp) . (>>=)
869+withTextPropM :: WS Element -> WS a -> WS a
870+withTextPropM = (. flip withTextProp) . (>>=)
871871
872872getParaProps :: Bool -> WS [Element]
873873getParaProps displayMathPara = do
@@ -999,8 +999,9 @@ inlineToOpenXML opts (Code attrs str) = do
999999inlineToOpenXML opts (Note bs) = do
10001000 notes <- gets stFootnotes
10011001 notenum <- getUniqueId
1002+ footnoteStyle <- rStyleM "Footnote Reference"
10021003 let notemarker = mknode "w:r" []
1003− [ mknode "w:rPr" [] (rCustomStyle "FootnoteRef")
1004+ [ mknode "w:rPr" [] footnoteStyle
10041005 , mknode "w:footnoteRef" [] () ]
10051006 let notemarkerXml = RawInline (Format "openxml") $ ppElement notemarker
10061007 let insertNoteRef (Plain ils : xs) = Plain (notemarkerXml : ils) : xs
@@ -1017,15 +1018,15 @@ inlineToOpenXML opts (Note bs) = do
10171018 let newnote = mknode "w:footnote" [("w:id", notenum)] $ contents
10181019 modify $ \s -> s{ stFootnotes = newnote : notes }
10191020 return [ mknode "w:r" []
1020− [ mknode "w:rPr" [] (rCustomStyle "FootnoteRef")
1021+ [ mknode "w:rPr" [] footnoteStyle
10211022 , mknode "w:footnoteReference" [("w:id", notenum)] () ] ]
10221023-- internal link:
10231024inlineToOpenXML opts (Link txt ('#':xs,_)) = do
1024− contents <- withTextProp (rCustomStyle "Link") $ inlinesToOpenXML opts txt
1025+ contents <- withTextPropM (rStyleM "Hyperlink") $ inlinesToOpenXML opts txt
10251026 return [ mknode "w:hyperlink" [("w:anchor",xs)] contents ]
10261027-- external link:
10271028inlineToOpenXML opts (Link txt (src,_)) = do
1028− contents <- withTextProp (rCustomStyle "Link") $ inlinesToOpenXML opts txt
1029+ contents <- withTextPropM (rStyleM "Hyperlink") $ inlinesToOpenXML opts txt
10291030 extlinks <- gets stExternalLinks
10301031 id' <- case M.lookup src extlinks of
10311032 Just i -> return i