annotate env/util/wysihtml_preproc.lua @ 1552:e670b2c341e6
Do not create new session for cors requests
 | author | 
 bsw | 
 | date | 
 Wed Oct 28 17:57:10 2020 +0100 (2020-10-28) | 
 | parents | 
 32cc544d5a5b  | 
 | children | 
  | 
 
 | rev | 
   line source | 
| 
bsw/jbe@1309
 | 
     1 local function normalize_whitespace(str)
 | 
| 
bsw/jbe@1309
 | 
     2   str = string.gsub(str, "\194\160", " ")
 | 
| 
bsw/jbe@1309
 | 
     3   str = string.gsub(str, " ", " ")
 | 
| 
bsw/jbe@1309
 | 
     4   return str
 | 
| 
bsw/jbe@1309
 | 
     5 end
 | 
| 
bsw/jbe@1309
 | 
     6 
 | 
| 
bsw/jbe@1309
 | 
     7 function util.wysihtml_preproc(str)
 | 
| 
bsw/jbe@1309
 | 
     8   str = string.gsub(str, "<a>(.-)</a>", "%1")
 | 
| 
bsw/jbe@1309
 | 
     9   str = string.gsub(str, "<[ou]l>[^<>]*", normalize_whitespace)
 | 
| 
bsw/jbe@1309
 | 
    10   str = string.gsub(str, "</li>[^<>]*", normalize_whitespace)
 | 
| 
bsw/jbe@1309
 | 
    11   return str
 | 
| 
bsw/jbe@1309
 | 
    12 end
 |