parsav  Diff

Differences From Artifact [e99ea3e622]:

To Artifact [ad4d039b1c]:


    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 not isws(@(sl-1)) then return sl-nc end
    56     56   	return nil
    57     57   end
    58     58   
    59         -terra m.html(input: pstr, firstline: bool)
           59  +terra m.html(pool: &lib.mem.pool, input: pstr, firstline: bool)
    60     60   	if input.ptr == nil then return pstr.null() end
    61     61   	if input.ct == 0 then input.ct = lib.str.sz(input.ptr) end
    62     62   
    63         -	var md = lib.html.sanitize(input,false)
           63  +	var md = lib.html.sanitize(pool,input,false)
    64     64   
    65         -	var styled: lib.str.acc styled:init(md.ct)
           65  +	var styled: lib.str.acc styled:pool(pool,md.ct)
    66     66   
    67     67   	do var i = 0 while i < md.ct do
    68     68   		--var wordstart = (i == 0 or isws(md.ptr[i-1]))
    69     69   		--var wordend = (i == md.ct - 1 or isws(md.ptr[i+1]))
    70     70   		var wordstart = (i + 1 < md.ct and not isws(md.ptr[i+1]))
    71     71   		var wordend = (i == md.ct - 1 or not isws(md.ptr[i-1]))
    72     72   
................................................................................
   118    118   				goto skip
   119    119   			end
   120    120   		end
   121    121   
   122    122   		::fallback::styled:push(here,1) -- :/
   123    123   		i = i + 1
   124    124   	::skip::end end
   125         -	md:free()
          125  +	--md:free()
   126    126   
   127    127   	-- we make two passes: the first detects and transforms inline elements,
   128    128   	-- the second carries out block-level organization
   129    129   
   130         -	var html: lib.str.acc html:init(styled.sz)
          130  +	var html: lib.str.acc html:pool(pool,styled.sz)
   131    131   	var s = state {
   132    132   		segt = segt.none;
   133    133   		bqlvl = 0;
   134    134   		curpos = md.ptr;
   135    135   		blockstart = nil;
   136    136   	}
   137    137   	while s.curpos < md.ptr + md.ct do
   138    138   		s.curpos = s.curpos + 1
   139    139   	end 
   140    140   
   141         -		html:free() -- JUST FOR NOW
          141  +		--html:free() -- JUST FOR NOW
   142    142   	return styled:finalize()
   143    143   end
   144    144   
   145    145   return m