Repository navigation
feat: add <writing_mode> for vertical layout - #202
Open
DanielNg0729 wants to merge 1 commit into
Open
DanielNg0729 wants to merge 1 commit into
DanielNg0729 wants to merge 1 commit into
Conversation
DocLang had no way to declare that lines are vertical, e.g. in Japanese or Chinese text where lines run top to bottom and follow each other from right to left. Add `<writing_mode value="horizontal_tb|vertical_rl|vertical_lr"/>`. In `<head>` it sets the document default. In an element head (after `<layer>`, before `<location>`) it applies to the element and its descendants. Content stays in reading order and `<location>` keeps its coordinate system. Schematron allows at most one `<writing_mode>` in `<head>`. The migration step drops the element, and the token vocabulary gets `<writing_mode value="`. Signed-off-by: Daniel Nguyen <danielnguyenh07@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.
Hi maintainers, this PR adds a way to declare vertical layout (#169). An example is Japanese or Chinese text in vertical lines that follow each other from right to left. This is a first proposal, so I am happy to change the name, the values, or the place of the element.
Proposal
A new empty element,
<writing_mode value="..."/>, follows the pattern of<layer>:horizontal_tb,vertical_rlandvertical_lr. They correspond to the CSSwriting-modevalueshorizontal-tb,vertical-rlandvertical-lr, written in snake_case likeread_only.valueis required. An element without<writing_mode>already inherits a writing mode, so an empty<writing_mode/>would have no use.<head>: the element sets the document default. Schematron allows at most one there.<layer>and before<location>. It applies to the element and its descendants. List items and table cells share the element head, so they can use it too, for example for a vertical header cell in a horizontal table.<writing_mode>takes the writing mode of its nearest ancestor that declares one. Then it takes the document default, and thenhorizontal_tb.<location>keeps its coordinate system (the top-left corner of the page).<rtl>, which still marks right-to-left text in a line. CSS also keepswriting-modeanddirectionseparate.Changes
doclang/doclang.xsd: a newwriting_modeelement, added to theelement_headgroup afterlayer. The global declaration also validates the element inside the lax<head>.doclang/doclang.sch:writing_modeis added to every list of element-head names: element-head placement, list, track, table, picture body, list items, and table cells.head-writing-mode-unique, allows at most onewriting_modein<head>.spec.md:<writing_mode value=".reference/input/reference.xlsx: one newelementsrow and one newattributesrow. No existing row changes.doclang/tokenization.py: a new token,'<writing_mode value="'.doclang/migration/_steps/next.py: the migration step removeswriting_modeand records a "dropped" change for each element.<head>, after<location>, before<layer>, in the body, directly in<doclang>, and twice in<head>.tests/test_migration.py: a new test for the dropped elements and their reported locations.tests/test_validation.py:test_newer_declared_version_falls_back_to_the_released_headexpected the head schema to be identical to the released 0.8 schema. This stops being true with any head change.test_newer_declared_version_falls_back_to_the_head.Issue resolved by this Pull Request:
Resolves #169
Checklist: