docs/_parser.lua: parse_files() doesn't produce duplicate entries
anymore. TODO: Handle duplicate's links.
This commit is contained in:
parent
832483dd60
commit
66bb09718b
|
@ -121,6 +121,7 @@ local function parse_files(paths, property_name, matcher, name_matcher)
|
||||||
local exp2 = matcher or "[-*]*[ ]*".. property_name ..".(.+)"
|
local exp2 = matcher or "[-*]*[ ]*".. property_name ..".(.+)"
|
||||||
local exp3 = name_matcher or "[. ](.+)"
|
local exp3 = name_matcher or "[. ](.+)"
|
||||||
|
|
||||||
|
local names = {} -- Used to check for duplicates
|
||||||
local ret = {}
|
local ret = {}
|
||||||
|
|
||||||
table.sort(paths)
|
table.sort(paths)
|
||||||
|
@ -162,13 +163,17 @@ local function parse_files(paths, property_name, matcher, name_matcher)
|
||||||
"seems to be misformatted. Use `beautiful.namespace_name`"
|
"seems to be misformatted. Use `beautiful.namespace_name`"
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
table.insert(ret, {
|
local insert_name = name:gsub("_", "_")
|
||||||
file = file,
|
if names[insert_name] == nil then
|
||||||
name = name:gsub("_", "_"),
|
table.insert(ret, {
|
||||||
link = get_link(file, var, var:match(exp3):gsub("_", "\\_")),
|
file = file,
|
||||||
desc = buffer:gmatch("[-*/ \n]+([^\n.]*)")() or "",
|
name = insert_name,
|
||||||
mod = path_to_module(file),
|
link = get_link(file, var, var:match(exp3):gsub("_", "\\_")),
|
||||||
})
|
desc = buffer:gmatch("[-*/ \n]+([^\n.]*)")() or "",
|
||||||
|
mod = path_to_module(file)
|
||||||
|
})
|
||||||
|
names[insert_name] = 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
buffer = ""
|
buffer = ""
|
||||||
|
|
Loading…
Reference in New Issue