I have several H2s that I would like to add HRs after. It works for the first one when using the insert_html widget but i dont know how to get it to work for all H2s.
On 4/6/20 2:15 PM, firstname.lastname@example.org wrote: > I have several H2s that I would like to add HRs after. It works for > the first one when using the insert_html widget but i dont know how to > get it to work for all H2s. > There is no simple answer. I can be done with a custom plugin, like: ``` h2s = HTML.select(page, "h2") count = size(h2s) index = 1 while (index <= count) do HTML.insert_after(h2s[index], HTML.create_element("hr")) index = index + 1 end ``` However, I think it may be a good idea to add an option to insert something after every element in the next version. After all, the delete_element widget does have an option to delete all elements or only the first.
I will experiment with this. I think I will create a plugin that is a replacement for insert_html in the way that you mention in the documentation on plugins. Your comment also got me thinking that maybe all the widgets that you have that are even inbuilt should just be plugins. This will allow more rapid changes to those. Since you are about to work on a new rewrite of the code this might be something to consider. If I get the plugin done I will submit it to you. Right now i dont use git or even know how so i will just send the plugin to the list.
I have implemented this as a new plugin. it is called insert-all-html, but it can be restricted with the widget settings selectors_apply and elements_apply...it also uses the selectors widget setting so it can be applied to multiple selectors at once... http://soupault.add1tocobol.com/add1tocobol-lua/#insert-all-html-lua