Docx Reader: Parse soft, no-break hyphen elements
This commit is contained in:
parent
6d0e586b2d
commit
0b899ce7ef
2 changed files with 7 additions and 1 deletions
|
@ -206,11 +206,15 @@ runElemToInlines :: RunElem -> Inlines
|
|||
runElemToInlines (TextRun s) = text s
|
||||
runElemToInlines (LnBrk) = linebreak
|
||||
runElemToInlines (Tab) = space
|
||||
runElemToInlines (SoftHyphen) = text "\xad"
|
||||
runElemToInlines (NoBreakHyphen) = text "\x2011"
|
||||
|
||||
runElemToString :: RunElem -> String
|
||||
runElemToString (TextRun s) = s
|
||||
runElemToString (LnBrk) = ['\n']
|
||||
runElemToString (Tab) = ['\t']
|
||||
runElemToString (SoftHyphen) = ['\xad']
|
||||
runElemToString (NoBreakHyphen) = ['\x2011']
|
||||
|
||||
runToString :: Run -> String
|
||||
runToString (Run _ runElems) = concatMap runElemToString runElems
|
||||
|
|
|
@ -208,7 +208,7 @@ data Run = Run RunStyle [RunElem]
|
|||
| InlineDrawing FilePath B.ByteString
|
||||
deriving Show
|
||||
|
||||
data RunElem = TextRun String | LnBrk | Tab
|
||||
data RunElem = TextRun String | LnBrk | Tab | SoftHyphen | NoBreakHyphen
|
||||
deriving Show
|
||||
|
||||
data VertAlign = BaseLn | SupScrpt | SubScrpt
|
||||
|
@ -877,6 +877,8 @@ elemToRunElem ns element
|
|||
map (\x -> fromMaybe x . getUnicode f . lowerFromPrivate $ x) str
|
||||
| isElem ns "w" "br" element = return LnBrk
|
||||
| isElem ns "w" "tab" element = return Tab
|
||||
| isElem ns "w" "softHyphen" element = return SoftHyphen
|
||||
| isElem ns "w" "noBreakHyphen" element = return NoBreakHyphen
|
||||
| isElem ns "w" "sym" element = return (getSymChar ns element)
|
||||
| otherwise = throwError WrongElem
|
||||
where
|
||||
|
|
Loading…
Reference in a new issue