View Single Post
Old 08-08-2024, 06:25 AM   #6
ptm@xact.co.uk
Junior Member
ptm@xact.co.uk began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Aug 2024
Device: none
Quote:
Originally Posted by kovidgoyal View Post
This is done deliberately, see line 441 in oeb/base.py
I see the comment about some browser based renderers. I wonder if this is still true. I've no idea when this code was written. But my boss needs self closing tags. So if, at line 160 we had:

Code:
def close_self_closing_tags(raw):
    if self_closing_tags_permitted():
        return raw
    for_unicode = isinstance(raw, str)
    repl = as_string_type(r'<\g<tag>\g<arg>></\g<tag>>', for_unicode)
    pat = self_closing_pat(for_unicode)
    return pat.sub(repl, raw)
And in 'tweaks', wherever they are coded, the self_closing_tags_permitted() function is added. Returning false by default, but true if so configured by the user. Then we get the best of both worlds. Am I on the right track?
ptm@xact.co.uk is offline   Reply With Quote