Skip to content

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

Open
OlteanuRares wants to merge 4 commits into
mainfrom
OCTO-11513
Open

OCTO-11513: Re-emit STYLE blocks and writing direction on VTT→VTT#387
OlteanuRares wants to merge 4 commits into
mainfrom
OCTO-11513

Conversation

@OlteanuRares

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)

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)

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

@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

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.

1 participant