Skip to content

Commit

Permalink
try again from first principles
Browse files Browse the repository at this point in the history
  • Loading branch information
erdos committed May 14, 2024
1 parent 9246967 commit 88f5bea
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 3 deletions.
36 changes: 35 additions & 1 deletion docs/DeveloperTroubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,39 @@ Problem: The zip entry paths mut not contain a `../` part.
+-----------------+
| word/styles.xml | > shared across all
+-----------------+
```

## OOXML Presentation Model

- Entry point is the same `.rels` file and main document is usually `ppt/_rels/presentation.xml`
- Main document references both `slide` and `slideMaster` and `theme`
- SlideMaster references `slideLayout` (and `theme`) pages
- Slide references `slideLayout` pages
- Theme page has no references
- SlideLayout references SlideMaster pages
- circular reference there!

```
+-------------+
| _rels/.rels | < this is the entry point
+-------------+
| ┌───────────────► /ppt/presProps.xml
v │
┌─────────────────────┐ │
│/ppt/presentation.xml├─────┬────────┬────────┬──┴───────────────► /ppt/theme/theme1.xml
└─────────────────────┘ │ │ │ ▲
│ │ ▼ │
│ │ ┌────────────────────────────┴─────┐
│ │ │/ppt/slideMasters/slideMaster1.xml├────────┐
│ │ └──────────────────────────────────┘ │
│ ▼ ▲ │
│ ┌──────────────────────────────────┐ │ ▼
│ │/ppt/slideMasters/slideMaster2.xml│ │ ┌──────────────────────────────────┐
│ └──────────────────────────────────┘ └─┤/ppt/slideLayouts/slideLayout1.xml│
▼ └──────────────────────────────────┘
┌──────────────────────┐ ▲
│/ppt/slides/slide1.xml├────────────────────────────────────────┘
├──────────────────────┤
│/ppt/slides/slide2.xml│
└──────────────────────┘
```
14 changes: 12 additions & 2 deletions src/stencil/model/relations.clj
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,22 @@
(def rel-type-header
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header")

;; PPTX

(def rel-type-slide
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide")

(def extra-relations
#{rel-type-footer rel-type-header rel-type-slide})
(def rel-type-slide-master
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster")

(def rel-type-slide-layout
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout")

(def rel-type-theme
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme")

(def extra-relations
#{rel-type-footer rel-type-header rel-type-slide rel-type-slide-master})

(defn- parse [rel-file]
(with-open [reader (io/input-stream (file rel-file))]
Expand Down

0 comments on commit 88f5bea

Please sign in to comment.