slim icon indicating copy to clipboard operation
slim copied to clipboard

Custom tags feature

Open Inversion-des opened this issue 8 years ago • 1 comments

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

Inversion-des avatar Jan 08 '18 17:01 Inversion-des

Here is my solution for this: https://github.com/Inversion-des/slim/commit/03a0a714fbe6eecb4c77e65605862b5b3fad2380 Cherry-pick if it is fine, or improve if needed.

Inversion-des avatar Jan 08 '18 17:01 Inversion-des

I wonder, isn't this already supported? See

https://github.com/slim-template/slim/blob/5fec4a314df9faff67791b1e5c1810927ca03194/test/core/test_html_structure.rb#L109-L116

minad avatar Jan 23 '23 19:01 minad