@@ -100,7 +100,7 @@ data WriterEnv = WriterEnv{ envTextProperties :: [Element]
100 , envInDel :: Bool
100 , envInDel :: Bool
101 , envChangesAuthor :: String
101 , envChangesAuthor :: String
102 , envChangesDate :: String
102 , envChangesDate :: String
103−
103+ , envPrintWidth :: Integer
106defaultWriterEnv :: WriterEnv
106defaultWriterEnv :: WriterEnv
@@ -112,6 +112,7 @@ defaultWriterEnv = WriterEnv{ envTextProperties = []
112 , envInDel = False
112 , envInDel = False
113 , envChangesAuthor = "unknown"
113 , envChangesAuthor = "unknown"
114 , envChangesDate = "1969-12-31T19:00:00Z"
114 , envChangesDate = "1969-12-31T19:00:00Z"
117data WriterState = WriterState{
118data WriterState = WriterState{
@@ -122,7 +123,6 @@ data WriterState = WriterState{
122 , stLists :: [ListMarker]
123 , stLists :: [ListMarker]
123 , stInsId :: Int
124 , stInsId :: Int
124 , stDelId :: Int
125 , stDelId :: Int
125− , stPrintWidth :: Integer
126 , stStyleMaps :: StyleMaps
126 , stStyleMaps :: StyleMaps
127 , stFirstPara :: Bool
127 , stFirstPara :: Bool
128 , stTocTitle :: [Inline]
128 , stTocTitle :: [Inline]
@@ -139,7 +139,6 @@ defaultWriterState = WriterState{
139 , stLists = [NoMarker]
139 , stLists = [NoMarker]
140 , stInsId = 1
140 , stInsId = 1
141 , stDelId = 1
141 , stDelId = 1
143 , stStyleMaps = defaultStyleMaps
142 , stStyleMaps = defaultStyleMaps
144 , stFirstPara = False
143 , stFirstPara = False
145 , stTocTitle = normalizeInlines [Str "Table of Contents"]
144 , stTocTitle = normalizeInlines [Str "Table of Contents"]
@@ -259,8 +258,7 @@ writeDocx opts doc@(Pandoc meta _) = do
259 metaValueToInlines <$> lookupMeta "toc-title" meta
258 metaValueToInlines <$> lookupMeta "toc-title" meta
261 let initialSt = defaultWriterState {
260 let initialSt = defaultWriterState {
262− stPrintWidth = (maybe 420 (\x -> quot x 20) pgContentWidth)
263− , stStyleMaps = styleMaps
261+ stStyleMaps = styleMaps
264 , stTocTitle = tocTitle
262 , stTocTitle = tocTitle
@@ -273,6 +271,7 @@ writeDocx opts doc@(Pandoc meta _) = do
273 envRTL = isRTLmeta
271 envRTL = isRTLmeta
274 , envChangesAuthor = fromMaybe "unknown" username
272 , envChangesAuthor = fromMaybe "unknown" username
275 , envChangesDate = formatTime defaultTimeLocale "%FT%XZ" utctime
273 , envChangesDate = formatTime defaultTimeLocale "%FT%XZ" utctime
274+ , envPrintWidth = (maybe 420 (\x -> quot x 20) pgContentWidth)
@@ -1171,7 +1170,7 @@ inlineToOpenXML' opts (Link _ txt (src,_)) = do
1171 return [ mknode "w:hyperlink" [("r:id",id')] contents ]
1170 return [ mknode "w:hyperlink" [("r:id",id')] contents ]
1172inlineToOpenXML' opts (Image attr alt (src, _)) = do
1171inlineToOpenXML' opts (Image attr alt (src, _)) = do
1173 -- first, check to see if we've already done this image
1172 -- first, check to see if we've already done this image
1174− pageWidth <- gets stPrintWidth
1173+ pageWidth <- asks envPrintWidth
1175 imgs <- gets stImages
1174 imgs <- gets stImages
1176 case M.lookup src imgs of
1175 case M.lookup src imgs of
1177 Just (_,_,_,elt,_) -> return [elt]
1176 Just (_,_,_,elt,_) -> return [elt]