~dmbaturin/soupault

2 2

HTML.add_attribute and HTML.remove_attribute would be awesome.

Details
Message ID
<ea651c19-8090-8eed-3ce4-cdbcd67ca4ca@aoirthoir.com>
DKIM signature
pass
Download raw message
HTML.add_attribute and HTML.remove_attribute would be awesome.

Basically similar to the add_class, remove_class... had a use case for 
this today...

also something like HTML.clean_tag? or something.. clear_tag?

Essentially stripping out everyhing but the tag name and the content...

<p class="something" style="something" something="something">words</p>

becomes

<p>words</p>
Details
Message ID
<73b1b597-37bc-2264-8806-bc85ea60bee6@baturin.org>
In-Reply-To
<ea651c19-8090-8eed-3ce4-cdbcd67ca4ca@aoirthoir.com> (view parent)
DKIM signature
pass
Download raw message
Hi Aoirthoir,

There is a function for adding attributes actually|, it's used in
site-url and quick-links plugins.||
|
|
|
|HTML.set_attribute(my_link, "rel", "me")|
|
|
|It will create the attribute if doesn't exist yet.
|
|
|
|However, delete_attribute doesn't exist indeed and it's an unfortunate
omission!|
|
|
|I've just added the missing functions to the latest code:|
|
|
|HTML.delete_attribute(elem, name)|
|HTML.list_attributes(elem) -- returns a list of attribute names that
element has|
|HTML.clear_attributes(elem) -- removes all attributes
|

On 4/22/20 9:38 AM, Aoirthoir An Broc wrote:
> HTML.add_attribute and HTML.remove_attribute would be awesome.
>
> Basically similar to the add_class, remove_class... had a use case for
> this today...
>
> also something like HTML.clean_tag? or something.. clear_tag?
>
> Essentially stripping out everyhing but the tag name and the content...
>
> <p class="something" style="something" something="something">words</p>
>
> becomes
>
> <p>words</p>
Details
Message ID
<02a4951e-1c09-dc88-422a-57ad00be5f03@aoirthoir.com>
In-Reply-To
<73b1b597-37bc-2264-8806-bc85ea60bee6@baturin.org> (view parent)
DKIM signature
missing
Download raw message
thanks for the quick response! Ive been using the set_attribute on a 
couple plugins.. the others will be a welcome addition.
Export thread (mbox)