Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Under an Upgrading section, the bullets after **Local installs (`sdpm update`).*

### Added

- **`folded_corner` shape** (rebuilt from #150 by @mskt4440). A shape element can use
`"shape": "folded_corner"` (a note with a turned-down corner). The builder writes the
`foldedCorner` preset, the converter reads it back as `folded_corner`, and lint no longer
flags the name. Local mode and the AWS stack (SdpmRuntime).
- **Speaker notes destination** (`deck.json` `"speakerNotes"`, #666). `"pptx"` (the
default, unchanged behaviour) writes each slide's `notes` as speaker notes; `"markdown"`
leaves them out of the .pptx and writes them to `<output stem>.notes.md` beside it (one
Expand Down
2 changes: 1 addition & 1 deletion sdpm/references/guides/slide-json-elements.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Expands an external JSON file's elements array. Draw order is controlled by posi
```json
{
"type": "shape",
"shape": "rectangle|rounded_rectangle|oval|circle|arrow_right|arrow_left|arrow_up|arrow_down|arrow_circular|arrow_left_right|arrow_up_down|arrow_curved_right|arrow_curved_left|arrow_curved_up|arrow_curved_down|arrow_circular_left|arrow_circular_left_right|triangle|diamond|pentagon|hexagon|cross|trapezoid|parallelogram|chevron|donut|arc|block_arc|chord|pie|pie_wedge|cloud|lightning_bolt|star_5_point|no_symbol|callout_rectangle|callout_rounded_rectangle|callout_oval|flowchart_process|flowchart_decision|flowchart_terminator|left_brace|right_brace|left_bracket|right_bracket",
"shape": "rectangle|rounded_rectangle|oval|circle|arrow_right|arrow_left|arrow_up|arrow_down|arrow_circular|arrow_left_right|arrow_up_down|arrow_curved_right|arrow_curved_left|arrow_curved_up|arrow_curved_down|arrow_circular_left|arrow_circular_left_right|triangle|diamond|pentagon|hexagon|cross|trapezoid|parallelogram|chevron|donut|arc|block_arc|chord|pie|pie_wedge|cloud|lightning_bolt|star_5_point|no_symbol|callout_rectangle|callout_rounded_rectangle|callout_oval|flowchart_process|flowchart_decision|flowchart_terminator|left_brace|right_brace|left_bracket|right_bracket|folded_corner",
"x": 192, "y": 216, "width": 576, "height": 162,
"fill": "#FF9900",
"opacity": 0.0-1.0,
Expand Down
1 change: 1 addition & 0 deletions sdpm/sdpm/engine/builder/elements/shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def _add_shape(self, slide, elem):
"right_bracket": MSO_SHAPE.RIGHT_BRACKET,
"cylinder": MSO_SHAPE.CAN,
"math_not_equal": MSO_SHAPE.MATH_NOT_EQUAL,
"folded_corner": MSO_SHAPE.FOLDED_CORNER,
}

mso_shape = shape_map.get(shape_type)
Expand Down
1 change: 1 addition & 0 deletions sdpm/sdpm/engine/converter/elements/shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
'flowChartTerminator': 'flowchart_terminator',
'leftBracket': 'left_bracket', 'rightBracket': 'right_bracket',
'can': 'cylinder', 'mathNotEqual': 'math_not_equal',
'foldedCorner': 'folded_corner',
}

def _resolve_shape_name(shape):
Expand Down
1 change: 1 addition & 0 deletions sdpm/sdpm/engine/schema/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ def _lint_line(si: int, ei: int, elem: dict) -> list[dict]:
"callout_rectangle", "callout_rounded_rectangle", "callout_oval",
"flowchart_process", "flowchart_decision", "flowchart_terminator",
"left_brace", "right_brace", "left_bracket", "right_bracket",
"folded_corner",
}


Expand Down
6 changes: 5 additions & 1 deletion tests/test_element_roundtrip.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,15 @@ def _png(path: Path, size=(400, 200)) -> Path:
class TestShapePresets:
@pytest.mark.parametrize("name", [
"arrow_right", "chevron", "cylinder", "callout_oval", "flowchart_decision",
"star_5_point", "cloud", "left_brace", "pie_wedge",
"star_5_point", "cloud", "left_brace", "pie_wedge", "folded_corner",
])
def test_named_preset_survives(self, tmp_path, name):
assert _one(tmp_path, _shape(shape=name))["shape"] == name

def test_folded_corner_writes_the_ooxml_preset(self, tmp_path):
(sp,) = _built_shapes(tmp_path, [_shape(shape="folded_corner")])
assert sp._element.spPr.find(f"{_A}prstGeom").get("prst") == "foldedCorner"

def test_unknown_name_passes_through_as_raw_preset(self, tmp_path):
# Names outside the friendly map are written verbatim as prstGeom.
(sp,) = _built_shapes(tmp_path, [_shape(shape="heart")])
Expand Down
6 changes: 6 additions & 0 deletions tests/test_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ def test_raw_ooxml_preset_is_not_flagged(self):
]}])
assert not any(d["rule"] == "shape-unknown-name" for d in diags)

def test_folded_corner_is_a_known_name(self):
diags = lint([{"elements": [
{"type": "shape", "shape": "folded_corner", "x": 0, "y": 0, "width": 100, "height": 50}
]}])
assert not any(d["rule"] == "shape-unknown-name" for d in diags)

def test_missing_position(self):
diags = lint([{"elements": [{"type": "shape", "shape": "rectangle", "width": 100}]}])
assert any("missing 'x'" in d["message"] for d in diags)
Expand Down
Loading