www-site-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r1701061 - /infrastructure/site/trunk/content/dyn/closer.lua
Date Fri, 04 Sep 2015 13:49:49 GMT
On 3 September 2015 at 17:23,  <humbedooh@apache.org> wrote:
> Author: humbedooh
> Date: Thu Sep  3 16:23:14 2015
> New Revision: 1701061
>
> URL: http://svn.apache.org/r1701061
> Log:
> new parser works, put in production \o/
>
> Modified:
>     infrastructure/site/trunk/content/dyn/closer.lua
>
> Modified: infrastructure/site/trunk/content/dyn/closer.lua
> URL: http://svn.apache.org/viewvc/infrastructure/site/trunk/content/dyn/closer.lua?rev=1701061&r1=1701060&r2=1701061&view=diff
> ==============================================================================
> --- infrastructure/site/trunk/content/dyn/closer.lua (original)
> +++ infrastructure/site/trunk/content/dyn/closer.lua Thu Sep  3 16:23:14 2015
> @@ -74,44 +74,11 @@ function recurse(url, defs, tdata, r, ez
>          end
>      )
>
> +    -- Parse EZT
> +    local structure = ezt:import("[ezt]"..tdata.."[end]")

Why is the data wrapped in [ezt]/[end] ?
Is that really needed?

It messes up reporting of mismatched [end] markers.
The line number is shown for the wrapper [end] rather than the one in
the template

> -    if defs.debug then
> -        local structure = ezt:import("[ezt]"..tdata.."[end]")
> -        return ezt:construct(structure, ezt_defs)
> -    else
> -        tdata = tdata:gsub("%[if%-any%s+([a-z0-9_]+)%](.-)%[end%]",
> -            function(tag, middle)
> -                --print("Got if-any", tag, " recursing it...", #middle)
> -                if url[tag] or mymap[tag] then
> -
> -                    tdata = recurse(url, defs, middle, r)
> -                    return tdata
> -                else
> -                    return ""
> -                end
> -            end
> -        )
> -        tdata = tdata:gsub("%[for%s+([a-z0-9_]+)%](.-)%[end%]",
> -            function(tag, middle)
> -                if mymap and mymap[tag] then
> -                --   print("Got for:", tag, "recursing")
> -                    local m = ""
> -                 --   print(middle)
> -                    for _, val in pairs(mymap[tag] or {}) do
> -                        defs[tag] = val
> -                   --     print("def", tag, val)
> -                        m = m .. recurse(url, defs, middle, r)
> -
> -                    end
> -                    return m
> -                else
> -                    return ""
> -                end
> -            end
> -        )
> -    end
> -    tdata = tdata:gsub("%[([a-z0-9_]+)%]", function(a) return defs[a] or "[" .. a ..
"]" end)
> -    return tdata
> +    -- Render output
> +    return ezt:construct(structure, ezt_defs)
>  end
>
>  function handle(r)
>
>

Mime
View raw message