diff --git a/CLAUDE.md b/CLAUDE.md index e976989..bd13615 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -37,7 +37,7 @@ python tests/run_bidi_type_tests.py [--max-failures N] [--lines START-END] [--fa **Run the demo** (`demo.py`, reached through `bidi.py`): ```bash -python bidi.py # list the seven built-in examples and usage hints +python bidi.py # list the nine built-in examples and usage hints python bidi.py --all # run every example with verbose output python bidi.py --example N # run one example python bidi.py "text" # run your own text diff --git a/README.md b/README.md index f3a7be0..efa390e 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ cd UnicodeBidiAlgorithm python bidi.py ``` -This lists the built-in examples (pure LTR, pure RTL, mixed text with digits, explicit embeddings, isolates, brackets, and two paragraphs) and shows how to run them: +This lists the built-in examples (pure LTR, pure RTL, mixed text with digits, Arabic text with a number, prices and percentages, explicit embeddings, isolates, brackets, and two paragraphs) and shows how to run them: ```bash python bidi.py --example 3 # run one example, printing a table for every rule diff --git a/demo.py b/demo.py index d8b0894..c4b3fa3 100644 --- a/demo.py +++ b/demo.py @@ -38,15 +38,29 @@ "Everything stays at level 0, so L2 leaves the order unchanged.", ), ( - "שלום", - "Pure RTL (Hebrew: shalom)", - "P2 finds R first, so the paragraph is RTL (level 1); L2 reverses the whole string.", + "שָׁלוֹם", + "Pure RTL (Hebrew with nikkud)", + "P2 finds R first, so the paragraph is RTL (level 1); W1 gives each vowel point (NSM) " + "the type of the letter before it (R); L2 reverses the whole string, so each point " + "now comes before its letter (rule L3 leaves fixing that to the renderer).", ), ( "שלום 123 Hi", "Mixed RTL + digits + LTR", "N1 turns the space before the digits into R; I2 raises the digits and Latin letters to level 2.", ), + ( + "سعر 1,000 ريال", + "Arabic text with a number", + "W2 turns the digits into AN because the last strong type before them is AL; " + "W3 then turns AL into R, and W4 makes the comma AN because it sits between two AN.", + ), + ( + "Price: $100, 1.5%", + "Prices and percentages", + "W4 makes the dot in 1.5 EN; W5 makes $ and % EN because they touch a number; " + "W6 makes the other separators ON; W7 turns every EN into L because the last strong type before it is L.", + ), ( "[LRE]Hello שלום[PDF]", "LRE/PDF explicit embedding",