mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 21:25:04 -07:00
feat(gen_help_html.lua): put commit-id in footer
This commit is contained in:
parent
d9ed8d1110
commit
7b4c49888a
@ -50,7 +50,6 @@ local tagmap = nil
|
|||||||
local helpfiles = nil
|
local helpfiles = nil
|
||||||
local invalid_tags = {}
|
local invalid_tags = {}
|
||||||
|
|
||||||
local commit = '?'
|
|
||||||
local api = vim.api
|
local api = vim.api
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
@ -477,7 +476,7 @@ end
|
|||||||
-- @param old boolean Preformat paragraphs (for old :help files which are full of arbitrary whitespace)
|
-- @param old boolean Preformat paragraphs (for old :help files which are full of arbitrary whitespace)
|
||||||
--
|
--
|
||||||
-- @returns html, stats
|
-- @returns html, stats
|
||||||
local function gen_one(fname, to_fname, old)
|
local function gen_one(fname, to_fname, old, commit)
|
||||||
local stats = {
|
local stats = {
|
||||||
noise_lines = {},
|
noise_lines = {},
|
||||||
parse_errors = {},
|
parse_errors = {},
|
||||||
@ -604,7 +603,7 @@ local function gen_one(fname, to_fname, old)
|
|||||||
<footer>
|
<footer>
|
||||||
<div class="container flex">
|
<div class="container flex">
|
||||||
<div class="generator-stats">
|
<div class="generator-stats">
|
||||||
Generated on %s from <code>{%s}</code>
|
Generated at %s from <code><a href="https://github.com/neovim/neovim/commit/%s">%s</a></code>
|
||||||
</div>
|
</div>
|
||||||
<div class="generator-stats">
|
<div class="generator-stats">
|
||||||
parse_errors: %d %s | <span title="%s">noise_lines: %d</span>
|
parse_errors: %d %s | <span title="%s">noise_lines: %d</span>
|
||||||
@ -612,7 +611,7 @@ local function gen_one(fname, to_fname, old)
|
|||||||
<div>
|
<div>
|
||||||
</footer>
|
</footer>
|
||||||
]]):format(
|
]]):format(
|
||||||
os.date('%Y-%m-%d %H:%M:%S'), commit, #stats.parse_errors, bug_link,
|
os.date('%Y-%m-%d %H:%M'), commit, commit:sub(1, 7), #stats.parse_errors, bug_link,
|
||||||
html_esc(table.concat(stats.noise_lines, '\n')), #stats.noise_lines)
|
html_esc(table.concat(stats.noise_lines, '\n')), #stats.noise_lines)
|
||||||
|
|
||||||
html = ('%s%s%s</div>\n%s</body>\n</html>\n'):format(
|
html = ('%s%s%s</div>\n%s</body>\n</html>\n'):format(
|
||||||
@ -763,11 +762,12 @@ end
|
|||||||
--- @param include table|nil Process only these filenames. Example: {'api.txt', 'autocmd.txt', 'channel.txt'}
|
--- @param include table|nil Process only these filenames. Example: {'api.txt', 'autocmd.txt', 'channel.txt'}
|
||||||
---
|
---
|
||||||
--- @returns info dict
|
--- @returns info dict
|
||||||
function M.gen(help_dir, to_dir, include)
|
function M.gen(help_dir, to_dir, include, commit)
|
||||||
vim.validate{
|
vim.validate{
|
||||||
help_dir={help_dir, function(d) return vim.fn.isdirectory(d) == 1 end, 'valid directory'},
|
help_dir={help_dir, function(d) return vim.fn.isdirectory(d) == 1 end, 'valid directory'},
|
||||||
to_dir={to_dir, 's'},
|
to_dir={to_dir, 's'},
|
||||||
include={include, 't', true},
|
include={include, 't', true},
|
||||||
|
commit={commit, 's', true},
|
||||||
}
|
}
|
||||||
|
|
||||||
local err_count = 0
|
local err_count = 0
|
||||||
@ -781,7 +781,7 @@ function M.gen(help_dir, to_dir, include)
|
|||||||
for _, f in ipairs(helpfiles) do
|
for _, f in ipairs(helpfiles) do
|
||||||
local helpfile = vim.fs.basename(f)
|
local helpfile = vim.fs.basename(f)
|
||||||
local to_fname = ('%s/%s'):format(to_dir, get_helppage(helpfile))
|
local to_fname = ('%s/%s'):format(to_dir, get_helppage(helpfile))
|
||||||
local html, stats = gen_one(f, to_fname, not new_layout[helpfile])
|
local html, stats = gen_one(f, to_fname, not new_layout[helpfile], commit or '?')
|
||||||
tofile(to_fname, html)
|
tofile(to_fname, html)
|
||||||
print(('generated (%-4s errors): %-15s => %s'):format(#stats.parse_errors, helpfile, vim.fs.basename(to_fname)))
|
print(('generated (%-4s errors): %-15s => %s'):format(#stats.parse_errors, helpfile, vim.fs.basename(to_fname)))
|
||||||
err_count = err_count + #stats.parse_errors
|
err_count = err_count + #stats.parse_errors
|
||||||
|
Loading…
Reference in New Issue
Block a user