aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/Docx
diff options
context:
space:
mode:
authorEzwal <15009992+Ezwal@users.noreply.github.com>2021-09-29 15:42:37 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2021-09-30 12:44:44 -0700
commit472b33095e1feb42fa96e32271888a3152e36cea (patch)
tree8d031c636ed37566a913e0d75d5252109d54a6f5 /src/Text/Pandoc/Readers/Docx
parent45db998b397b7d8b38bf28d73f4e6455be420ea4 (diff)
downloadpandoc-472b33095e1feb42fa96e32271888a3152e36cea.tar.gz
Docx reader: Add placeholder for word diagram
Diffstat (limited to 'src/Text/Pandoc/Readers/Docx')
-rw-r--r--src/Text/Pandoc/Readers/Docx/Parse.hs14
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 eb048ab14..5f29ac41a 100644
--- a/src/Text/Pandoc/Readers/Docx/Parse.hs
+++ b/src/Text/Pandoc/Readers/Docx/Parse.hs
@@ -322,6 +322,7 @@ data ParPart = PlainRun Run
| ExternalHyperLink URL [Run]
| Drawing FilePath T.Text T.Text B.ByteString Extent -- title, alt
| Chart -- placeholder for now
+ | Diagram -- placeholder for now
| PlainOMath [Exp]
| Field FieldInfo [Run]
| NullParPart -- when we need to return nothing, but
@@ -333,6 +334,7 @@ data Run = Run RunStyle [RunElem]
| Endnote [BodyPart]
| InlineDrawing FilePath T.Text T.Text B.ByteString Extent -- title, alt
| InlineChart -- placeholder
+ | InlineDiagram -- placeholder
deriving Show
data RunElem = TextRun T.Text | LnBrk | Tab | SoftHyphen | NoBreakHyphen
@@ -821,6 +823,13 @@ elemToParPart ns element
, Just imagedataElem <- findChildByName ns "v" "imagedata" shapeElem
, Just drawingId <- findAttrByName ns "r" "id" imagedataElem
= expandDrawingId drawingId >>= (\(fp, bs) -> return $ Drawing fp "" "" bs Nothing)
+-- Diagram
+elemToParPart ns element
+ | isElem ns "w" "r" element
+ , Just drawingElem <- findChildByName ns "w" "drawing" element
+ , d_ns <- "http://schemas.openxmlformats.org/drawingml/2006/diagram"
+ , Just _ <- findElement (QName "relIds" (Just d_ns) (Just "dgm")) drawingElem
+ = return Diagram
-- Chart
elemToParPart ns element
| isElem ns "w" "r" element
@@ -988,6 +997,11 @@ childElemToRun ns element
, Just _ <- findElement (QName "chart" (Just c_ns) (Just "c")) element
= return InlineChart
childElemToRun ns element
+ | isElem ns "w" "drawing" element
+ , c_ns <- "http://schemas.openxmlformats.org/drawingml/2006/diagram"
+ , Just _ <- findElement (QName "relIds" (Just c_ns) (Just "dgm")) element
+ = return InlineDiagram
+childElemToRun ns element
| isElem ns "w" "footnoteReference" element
, Just fnId <- findAttrByName ns "w" "id" element = do
notes <- asks envNotes