Map template attribute size="#" => width="#ex" to avoid conflict with Shoelace size attribute

This commit is contained in:
nathan 2022-07-21 11:32:37 -06:00
parent 39a3ef8183
commit e4f8c88e1e

View File

@ -183,6 +183,12 @@ function send_template()
) . "></$tag>"; ) . "></$tag>";
}, $str); }, $str);
// Change size=# attribute to width, size is small|medium|large with shoelace
$str = preg_replace_callback('#<([^/>]+) size="([[:digit:]]+)"([^/>]+?)/>#su', static function ($matches)
{
return "<{$matches[1]} width=\"{$matches[2]}ex\" {$matches[3]}/>";
}, $str);
// handling of select and taglist widget, incl. removing of type attribute // handling of select and taglist widget, incl. removing of type attribute
$str = preg_replace_callback('#<(select|taglist|listbox)(-[^ ]+)? ([^>]+?)(/|>(.*?)</select)>#s', static function (array $matches) { $str = preg_replace_callback('#<(select|taglist|listbox)(-[^ ]+)? ([^>]+?)(/|>(.*?)</select)>#s', static function (array $matches) {