@@ -7,7 +7,7 @@ function M.index(plugin)
7
7
if Config .options .readme .skip_if_doc_exists and vim .loop .fs_stat (plugin .dir .. " /doc" ) then
8
8
return {}
9
9
end
10
- --- @type { file : string , tag : string , line : string } []
10
+ --- @type table<string , {file : string , tag : string , line : string } >
11
11
local tags = {}
12
12
for _ , file in ipairs (Config .options .readme .files ) do
13
13
file = plugin .dir .. " /" .. file
@@ -18,7 +18,7 @@ function M.index(plugin)
18
18
if title then
19
19
local tag = plugin .name .. " -" .. title :lower ():gsub (" %W+" , " -" )
20
20
tag = tag :gsub (" %-+" , " -" ):gsub (" %-$" , " " )
21
- table.insert ( tags , { tag = tag , line = line , file = plugin .name .. " .md" })
21
+ tags [ tag ] = { tag = tag , line = line , file = plugin .name .. " .md" }
22
22
end
23
23
end
24
24
table.insert (lines , [[ <!-- vim: set ft=markdown: -->]] )
@@ -40,12 +40,14 @@ function M.update()
40
40
--- @type { file : string , tag : string , line : string } []
41
41
local tags = {}
42
42
for _ , plugin in pairs (Config .plugins ) do
43
- vim .list_extend (tags , M .index (plugin ))
43
+ for key , tag in pairs (M .index (plugin )) do
44
+ tags [key ] = tag
45
+ end
44
46
end
45
47
local lines = { [[ !_TAG_FILE_ENCODING utf-8 //]] }
46
- for _ , tag in ipairs ( tags ) do
48
+ Util . foreach ( tags , function ( _ , tag )
47
49
table.insert (lines , (" %s\t %s\t /%s" ):format (tag .tag , tag .file , tag .line ))
48
- end
50
+ end )
49
51
Util .write_file (docs .. " /tags" , table.concat (lines , " \n " ))
50
52
end
51
53
0 commit comments