Repository navigation
style: put each attribute of a Citry UI snippet tag on its own line - #345
Merged
Merged
Conversation
Part of #141 (snippets). In the Citry UI docs snippets, a template tag with more than two attributes that sat on one line, or put two attributes on one line, now has one attribute per line. The closing `>` or `/>` starts its own line at the tag's indent, as CLAUDE.md asks for template strings. 373 tags in 260 snippet files change: - 363 tags in triple-quoted templates, rewritten by a script that changes only the whitespace between a start tag's attributes. - 9 one-line templates written as single-quoted or parenthesized strings become triple-quoted multiline templates, and the ctree_grid custom_cells template is reflowed onto separate lines. - The carousel `controlled` template, flattened onto one line, is reflowed so each element starts its own line, which expands its CCarousel tag. The `# ruff: noqa: E501` comment is removed from the 24 files that no longer have a line over 119 characters; 18 files keep it for other long lines. 48 tags keep their compact form: 36 follow another tag on the same line and 12 follow text on the same line (for example `<label>Email <input ... />`). Breaking those lines adds whitespace inside the parent element, and snippets rendered without Vue keep that whitespace in their output. The cbreadcrumbs customization template stays single-quoted for the same reason. Several templates are still flattened onto one line (cnavigation_menu variants, ccolor_picker formats and native_form, ccarousel variants, ctree_grid controlled); reflowing them is left to a follow-up. Proof: every snippet and quality scenario (716 pages) was rendered on origin/main and on this commit. After replacing the per-render random ids, everything outside the embedded Vue document manifest (the JSON that tells the browser which compiled Vue definitions to load) is byte-identical on all 716 pages, and 485 pages are identical in full. On the others, the manifests differ only in values Citry computes from a tag's position in the template source: `sourceStart`/`sourceEnd` offsets, ids hashed from those positions, and the content hashes of the definitions that carry them. With those replaced by placeholders, and lists compared without regard to order (some lists are sorted by these ids), the manifests are equal. The compiled Vue render code of the 562 snippet pages that load definitions is also equal under the same mapping. Co-Authored-By: Claude Opus 5.5 <[email protected]>
2 tasks
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.
Part of #141: the snippet tag layout. Quality scenarios and runtime templates follow in a second PR, and the multiline
:on*handlers in a third.What changes
In the Citry UI docs snippets, a template tag with more than two attributes now has one attribute per line, with the closing
>or/>on its own line at the tag's indent (the CLAUDE.md template rule). This applies to tags that sat on one line or put two attributes on one line. 373 tags in 260 files change:ctree_grid/custom_cellstemplate is reflowed onto separate lines.ccarousel/controlled. This template was flattened onto one line; it is reflowed so each element starts its own line.noqacomments.# ruff: noqa: E501is removed from the 24 files that no longer need it.Proof that rendering is unchanged
I rendered every snippet and quality scenario on
origin/mainand on this branch: 716 pages, plus the compiled Vue definitions each snippet page loads. Render ids are made deterministic, and the per-render random app ids and signed state tokens are normalized.sourceStart/sourceEnd, ids hashed from those positions, and the content hashes of definitions that carry them.ctour/targeted. Its two tour steps have the same shape, so the mapping search can't tell them apart; it passes a structural check.cbreadcrumbs/customizationandcskeleton/motionrender without Vue, so whitespace added between their elements reaches the HTML.Kept compact, on purpose
Breaking these lines would add whitespace inside the parent element, and snippets rendered without Vue keep that whitespace in their output.
cdate_picker/snippets/form.py:16,cdate_picker/snippets/placement.py:13,cdate_picker/snippets/states.py:16,cdate_picker/snippets/states.py:17,cnavigation_menu/snippets/variants.py:11,cskeleton/snippets/motion.py:21,cslider/snippets/marks.py:13,ctree_grid/snippets/controlled.py:21,cdate_input/snippets/birthday.py:15,cdate_input/snippets/bounds.py:17,ccolor_picker/snippets/formats.py:10,ccolor_picker/snippets/formats.py:10,ccolor_picker/snippets/native_form.py:10,ccarousel/snippets/variants.py:11,cpin_input/snippets/alphanumeric.py:15,ccalendar/snippets/natural_weeks.py:16,ccalendar/snippets/form.py:17,ccalendar/snippets/locales.py:16,ccalendar/snippets/states.py:15,ccalendar/snippets/states.py:16,ccalendar/snippets/states.py:17,ccalendar/snippets/states.py:18,cdate_range/snippets/form.py:12,cdate_range/snippets/locales.py:13,cdate_range/snippets/states.py:12,cdate_range/snippets/states.py:13,cdate_range/snippets/states.py:14,cdate_range/snippets/states.py:15,cnumber_input/snippets/forms.py:13,cnumber_input/snippets/constraints.py:10,cnumber_input/snippets/constraints.py:15,cprogress/snippets/intents.py:13,cprogress/snippets/customization.py:10,cprogress/snippets/customization.py:11,ctime_picker/snippets/form.py:12,ctime_picker/snippets/basic.py:12cvirtual_list/snippets/controlled.py:12,cvirtual_list/snippets/controlled.py:13,ccommand_palette/snippets/form_safe_palette.py:29,ctime_input/snippets/constraints.py:12,ctime_input/snippets/constraints.py:13,ctime_input/snippets/states.py:11,ctime_input/snippets/states.py:12,cprogress/snippets/controlled.py:16,cform_collection/snippets/field_groups.py:19,cform_collection/snippets/field_groups.py:23,cform_collection/snippets/server_actions.py:31,cform_collection/snippets/at_a_glance.py:17cbreadcrumbs/customizationstays single-quoted for the same reason.These templates are still flattened onto one line, and reflowing them is left to a follow-up:
cnavigation_menu/variants,ccolor_picker/formats,ccolor_picker/native_form,ccarousel/variants, andctree_grid/controlled.Evidence
packages/py/citry_uitests pass (3114 passed,not e2e), as do the real docs build guard suite, ruff, ruff format, and the validators. The cargo phases are left to PR CI.🤖 Generated with Claude Code