git.iko.soy/typeable/pandoc
on master help sign in
Docx writer: Add footnotes id -1 and 0.
ba59e54Jesse Rosenthal
data/reference.docx

Binary file not shown.

src/Text/Pandoc/Writers/Docx.hs+17−1
@@ -114,7 +114,7 @@ defaultWriterState :: WriterState
114defaultWriterState = WriterState{
114defaultWriterState = WriterState{
115 stTextProperties = []
115 stTextProperties = []
116 , stParaProperties = []
116 , stParaProperties = []
117− , stFootnotes = []
117+ , stFootnotes = defaultFootnotes
118 , stSectionIds = []
118 , stSectionIds = []
119 , stExternalLinks = M.empty
119 , stExternalLinks = M.empty
120 , stImages = M.empty
120 , stImages = M.empty
@@ -1073,6 +1073,22 @@ inlineToOpenXML opts (Image alt (src, tit)) = do
1073br :: Element
1073br :: Element
1074br = mknode "w:r" [] [mknode "w:br" [("w:type","textWrapping")] () ]
1074br = mknode "w:r" [] [mknode "w:br" [("w:type","textWrapping")] () ]
1075
1075
1076+-- Word will insert these footnotes into the settings.xml file
1077+-- (whether or not they're visible in the document). If they're in the
1078+-- file, but not in the footnotes.xml file, it will produce
1079+-- problems. So we want to make sure we insert them into our document.
1080+defaultFootnotes :: [Element]
1081+defaultFootnotes = [ mknode "w:footnote"
1082+ [("w:type", "separator"), ("w:id", "-1")] $
1083+ [ mknode "w:p" [] $
1084+ [mknode "w:r" [] $
1085+ [ mknode "w:separator" [] ()]]]
1086+ , mknode "w:footnote"
1087+ [("w:type", "continuationSeparator"), ("w:id", "0")] $
1088+ [ mknode "w:p" [] $
1089+ [ mknode "w:r" [] $
1090+ [ mknode "w:continuationSeparator" [] ()]]]]
1091+
1076parseXml :: Archive -> Archive -> String -> IO Element
1092parseXml :: Archive -> Archive -> String -> IO Element
1077parseXml refArchive distArchive relpath =
1093parseXml refArchive distArchive relpath =
1078 case ((findEntryByPath relpath refArchive `mplus`
1094 case ((findEntryByPath relpath refArchive `mplus`