@@ -960,12 +960,22 @@ parseBlock (Elem e) =
960960 let aligns = case colspecs of
961961 [] -> replicate numrows AlignDefault
962962 cs -> map toAlignment cs
963+ let parseWidth s = safeRead (T.filter (\x -> (x >= '0' && x <= '9')
964+ || x == '.') s)
965+ let textWidth = case filterChild (named "?dbfo") e of
966+ Just d -> case attrValue "table-width" d of
967+ "" -> 1.0
968+ w -> fromMaybe 100.0 (parseWidth w) / 100.0
969+ Nothing -> 1.0
963970 let widths = case colspecs of
964971 [] -> replicate numrows ColWidthDefault
965972 cs -> let ws = map toWidth cs
966973 in case sequence ws of
967− Just ws' -> let tot = sum ws'
968− in ColWidth . (/ tot) <$> ws'
974+ Just ws' -> let colTot = sum ws'
975+ scale
976+ | textWidth == 1.0 = (/ colTot)
977+ | otherwise = (* (textWidth / colTot) )
978+ in ColWidth . scale <$> ws'
969979 Nothing -> replicate numrows ColWidthDefault
970980 let toRow = Row nullAttr
971981 toHeaderRow l = [toRow l | not (null l)]