16
16
--
17
17
-- NOTES:
18
18
-- * gen() and validate() are the primary entrypoints. validate() only exists because gen() is too
19
- -- slow (~1 min) to run in per-commit CI.
19
+ -- slow (~1 min) to run in per-commit CI.
20
20
-- * visit_node() is the core function used by gen() to traverse the document tree and produce HTML.
21
21
-- * visit_validate() is the core function used by validate().
22
22
-- * Files in `new_layout` will be generated with a "flow" layout instead of preformatted/fixed-width layout.
@@ -50,7 +50,6 @@ local tagmap = nil
50
50
local helpfiles = nil
51
51
local invalid_tags = {}
52
52
53
- local commit = ' ?'
54
53
local api = vim .api
55
54
local M = {}
56
55
477
476
-- @param old boolean Preformat paragraphs (for old :help files which are full of arbitrary whitespace)
478
477
--
479
478
-- @returns html, stats
480
- local function gen_one (fname , to_fname , old )
479
+ local function gen_one (fname , to_fname , old , commit )
481
480
local stats = {
482
481
noise_lines = {},
483
482
parse_errors = {},
@@ -604,15 +603,15 @@ local function gen_one(fname, to_fname, old)
604
603
<footer>
605
604
<div class="container flex">
606
605
<div class="generator-stats">
607
- Generated on %s from <code>{%s} </code>
606
+ Generated at %s from <code><a href="https://github.com/neovim/neovim/commit/%s">%s</a> </code>
608
607
</div>
609
608
<div class="generator-stats">
610
609
parse_errors: %d %s | <span title="%s">noise_lines: %d</span>
611
610
</div>
612
611
<div>
613
612
</footer>
614
613
]] ):format (
615
- os.date (' %Y-%m-%d %H:%M:%S ' ), commit , # stats .parse_errors , bug_link ,
614
+ os.date (' %Y-%m-%d %H:%M' ), commit , commit : sub ( 1 , 7 ) , # stats .parse_errors , bug_link ,
616
615
html_esc (table.concat (stats .noise_lines , ' \n ' )), # stats .noise_lines )
617
616
618
617
html = (' %s%s%s</div>\n %s</body>\n </html>\n ' ):format (
@@ -763,11 +762,12 @@ end
763
762
--- @param include table | nil Process only these filenames. Example : { ' api.txt' , ' autocmd.txt' , ' channel.txt' }
764
763
---
765
764
--- @return s info dict
766
- function M .gen (help_dir , to_dir , include )
765
+ function M .gen (help_dir , to_dir , include , commit )
767
766
vim .validate {
768
767
help_dir = {help_dir , function (d ) return vim .fn .isdirectory (d ) == 1 end , ' valid directory' },
769
768
to_dir = {to_dir , ' s' },
770
769
include = {include , ' t' , true },
770
+ commit = {commit , ' s' , true },
771
771
}
772
772
773
773
local err_count = 0
@@ -781,7 +781,7 @@ function M.gen(help_dir, to_dir, include)
781
781
for _ , f in ipairs (helpfiles ) do
782
782
local helpfile = vim .fs .basename (f )
783
783
local to_fname = (' %s/%s' ):format (to_dir , get_helppage (helpfile ))
784
- local html , stats = gen_one (f , to_fname , not new_layout [helpfile ])
784
+ local html , stats = gen_one (f , to_fname , not new_layout [helpfile ], commit or ' ? ' )
785
785
tofile (to_fname , html )
786
786
print ((' generated (%-4s errors): %-15s => %s' ):format (# stats .parse_errors , helpfile , vim .fs .basename (to_fname )))
787
787
err_count = err_count + # stats .parse_errors
0 commit comments