Repository navigation
fix: make citry check's template match the render for a v-pre element Citry compiles - #526
Merged
Merged
Conversation
Inside v-pre, Vue reads directives as plain attributes and tags as plain elements. Citry's template parser still ran its Vue-only checks there, so v-once, <transition>, or @click.bogus inside v-pre failed to load, and vize compiled <slot>, <component is>, <teleport>, <keep-alive>, and <transition> inside v-pre as live Vue. - The template parser skips the Vue-only checks for an HTML element that carries v-pre or sits inside one, and rejects v-pre written with an argument or modifiers. Citry tags keep their checks, and Vue slot syntax on a component's direct child keeps its check inside v-pre. - vize's S2 lane (patched, now 0.420.0+citry.7) keeps those tags plain inside v-pre and on the element that opens it, and drops `is` from a plain <component>, matching @vue/compiler-dom 3.5.42. - Citry's Vue compiler refuses (V_PRE_NEEDS_S2_LANE) a v-pre template that only vize's fallback lane would compile, since that lane still reads those tags as live (#519), and its metadata walk no longer reports a <slot> or fill under v-pre as an outlet. - v-once and v-memo inside v-pre render as plain attributes; elsewhere they are still refused. - When v-pre sits on a Vue-typed tag whose contents hold Citry values, rendering fails with advice to put v-pre on an element around it. Fixes #515. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… Citry compiles When a v-pre element holds Citry values, a render drops v-pre, writes the contents as one block of HTML that Vue inserts without compiling (or, for textarea, title, script, style, and placements that cannot hold such a block, compiles them as usual), and keeps the v-citry-vue-owned marker. The check template kept v-pre and dropped the marker. It now makes the same decision from the template's nodes and writes the same template; the two decisions point at each other and parity tests keep them in step. A <c-slot> fallback writer now starts from the outer open elements, so a v-pre element in a fallback inside <svg> matches too. Fixes #517. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 28, 2026
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.
Stacked on #525 (
fix/v-pre-plain). Review #525 first; this PR's diff is the one commit on top. It will be retargeted tomainonce #525 merges.What this fixes
citry checkcompiles a Vue template that should match what a render hands to Vue (_vue/static_template.py). For av-preelement Vue reads as written, they match since #514. When Citry compiles av-preelement itself because it holds Citry values, such as<textarea v-pre>{{ title }}</textarea>, they differed (#517):v-pre, keeps thev-citry-vue-ownedmarker, and writes the contents as one block of HTML that Vue inserts without compiling. For textarea, title, script and style, and for placements that cannot hold such a block (tables and their rows or sections, SVG, MathML), it compiles the contents as usual.v-preand dropped the marker.Changes
static_template.pymakes the render's decision from the template's nodes (_v_pre_left_to_vue,_authored_opening,_authored_nodes_only), then writes what the render writes: nov-pre, the marker, and the opaque block or the usual compile. It reuses the render's_TEXT_ONLY_TAGSand_html_block_placement_problem.direct_capture.pygets a docstring note only).<c-slot>fallback writer now starts from the outer open elements, so av-preelement in a fallback inside<svg>matches the render.docs_site/content/ide/template-linting.md: the page said the compile rule checks nesting inside everyv-pre; it now says when it does not.Cases
About 45 templates were compared between the check and the render; 32 differed before this change, and all match now. They include textarea, title, style and script with
{{ }};c-valueon a textarea; ac-attribute or#c-keyon the element or a child;<c-if>,<c-for>,<c-provide>,<c-cache>, and a simple component inside; nestedv-pre;<pre>with a leading newline;<c-raw>;#c-ignorewithv-pre; table, tbody/td, and SVG placements; andv-preinside a fill, inside<c-if>, or in a slot fallback inside<svg>.Ten new parity tests in
test_vue_static_template.py, observed and then locked; all fail on the base revision. The #514 cases still pass.Still different, and written down in the module docstring because the check cannot know them from the template:
v-preelement that renders only plain markup, which the render then leaves to Vue;c-attribute whose value isNoneorFalse, which writes no attribute;css_data()needs, which the check never models.Tests
Run with this commit on top of #525: the citry and Citry UI suites pass (13,707). The one failing test, a Citry UI type-check test, fails only in my local environment (
ty0.0.90 there; main needs 0.0.91). ruff and mypy (also--platform linux) are clean. Two independent reviews ran, each with a separate prose pass.No CHANGELOG entry: the Vue compile rule and
static_template.pyare not in a released version yet.Fixes #517.
🤖 Generated with Claude Code