-- convert changelog to HTML local function find_header(buffer, position) local start, stop, date, author, email = buffer:find("(%d+%-%d+%-%d+)%s+(.-)%<([^%>]+)%>", position) return start, stop + 1, date, author, email end local function parse_entry(buffer, position) local _, pos, date, author, email = find_header(buffer, position) local entry = {date = date, author = author, email = email} -- find text between two headers local next_header = find_header(buffer, pos) entry.text = buffer:sub(pos, next_header - 1) return entry, pos + 1 end local escapes = {["<"] = "<", [">"] = ">", ["&"] = "&"} local function print_entry(entry) -- print just the date and the entry text print("
" end_par = "\n
\n" return replace end) :gsub("%s*$", "") -- remove space at the end .. "\n" -- we need to close the paragraph explicitly -- text = text:gsub("(.-):", "
%1:")
-- escape links
text = text:gsub("(http[^%s]+)", "
%1")
-- escape file names
text = text:gsub("([a-zA-z0-9%-%.]+tex)%s+(%([^%)]+%))", function(texfile, generated)
texfile = string.format("%s", texfile, texfile)
return texfile .. " " .. generated
end)
print("