Module:documentation: Difference between revisions

No edit summary
m Changed protection settings for "Module:documentation" ([Edit=Allow only template editors and administrators] (indefinite) [Move=Allow only template editors and administrators] (indefinite))
Line 2: Line 2:


local array_module = "Module:array"
local array_module = "Module:array"
local debug_track_module = "Module:debug/track"
local frame_module = "Module:frame"
local frame_module = "Module:frame"
local fun_is_callable_module = "Module:fun/isCallable"
local fun_is_callable_module = "Module:fun/isCallable"
Line 44: Line 45:
categorize_module = require(module_categorization_module).categorize
categorize_module = require(module_categorization_module).categorize
return categorize_module(...)
return categorize_module(...)
end
local function debug_track(...)
debug_track = require(debug_track_module)
return debug_track(...)
end
end


Line 163: Line 169:
["modern"] = "Modern",
["modern"] = "Modern",
}
}
local function track(page)
debug_track("documentation/" .. page)
return true
end


local function compare_pages(page1, page2, text)
local function compare_pages(page1, page2, text)
Line 451: Line 462:
.. "This module is part of the category tree system, which is a general framework for generating the "
.. "This module is part of the category tree system, which is a general framework for generating the "
.. "descriptions and categorization of category pages.\n\n"
.. "descriptions and categorization of category pages.\n\n"
.. "For more information, see [[wikt:Module:category tree/lang/documentation]].\n\n"
.. "For more information, see [[Module:category tree/lang/documentation]].\n\n"
.. "'''NOTE:''' If you add a new language-specific module, you must add the language code to the "
.. "'''NOTE:''' If you add a new language-specific module, you must add the language code to the "
.. "list at the top of [[wikt:Module:category tree/lang]] in order for the module to be recognized."
.. "list at the top of [[Module:category tree/lang]] in order for the module to be recognized."
end
end
end
end
Line 682: Line 693:


local title = args["for"] and new_title(args["for"]) or get_current_title()
local title = args["for"] and new_title(args["for"]) or get_current_title()
local doc_title = args.from ~= "-" and new_title(args.from or title.fullText .. '/doc') or nil
local doc_title = args.from ~= "-" and new_title(args.from or title.fullText .. '/documentation') or nil
local contentModel = title.contentModel
local contentModel = title.contentModel
local pagetype, is_script_or_stylesheet = get_pagetype(title)
local pagetype, is_script_or_stylesheet = get_pagetype(title)
Line 805: Line 816:
-- obvious typos that should be corrected.
-- obvious typos that should be corrected.
if doc_page_content:lower():match("</?includeonly%f[%s/>][^>]*>") then
if doc_page_content:lower():match("</?includeonly%f[%s/>][^>]*>") then
track("module-includeonly")
else
else
-- Check for uses of {{module cat}}. find_templates treats the
-- Check for uses of {{module cat}}. find_templates treats the
Line 828: Line 840:
output:insert(
output:insert(
"<dd><i style=\"font-size: larger;\">The following " ..
"<dd><i style=\"font-size: larger;\">The following " ..
"[[wikt:Help:Documenting templates and modules|documentation]] is located at [[" ..
"[[Help:Documenting templates and modules|documentation]] is located at [[" ..
doc_title.fullText .. "]]. " .. "<sup>[[" .. doc_title:fullUrl { action = "edit" } .. " edit]]</sup>" ..
doc_title.fullText .. "]]. " .. "<sup>[[" .. doc_title:fullUrl { action = "edit" } .. " edit]]</sup>" ..
cats_auto_generated_text .. "</i></dd>")
cats_auto_generated_text .. "</i></dd>")
Line 847: Line 859:
output:insert(
output:insert(
"<dd><i style=\"font-size: larger;\">The following " ..
"<dd><i style=\"font-size: larger;\">The following " ..
"[[wikt:Help:Documenting templates and modules|documentation]] is " ..
"[[Help:Documenting templates and modules|documentation]] is " ..
"generated by [[" .. doc_content_source .. "]]. <sup>[[" ..
"generated by [[" .. doc_content_source .. "]]. <sup>[[" ..
new_title(doc_content_source):fullUrl { action = "edit" } ..
new_title(doc_content_source):fullUrl { action = "edit" } ..
Line 855: Line 867:
output:insert(
output:insert(
"<dd><i style=\"font-size: larger;\">This " .. pagetype ..
"<dd><i style=\"font-size: larger;\">This " .. pagetype ..
" lacks a [[wikt:Help:Documenting templates and modules|documentation subpage]]. " ..
" lacks a [[Help:Documenting templates and modules|documentation subpage]]. " ..
(fallback_docs and "You may " or "Please ") ..
(fallback_docs and "You may " or "Please ") ..
"[" .. doc_title:fullUrl { action = "edit", preload = preload }
"[" .. doc_title:fullUrl { action = "edit", preload = preload }
Line 992: Line 1,004:
local sandbox_of = title.text:match("^(.*)/sandbox%d*%f[/%z]")
local sandbox_of = title.text:match("^(.*)/sandbox%d*%f[/%z]")
if sandbox_of then
if sandbox_of then
track("sandbox to be moved")
else
else
sandbox_of = title.text:match("^sandbox%d*/(.*)$")
sandbox_of = title.text:match("^sandbox%d*/(.*)$")
Line 1,002: Line 1,015:
if title_exists(sandbox_of) then
if title_exists(sandbox_of) then
diff = " (" .. compare_pages(title.fullText, sandbox_of, "diff") .. ")"
diff = " (" .. compare_pages(title.fullText, sandbox_of, "diff") .. ")"
else
track("no sandbox of")
end
end


Line 1,059: Line 1,074:
if title_exists(sandbox_of) then
if title_exists(sandbox_of) then
diff = " (" .. compare_pages(title.fullText, sandbox_of, "diff") .. ")"
diff = " (" .. compare_pages(title.fullText, sandbox_of, "diff") .. ")"
else
track("no sandbox of")
end
end