Differences From
Artifact [896438e021]:
52 52 local terra scanline_wordend(l: rawstring, max: intptr, n: rawstring, nc: intptr)
53 53 var sl = scanline(l,max,n,nc)
54 54 if sl == nil then return nil else sl = sl + nc end
55 55 if sl >= l+max or isws(@sl) then return sl-nc end
56 56 return nil
57 57 end
58 58
59 -terra m.html(md: pstr)
60 - if md.ct == 0 then md.ct = lib.str.sz(md.ptr) end
59 +terra m.html(input: pstr)
60 + if input.ct == 0 then input.ct = lib.str.sz(input.ptr) end
61 +
62 + var md = lib.html.sanitize(input,false)
63 +
61 64 var styled: lib.str.acc styled:init(md.ct)
62 65
63 66 do var i = 0 while i < md.ct do
64 67 var wordstart = (i == 0 or isws(md.ptr[i-1]))
65 68 var wordend = (i == md.ct - 1 or isws(md.ptr[i+1]))
66 69
67 70 var here = md.ptr + i
................................................................................
112 115 goto skip
113 116 end
114 117 end
115 118
116 119 ::fallback::styled:push(here,1) -- :/
117 120 i = i + 1
118 121 ::skip::end end
122 + md:free()
119 123
120 124 -- we make two passes: the first detects and transforms inline elements,
121 125 -- the second carries out block-level organization
122 126
123 127 var html: lib.str.acc html:init(styled.sz)
124 128 var s = state {
125 129 segt = segt.none;