slim
slim copied to clipboard
Custom tags feature
For shortcuts, it would be nice support tags with predefined attributes. Like this:
Slim::Parser.options[:shortcut].update({
'ediv' => {tag:'div', additional_attrs: {contenteditable: 'true'}
})
For render this
ediv#id1.cls
to this:
<div class="cls" contenteditable="true" id="id1"></div>
Currently, such attempt will raise:
ArgumentError: You can only use special characters for attribute shortcuts
Here is my solution for this: https://github.com/Inversion-des/slim/commit/03a0a714fbe6eecb4c77e65605862b5b3fad2380 Cherry-pick if it is fine, or improve if needed.
I wonder, isn't this already supported? See
https://github.com/slim-template/slim/blob/5fec4a314df9faff67791b1e5c1810927ca03194/test/core/test_html_structure.rb#L109-L116