mod_xhtmlim: Turn unknown elements into <span>
authorKim Alvefur <zash@zash.se>
Thu, 13 Dec 2018 14:32:17 +0100
changeset 3408 6444fb5dbb51
parent 3407 823027110e29
child 3409 bd71c97de1d0
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.
mod_xhtmlim/mod_xhtmlim.lua
--- a/mod_xhtmlim/mod_xhtmlim.lua	Thu Dec 13 10:35:26 2018 +0000
+++ b/mod_xhtmlim/mod_xhtmlim.lua	Thu Dec 13 14:32:17 2018 +0100
@@ -87,8 +87,8 @@
 				end
 			end
 		else
-			-- Can't happen with the above assert.
-			return nil;
+			tag.name = "span"
+			tag.attr = { xmlns = "http://www.w3.org/1999/xhtml" }
 		end
 		-- Check child tags
 		tag:maptags(sanitize_xhtml);