Added a new tag property: noDoc. Set it true if you wish for a tag not to be listed in the help frame.

This commit is contained in:
cybeloras
2012-06-05 06:27:32 +00:00
parent f8bff67979
commit aa995f13a5
2 changed files with 80 additions and 74 deletions

150
Help.lua
View File

@ -1060,91 +1060,93 @@ function DogTag:OpenHelp()
tagCache[ns] = tagCache_ns
for i, tag in ipairs(tags) do
local tagData = Tags[ns][tag]
local tagCache_ns_tag = {}
tagCache_ns[tag] = tagCache_ns_tag
tagCache_ns_tag.category = tagData.category
local u = newList()
u[#u+1] = "<h3>"
local t = newList()
t[#t+1] = "["
if tagData.category ~= L["Operators"] then
t[#t+1] = tag
local arg = tagData.arg
if arg then
t[#t+1] = "("
for i = 1, #arg, 3 do
if i > 1 then
t[#t+1] = ", "
end
local argName, argTypes, argDefault = arg[i], arg[i+1], arg[i+2]
t[#t+1] = argName
if argName ~= "..." and argDefault ~= "@req" then
t[#t+1] = "="
if argDefault == "@undef" then
t[#t+1] = "undef"
elseif argDefault == false then
if argTypes:match("boolean") then
t[#t+1] = "false"
if not tagData.noDoc then
local tagCache_ns_tag = {}
tagCache_ns[tag] = tagCache_ns_tag
tagCache_ns_tag.category = tagData.category
local u = newList()
u[#u+1] = "<h3>"
local t = newList()
t[#t+1] = "["
if tagData.category ~= L["Operators"] then
t[#t+1] = tag
local arg = tagData.arg
if arg then
t[#t+1] = "("
for i = 1, #arg, 3 do
if i > 1 then
t[#t+1] = ", "
end
local argName, argTypes, argDefault = arg[i], arg[i+1], arg[i+2]
t[#t+1] = argName
if argName ~= "..." and argDefault ~= "@req" then
t[#t+1] = "="
if argDefault == "@undef" then
t[#t+1] = "undef"
elseif argDefault == false then
if argTypes:match("boolean") then
t[#t+1] = "false"
else
t[#t+1] = "nil"
end
elseif type(argDefault) == "string" then
t[#t+1] = ("%q"):format(argDefault)
else
t[#t+1] = "nil"
t[#t+1] = tostring(argDefault)
end
elseif type(argDefault) == "string" then
t[#t+1] = ("%q"):format(argDefault)
else
t[#t+1] = tostring(argDefault)
end
end
t[#t+1] = ")"
end
t[#t+1] = ")"
end
else
local arg = tagData.arg
local operator = tag
if operator == "unm" then
operator = "-"
end
if #arg == 3 then
t[#t+1] = operator
end
for i = 1, #arg, 3 do
local argName, argTypes, argDefault = arg[i], arg[i+1], arg[i+2]
if i > 1 then
t[#t+1] = " "
else
local arg = tagData.arg
local operator = tag
if operator == "unm" then
operator = "-"
end
if #arg == 3 then
t[#t+1] = operator
t[#t+1] = " "
end
t[#t+1] = argName
for i = 1, #arg, 3 do
local argName, argTypes, argDefault = arg[i], arg[i+1], arg[i+2]
if i > 1 then
t[#t+1] = " "
t[#t+1] = operator
t[#t+1] = " "
end
t[#t+1] = argName
end
end
end
t[#t+1] = "]"
u[#u+1] = escapeHTML(DogTag:ColorizeCode(table.concat(t)))
u[#u+1] = "</h3>"
t = del(t)
u[#u+1] = "<p>"
u[#u+1] = "|r |r |r |r "
u[#u+1] = escapeHTML(tagData.doc)
if tagData.alias then
u[#u+1] = "<br/>"
t[#t+1] = "]"
u[#u+1] = escapeHTML(DogTag:ColorizeCode(table.concat(t)))
u[#u+1] = "</h3>"
t = del(t)
u[#u+1] = "<p>"
u[#u+1] = "|r |r |r |r "
u[#u+1] = L["alias for "]
u[#u+1] = escapeHTML(DogTag:ColorizeCode("[" .. tagData.alias .. "]"))
end
u[#u+1] = "<br/>"
local examples = newList((";"):split(tagData.example))
for i, v in ipairs(examples) do
local tag, result = v:trim():match("^(.*) => \"(.*)\"$")
u[#u+1] = "|r |r |r |r • "
u[#u+1] = escapeHTML(DogTag:ColorizeCode(tag))
u[#u+1] = " => \"|cffffffff"
u[#u+1] = escapeHTML(result)
u[#u+1] = "|r\""
u[#u+1] = escapeHTML(tagData.doc)
if tagData.alias then
u[#u+1] = "<br/>"
u[#u+1] = "|r |r |r |r "
u[#u+1] = L["alias for "]
u[#u+1] = escapeHTML(DogTag:ColorizeCode("[" .. tagData.alias .. "]"))
end
u[#u+1] = "<br/>"
local examples = newList((";"):split(tagData.example))
for i, v in ipairs(examples) do
local tag, result = v:trim():match("^(.*) => \"(.*)\"$")
u[#u+1] = "|r |r |r |r • "
u[#u+1] = escapeHTML(DogTag:ColorizeCode(tag))
u[#u+1] = " => \"|cffffffff"
u[#u+1] = escapeHTML(result)
u[#u+1] = "|r\""
u[#u+1] = "<br/>"
end
examples = del(examples)
u[#u+1] = "<br/>"
u[#u+1] = "</p>"
tagCache_ns_tag.html = table.concat(u)
u = del(u)
end
examples = del(examples)
u[#u+1] = "<br/>"
u[#u+1] = "</p>"
tagCache_ns_tag.html = table.concat(u)
u = del(u)
end
local tmp = {}

View File

@ -274,6 +274,10 @@ function DogTag:AddTag(namespace, tag, data)
error("if doc is not supplied, category must be nil", 2)
end
end
if data.noDoc and type(data.doc) ~= "nil" then
error(("doc must be nil if noDoc is true, got %s"):format(type(data.doc)), 2)
end
tagData.noDoc = data.noDoc
del(data)
clearCodes(namespace)
end