Skip to content

OCTO-11513: Re-emit STYLE blocks and writing direction on VTT→VTT#387

Merged
OlteanuRares merged 5 commits into
mainfrom
OCTO-11513
Jul 13, 2026
Merged

OCTO-11513: Re-emit STYLE blocks and writing direction on VTT→VTT#387
OlteanuRares merged 5 commits into
mainfrom
OCTO-11513

Conversation

@OlteanuRares

@OlteanuRares OlteanuRares commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • WebVTT writer now re-emits STYLE blocks when the CaptionSet originated from a VTT source (detected via ::cue marker key)
  • Writer emits vertical:rl / vertical:lr from Layout.writing_direction when passthrough positioning isn't available
  • Refactored monolithic pycaption/webvtt.py (1200 lines) into a pycaption/webvtt/ package (reader, writer, constants) — public API unchanged

Changes

  • writer.py — new _build_style_block() emits global ::cue before class-specific rules; _convert_positioning() emits vertical setting

  • reader.py — inserts ::cue marker in _parse_style_blocks() to signal VTT origin to the writer

  • geometry.pyas_percentage_of() and fit_to_screen() now preserve writing_direction

  • pycaption/webvtt.pypycaption/webvtt/ package (__init__.py, constants.py, reader.py, writer.py)

  • writer.py — _format_css_declarations() reverse-maps internal keys (italics → font-style: italic) so STYLE blocks with font-style/font-weight/text-decoration emit valid CSS instead of internal representations like italics: True

Safety

  • SCC/DFXP/SAMI inputs are unaffected — they produce no ::cue key, so _build_style_block() returns empty
  • No duplicate positioning — passthrough short-circuits before Layout-based reconstruction
  • 7 new tests cover: STYLE round-trip, global + class ordering, writing direction, passthrough dedup, regression (plain cue), cross-format filtering (SAMI, SCC)
  • Double round-trip is stable (read→write→read→write produces identical output)

Test plan

  • Full test suite passes (421 tests)
  • WebVTT-specific tests pass (136 tests)
  • from pycaption import WebVTTReader, WebVTTWriter still works
  • SCC→VTT produces no STYLE block
  • DFXP→VTT produces no STYLE block
  • Multiple STYLE blocks merge correctly
  • Empty STYLE block produces no output
  • ::cue { font-style: italic; color: white } round-trips as valid CSS (not italics: True)
  • ::cue(.class) { font-style: italic; color: red } preserves both properties

@OlteanuRares
OlteanuRares requested a review from a team as a code owner July 9, 2026 16:27
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

🔴 PR Compliance Review

Risk Level: HIGH

  • Compliance Issues: 0 (3 critical)
  • Regressions: 3

DO NOT MERGE - Critical issues must be fixed first

Full report available in workflow artifacts

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

🔴 PR Compliance Review

Risk Level: HIGH

  • Compliance Issues: 0 (3 critical)
  • Regressions: 3

DO NOT MERGE - Critical issues must be fixed first

Full report available in workflow artifacts

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

🔴 PR Compliance Review

Risk Level: HIGH

  • Compliance Issues: 0 (3 critical)
  • Regressions: 3

DO NOT MERGE - Critical issues must be fixed first

Full report available in workflow artifacts

…-style: italic)

  - check-last-pr skill no longer flags module splits as removed API or existing tests as missing
  - Changelog and version bump to 2.2.29.dev1
@github-actions

Copy link
Copy Markdown

🟡 PR Compliance Review

Risk Level: MEDIUM

  • Compliance Issues: 0 (0 critical)
  • Regressions: 0

REVIEW REQUIRED - Address issues before merging

Full report available in workflow artifacts

@OlteanuRares
OlteanuRares merged commit 1a58fd9 into main Jul 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants