<%# Copyright 2010 Jo-Philipp Wich Licensed to the public under the Apache License 2.0. -%> <% export("uci_changelog", function(changes) -%>
<%:Legend:%>
  <%:Section added%>
  <%:Section removed%>
  <%:Option changed%>
  <%:Option removed%>


<% local util = luci.util local ret = { } for r, tbl in pairs(changes) do for s, os in pairs(tbl) do -- section add if os['.type'] and os['.type'] ~= "" then ret[#ret+1] = "%s.%s=%s" %{ r, s, os['.type'] } for o, v in util.kspairs(os) do if o:sub(1,1) ~= "." then if type(v) == "table" then local i for i = 1, #v do ret[#ret+1] = "
%s.%s.%s+=%s" %{ r, s, o, util.pcdata(v[i]) } end else ret[#ret+1] = "
%s.%s.%s=%s" %{ r, s, o, util.pcdata(v) } end end end ret[#ret+1] = "

" -- section delete elseif os['.type'] and os['.type'] == "" then ret[#ret+1] = "%s.%s
" %{ r, s } -- modifications else ret[#ret+1] = "%s.%s
" %{ r, s } for o, v in util.kspairs(os) do if o:sub(1,1) ~= "." then if v and #v > 0 then ret[#ret+1] = "" if type(v) == "table" then local i for i = 1, #v do ret[#ret+1] = "%s.%s.%s+=%s
" %{ r, s, o, util.pcdata(v[i]) } end else ret[#ret+1] = "%s.%s.%s=%s
" %{ r, s, o, util.pcdata(v) } end ret[#ret+1] = "
" else ret[#ret+1] = "%s.%s.%s
" %{ r, s, o } end end end ret[#ret+1] = "

" end end end write(table.concat(ret)) %>
<%- end) %>