diff options
author | Jesse Rosenthal <jrosenthal@jhu.edu> | 2016-11-10 13:15:02 -0500 |
---|---|---|
committer | Jesse Rosenthal <jrosenthal@jhu.edu> | 2016-11-10 13:19:27 -0500 |
commit | eea4d14f602794532b33c1e5a3966fccb5f7ea8b (patch) | |
tree | cbb1ffbd875412d1683f90f4302d05a18c795939 /src/Text/Pandoc/Readers/Docx | |
parent | 7539de02873aa1095a3648e88fb9f5adda86c8fb (diff) | |
download | pandoc-eea4d14f602794532b33c1e5a3966fccb5f7ea8b.tar.gz |
Docx reader: add a placeholder value for CHART.
We wrap `[CHART]` in a `<span class="chart">`. Note that it maps to
inlines because, in docx, anything in a drawing tag can be part of a
larger paragraph.
Diffstat (limited to 'src/Text/Pandoc/Readers/Docx')
-rw-r--r-- | src/Text/Pandoc/Readers/Docx/Parse.hs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/Docx/Parse.hs b/src/Text/Pandoc/Readers/Docx/Parse.hs index 1d7b6088f..80753346b 100644 --- a/src/Text/Pandoc/Readers/Docx/Parse.hs +++ b/src/Text/Pandoc/Readers/Docx/Parse.hs @@ -216,6 +216,7 @@ data ParPart = PlainRun Run | InternalHyperLink Anchor [Run] | ExternalHyperLink URL [Run] | Drawing FilePath String String B.ByteString Extent -- title, alt + | Chart -- placeholder for now | PlainOMath [Exp] deriving Show @@ -223,6 +224,7 @@ data Run = Run RunStyle [RunElem] | Footnote [BodyPart] | Endnote [BodyPart] | InlineDrawing FilePath String String B.ByteString Extent -- title, alt + | InlineChart -- placeholder deriving Show data RunElem = TextRun String | LnBrk | Tab | SoftHyphen | NoBreakHyphen @@ -682,6 +684,13 @@ elemToParPart ns element -- Todo: check out title and attr for deprecated format. Just s -> expandDrawingId s >>= (\(fp, bs) -> return $ Drawing fp "" "" bs Nothing) Nothing -> throwError WrongElem +-- Chart +elemToParPart ns element + | isElem ns "w" "r" element + , Just drawingElem <- findChild (elemName ns "w" "drawing") element + , c_ns <- "http://schemas.openxmlformats.org/drawingml/2006/chart" + , Just _ <- findElement (QName "chart" (Just c_ns) (Just "c")) drawingElem + = return Chart elemToParPart ns element | isElem ns "w" "r" element = elemToRun ns element >>= (\r -> return $ PlainRun r) @@ -779,6 +788,11 @@ childElemToRun ns element (\(fp, bs) -> return $ InlineDrawing fp title alt bs $ elemToExtent element) Nothing -> throwError WrongElem childElemToRun ns element + | isElem ns "w" "drawing" element + , c_ns <- "http://schemas.openxmlformats.org/drawingml/2006/chart" + , Just _ <- findElement (QName "chart" (Just c_ns) (Just "c")) element + = return InlineChart +childElemToRun ns element | isElem ns "w" "footnoteReference" element , Just fnId <- findAttr (elemName ns "w" "id") element = do notes <- asks envNotes |