Add support for docs property for BlockNode and TypesNode#4770
Add support for docs property for BlockNode and TypesNode#4770Kocal wants to merge 1 commit intotwigphp:3.xfrom
docs property for BlockNode and TypesNode#4770Conversation
1181325 to
ce52af9
Compare
| $compiler | ||
| ->addDebugInfo($this) | ||
| ->write("/**\n") | ||
| ->write($this->hasAttribute('docs') ? ' * '.str_replace("\n", "\n * ", $this->getAttribute('docs'))."\n" : '') |
stof
left a comment
There was a problem hiding this comment.
With the introduction of the assignment operator, I think this proposal is ambiguous for blocks as {% block content docs="Hello world!" %} is a valid code already, using docs="Hello world!" as the expression (even though assigning a docs variable in that scope is quite useless, as the block is the scope boundary)
|
I think |
|
@Kocal the |
|
Ah I see, I didn't think about this case. Thank you! I've pushed a new commit that look for |
94b4edf to
d1d0374
Compare
d1d0374 to
8918e4d
Compare
|
I want to reiterate that I do not think that |


Close #4768
(Code generated almost entirely using Claude Opus 4.5.)
The following code is now valid (essential parts of our UX Toolkit Shadcn Button component):
{%- types { variant: "'default'|'secondary'|'destructive'|'outline'|'ghost'|'link'" docs="Visual style variant.", size: "'default'|'xs'|'sm'|'lg'|'icon'|'icon-xs'|'icon-sm'|'icon-lg'" docs="The button size.", button: '"button"' docs="The HTML tag to render.", } -%} {%- block content docs="The button label and/or icon" %}{% endblock -%}