Skip to content

Show the levels set by Phase X in a verbose table - #15

Merged
isaranga merged 1 commit into
mainfrom
phase-x-levels-table
Nov 26, 2026
Merged

isaranga merged 1 commit into
mainfrom
phase-x-levels-table

Conversation

@isaranga

Copy link
Copy Markdown
Owner

Problem

print_table prints "(no changes)" when the Before/After rows match, and Phase X only passed it types. An embedding or isolate without an override changes no types, so the level assignment that X1–X8 makes was never shown. Example 7 (LRI/PDI) printed --- Rule X1-X9 --- (no changes), even though the isolated text moves from level 1 to level 2.

Change

Phase X now prints two tables:

  • X1-X8 (levels): Before is the paragraph level (where X1 starts every character), After is the level X1–X8 assigned.
  • X1-X9 (types): the existing table, renamed. It shows overrides, FSI resolution and X9 turning characters into BN.

Example 7 now shows:

--- Rule X1-X8 (levels) ---
...
Before    |  1   | ... |  1   |  1   |  1   | ... |  1   |  1   |
After     |  1   | ... |  1   |  2   |  2   | ... |  1   |  1   |
...
--- Rule X1-X9 (types) --- (no changes)

Also:

  • apply_explicit_levels docstring now mentions that an FSI's type becomes RLI/LRI (X5c).
  • The "Watch for" notes for examples 6 and 7 in demo.py name the new tables (checked against real output).
  • README.md and CLAUDE.md describe the two Phase X tables. The README tracing example skips Phase X, so it is unchanged.

Testing

  • python tests/run_bidi_tests.py: 91,707 passed, 0 failed
  • python tests/run_bidi_type_tests.py: 770,241 passed, 0 failed
  • python bidi.py --all runs without errors

print_table reports "(no changes)" when the Before/After rows match, and
Phase X only passed it types. An isolate or embedding without an override
changes no types, so the level assignment X1-X8 makes was never shown
(e.g. example 7 printed "Rule X1-X9 (no changes)").

Phase X now prints an "X1-X8 (levels)" table (Before = paragraph level
from X1) next to the renamed "X1-X9 (types)" table. Update the demo notes
for examples 6 and 7, the apply_explicit_levels docstring (FSI type
change), README.md and CLAUDE.md.
@isaranga
isaranga merged commit 2dba9f2 into main Nov 26, 2026
6 checks passed
@isaranga
isaranga deleted the phase-x-levels-table branch November 26, 2026 09:13
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