feat: native v5 alphabet XML format support (RFC 0005) - #31
Merged
Conversation
Dasher v5 shipped for 10+ years with a different alphabet XML schema. The AlphIO parser now accepts both v5 and v6 formats directly in DasherCore, so all frontends (Apple/Windows/GTK) benefit without a frontend-side converter. Changes in AlphIO.cpp (all inline in Parse()/ReadCharAttributes — no function split, per the PR #28 postmortem): - Handle <alphabets> root wrapper (extract first <alphabet> child) - Recognise v5 <s> elements alongside v6 <node> - Map v5 attributes: d->Display, t->Text fallbacks - Default text actions for <s> elements (no action children) - Default colorGroup to 'lowercase' for v5 groups (no colorInfoName) - Read <train>/<palette> child elements as metadata fallbacks Critical fix beyond the original 6 changes: v5 alphabets never overwrite an existing alphabet with the same AlphID. The bundled oldAlphabets/ directory contains ~120 v5-format files (previously silently rejected) that share names with v6 alphabets — e.g. alphabet.english.xml is also named 'English with limited punctuation'. Without this guard, the v5 version clobbers the v6 default, losing the space character (the exact regression PR #28 hit for different reasons). Tests (test_alphabet_xml.cpp): - alphabet_v6_space_character_resolves_to_space: regression guard for the space character (label 'square', unicode 32) - alphabet_v5_format_loads: <alphabets> root + <s> symbols load - alphabet_v5_symbols_have_correct_text: display/text split + emoji - alphabet_v5_metadata_from_child_elements: <train>/<palette> read All 31 tests pass on Linux (clang/Debug). Full suite green. Signed-off-by: will wade <willwade@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dasher v5 shipped for 10+ years with a different alphabet XML schema. The AlphIO parser now accepts both v5 and v6 formats directly in DasherCore, so all frontends (Apple/Windows/GTK) benefit without a frontend-side converter.
Changes in AlphIO.cpp (all inline in Parse()/ReadCharAttributes — no function split, per the PR #28 postmortem):
elements alongside v6elements (no action children)Critical fix beyond the original 6 changes: v5 alphabets never overwrite an existing alphabet with the same AlphID. The bundled oldAlphabets/ directory contains ~120 v5-format files (previously silently rejected) that share names with v6 alphabets — e.g. alphabet.english.xml is also named 'English with limited punctuation'. Without this guard, the v5 version clobbers the v6 default, losing the space character (the exact regression PR #28 hit for different reasons).
Tests (test_alphabet_xml.cpp):
symbols loadAll 31 tests pass on Linux (clang/Debug). Full suite green.