On Sun, Dec 19, 2021 at 04:39:04PM -0800, Per Bothner wrote: > On 12/19/21 16:02, Patrice Dumas wrote: > > It was much easier in the HTML converter. It is actually a bit > > cumbersome, but it works. To use XML compatible syntax, it is possible > > to use -c 'USE_XML_SYNTAX 1'. It is also possible to use only numeric > > entities, with -c 'USE_NUMERIC_ENTITY 1', to add xmlns to the <html> > > element with -c 'HTML_ROOT_ELEMENT_ATTRIBUTES > > xmlns="http://www.w3.org/1999/xhtml"'. > > From looking at the code (without any testing), it appears that all > calls to close_html_lone_element_if_needed pass a string that ends with ">". > > A simplification might be to leave off the ">" in the argument, and instead > have close_html_lone_element_if_needed append either ">" or "/>" depending on > USE_XML_SYNTAX. > > I would guess this might be slightly slower in the non-USE_XML_SYNTAX case > (an extra concatenation with ">") but faster in the USE_XML_SYNTAX case > (avoid the regex substitution), but neither likely to be measurable since I'm > also > guessing it's not called that frequently.
As importantly, the code is simpler with your suggestion. I implemented it, thanks (I cannot access the GNU websites right now but I have a commit ready). -- Pat
