usage strings were not HTML-escaped properly (Eric)

This commit is contained in:
steve donovan 2012-12-13 19:18:24 +02:00
parent 8869cf4924
commit 754da6e8d8
2 changed files with 7 additions and 2 deletions

View File

@ -34,9 +34,14 @@ local function cleanup_whitespaces(text)
return table.concat(lines, "\n")
end
local escape_table = { ["'"] = "&apos;", ["\""] = "&quot;", ["<"] = "&lt;", [">"] = "&gt;", ["&"] = "&amp;" }
function html.generate_output(ldoc, args, project)
local check_directory, check_file, writefile = tools.check_directory, tools.check_file, tools.writefile
function ldoc.escape(str)
return (str:gsub("['&<>\"]", escape_table))
end
-- this generates the internal module/function references
function ldoc.href(see)

View File

@ -96,7 +96,7 @@ return [==[
<h3>Usage:</h3>
<ul>
# for usage in iter(module.usage) do
$(li)<pre class="example">$(usage)</pre>$(il)
$(li)<pre class="example">$(ldoc.escape(usage))</pre>$(il)
# end -- for
</ul>
# end -- if usage
@ -155,7 +155,7 @@ return [==[
<h3>Usage:</h3>
<ul>
# for usage in iter(item.usage) do
$(li)<pre class="example">$(usage)</pre>$(il)
$(li)<pre class="example">$(ldoc.escape(usage))</pre>$(il)
# end -- for
</ul>
# end -- if usage