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
|
||||||
|
local insert_name = name:gsub("_", "_")
|
||||||
|
if names[insert_name] == nil then
|
||||||
table.insert(ret, {
|
table.insert(ret, {
|
||||||
file = file,
|
file = file,
|
||||||
name = name:gsub("_", "_"),
|
name = insert_name,
|
||||||
link = get_link(file, var, var:match(exp3):gsub("_", "\\_")),
|
link = get_link(file, var, var:match(exp3):gsub("_", "\\_")),
|
||||||
desc = buffer:gmatch("[-*/ \n]+([^\n.]*)")() or "",
|
desc = buffer:gmatch("[-*/ \n]+([^\n.]*)")() or "",
|
||||||
mod = path_to_module(file),
|
mod = path_to_module(file)
|
||||||
})
|
})
|
||||||
|
names[insert_name] = 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
buffer = ""
|
buffer = ""
|
||||||
|
|
Loading…
Reference in New Issue