Comparison

mod_pubsub_summary/mod_pubsub_summary.lua @ 4600:98864dffb231

mod_pubsub_summary: Fix conversion of emphasis _like this_ per XEP-0393
author Kim Alvefur <zash@zash.se>
date Mon, 28 Jun 2021 04:12:47 +0200
parent 4513:ade2064160e3
child 4609:fcfe691d6322
comparison
equal deleted inserted replaced
4599:06c9c9ef0a51 4600:98864dffb231
12 content = content:gsub("\n*<p[^>]*>\n*(.-)\n*</p>\n*", "%1\n\n"); 12 content = content:gsub("\n*<p[^>]*>\n*(.-)\n*</p>\n*", "%1\n\n");
13 content = content:gsub("<li>(.-)</li>\n", "* %1\n"); 13 content = content:gsub("<li>(.-)</li>\n", "* %1\n");
14 content = content:gsub("<a[^>]*href=[\"'](.-)[\"'][^>]*>(.-)</a>", "\1%1\2%2\3"); 14 content = content:gsub("<a[^>]*href=[\"'](.-)[\"'][^>]*>(.-)</a>", "\1%1\2%2\3");
15 content = content:gsub("<b>(.-)</b>", "*%1*"); 15 content = content:gsub("<b>(.-)</b>", "*%1*");
16 content = content:gsub("<strong>(.-)</strong>", "*%1*"); 16 content = content:gsub("<strong>(.-)</strong>", "*%1*");
17 content = content:gsub("<em>(.-)</em>", "*%1*"); 17 content = content:gsub("<em>(.-)</em>", "_%1_");
18 content = content:gsub("<i>(.-)</i>", "*%1*"); 18 content = content:gsub("<i>(.-)</i>", "_%1_");
19 content = content:gsub("<img[^>]*src=[\"'](.-)[\"'][^>]*>", " %1 "); -- TODO alt= would have been nice to grab 19 content = content:gsub("<img[^>]*src=[\"'](.-)[\"'][^>]*>", " %1 "); -- TODO alt= would have been nice to grab
20 content = content:gsub("<br[^>]*>", "\n"); 20 content = content:gsub("<br[^>]*>", "\n");
21 content = content:gsub("<[^>]+>", ""); 21 content = content:gsub("<[^>]+>", "");
22 content = content:gsub("\1(.-)\2(.-)\3", "%2 <%1>"); 22 content = content:gsub("\1(.-)\2(.-)\3", "%2 <%1>");
23 content = content:gsub("^%s*", ""):gsub("%s*$", ""); 23 content = content:gsub("^%s*", ""):gsub("%s*$", "");