Mercurial > prosody-modules
comparison mod_xhtmlim/mod_xhtmlim.lua @ 3404:6444fb5dbb51
mod_xhtmlim: Turn unknown elements into <span>
In HTML, you're supposed to replace unknown tags with their content. The
:maptags API can't replace tags with text, but replacing with <span>
should close enough.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 13 Dec 2018 14:32:17 +0100 |
| parents | 276f7af8afd1 |
| children | 1f68287138e3 |
comparison
equal
deleted
inserted
replaced
| 3403:823027110e29 | 3404:6444fb5dbb51 |
|---|---|
| 85 tag.attr[attr] = "https://url.was.invalid/"; | 85 tag.attr[attr] = "https://url.was.invalid/"; |
| 86 end | 86 end |
| 87 end | 87 end |
| 88 end | 88 end |
| 89 else | 89 else |
| 90 -- Can't happen with the above assert. | 90 tag.name = "span" |
| 91 return nil; | 91 tag.attr = { xmlns = "http://www.w3.org/1999/xhtml" } |
| 92 end | 92 end |
| 93 -- Check child tags | 93 -- Check child tags |
| 94 tag:maptags(sanitize_xhtml); | 94 tag:maptags(sanitize_xhtml); |
| 95 -- This tag is clean! | 95 -- This tag is clean! |
| 96 return tag; | 96 return tag; |
