fix: doc command not displaying correct subdocs when using shorthand api doc access

pull/240/head
sammyette 2023-07-11 20:56:24 -04:00
parent 5b4b055c6c
commit 48a06f8022
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
1 changed files with 4 additions and 4 deletions

View File

@ -34,18 +34,18 @@ Available sections: ]] .. table.concat(modules, ', ')
local funcdocs = nil
local subdocName = args[2]
if not f then
-- assume subdir
-- dataDir/docs/<mod>/<mod>.md
moddocPath = moddocPath .. mod .. '/'
if not subdocName then
subdocName = '_index'
end
f = io.open(moddocPath .. subdocName .. '.md', 'rb')
local oldmoddocPath
if not f then
f = io.open(moddocPath .. subdocName:match '%w+' .. '/' .. subdocName .. '.md', 'rb')
moddocPath = moddocPath .. subdocName:match '%w+' .. '/'
f = io.open(moddocPath .. subdocName .. '.md', 'rb')
end
if not f then
moddocPath = moddocPath .. subdocName .. '/'
moddocPath = oldmoddocPath .. subdocName .. '/'
subdocName = args[3] or '_index'
f = io.open(moddocPath .. subdocName .. '.md', 'rb')
end