end
M.build = function()
+ local writer = require("docgen.writer")
+ local dutil = require("docgen.util")
for lang, rfs in pairs(key_refs) do
- local f = require("docgen.writer").Writer({ "ref", lang, "keyword-list" })
+ local f = writer.Writer({ "ref", lang, "keyword-list" })
local arr = {}
for refn, v in pairs(rfs) do
arr[#arr + 1] = refn
f:write_raw(table.concat(arr, "\n"))
f:write_nl()
f:finish()
+ local lf = writer.Writer({ "ref", lang, "keyword-link" })
+ lf:write_raw("/", dutil.path_join(
+ dutil.get_root(), "ref", lang, "key", "{FNAME}"
+ ))
+ lf:write_nl()
+ lf:finish()
end
end
local M = {}
-local doc_root
+local doc_root, root_ns
local path_sep, rep_sep = "/", "\\"
if ffi.os == "Windows" then
end
M.path_join = function(...)
- return table.concat({ ... }, path_sep):gsub(rep_sep, path_sep)
+ return (table.concat({ ... }, path_sep):gsub(rep_sep, path_sep))
end
M.path_to_nspace = function(p)
return M.path_join(doc_root, path .. ".txt")
end
+M.get_root = function()
+ return root_ns
+end
+
M.mkdir_r = function(dirn)
assert(cutil.file_mkpath(dirn and M.path_join(doc_root, dirn) or doc_root))
end
return t
end
-M.init = function(root)
+M.init = function(root, rns)
doc_root = root:gsub(rep_sep, path_sep)
+ root_ns = rns:gsub(rep_sep, path_sep)
end
return M
else
dr = opts["r"]
end
- dr = dutil.path_join(dr, dutil.nspace_to_path(rootns))
- dutil.init(dr)
+ local pns = dutil.nspace_to_path(rootns)
+ dr = dutil.path_join(dr, pns)
+ dutil.init(dr, pns)
if #args == 0 then
dtree.scan_directory()
else