Skip to content

Token discipline: check inline directives ({{NNpt:...}} and {{#HEX:...}}) #135

Description

@ShotaroKataoka

title: "Token discipline: check inline directives ({{NNpt:...}} and {{#HEX:...}})"

Problem

The fontSize token check (#133, follow-up #TBD) only validates fontSize as a JSON key. Font sizes and colors specified via inline directives inside text strings are not checked:

{"type": "textbox", "fontSize": 16, "text": "{{22pt:big}} and {{#FF9900:orange}}"}
  • fontSize: 16 → checked ✓
  • {{22pt:big}} → not checked ✗
  • {{#FF9900:orange}} → not checked ✗

These inline directives are parsed at render time by sdpm.utils.text.parse_styled_text (line 70), which supports:

  • NNpt (font size)
  • #RRGGBB (color)
  • bold, italic, underline
  • font=Name
  • link:URL

Proposed solution

Add a second pass in sdpm/checks/font_size.py (and future color.py) that:

  1. Walks all string values in the slide JSON
  2. Extracts {{attrs:text}} patterns via the same regex used by parse_styled_text
  3. Validates NNpt attrs against --fs-* tokens
  4. Validates #RRGGBB attrs against --color-* / --* color tokens

Can reuse _walk_font_sizes pattern — extend to yield inline occurrences with a location like page02(intro) elements.[0].text:inline.

Scope

  • fontSize in inline directives
  • hex color in inline directives
  • hex color as JSON keys (separate but related — color, fill, fontColor, iconColor, etc.)

References

  • skill/sdpm/utils/text.py:70parse_styled_text docstring
  • skill/sdpm/checks/font_size.py — known limitation comment in _walk_font_sizes
  • skill/references/workflows/slide-json-spec.md:114 — inline directive spec

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions