Add @deprecated tag to lua docs

This commit is contained in:
peelz
2022-08-03 21:34:41 -04:00
parent 5d11c28db6
commit ca51130517
5 changed files with 64 additions and 20 deletions
+1
View File
@@ -34,6 +34,7 @@ pretty_topic_names = true -- strips extension from manual filenames, this does n
custom_tags = { custom_tags = {
{"realm", hidden = true}, {"realm", hidden = true},
{"deprecated", hidden = true},
{"internal", hidden = true} {"internal", hidden = true}
} }
+4
View File
@@ -537,3 +537,7 @@ a.type {
background-color: inherit; background-color: inherit;
padding: 0 8px 0 8px; padding: 0 8px 0 8px;
} }
.strikethrough {
text-decoration: line-through;
}
+49 -1
View File
@@ -14,7 +14,55 @@ function ldoc.url(path)
end end
function ldoc.realm_icon(realm) function ldoc.realm_icon(realm)
return "<span class=\"realm " .. (realm or "") .. "\"></span>"; return "<span class=\"realm " .. (realm or "") .. "\"></span>"
end
function ldoc.sidebar_item(item, module)
local text = ""
local deprecated = item.tags.deprecated
if deprecated then
text = text .. "<span class=\"strikethrough\">"
else
text = text .. "<span>"
end
text = text .. ldoc.realm_icon(item.tags.realm[1])
text = text .. "<a href=\""
.. ldoc.ref_to_module(module) .. "#" .. item.name
.. "\">"
if ldoc.is_kind_classmethod(module.kind) then
text = text .. item.name:gsub(".+:", "")
else
text = text .. item.name:gsub(module.name .. ".", "")
end
text = text
.. "</a>"
.. "</span>"
return text
end
function ldoc.item_header(item)
local text = ""
text = text .. "<a class=\"anchor\">"
local deprecated = item.tags.deprecated
if deprecated then
text = text .. "<h1 class=\"strikethrough\">"
else
text = text .. "<h1>"
end
text = text
.. ldoc.realm_icon(item.tags.realm[1])
.. ldoc.display_name(item)
.. "</h1>"
.. "</a>"
return text
end end
function ldoc.is_kind_classmethod(kind) function ldoc.is_kind_classmethod(kind)
+8 -3
View File
@@ -40,9 +40,14 @@
{% for item, _ in pairs(items) do %} {% for item, _ in pairs(items) do %}
<section class="method" id="{{item.name}}"> <section class="method" id="{{item.name}}">
<header> <header>
<a class="anchor"> {* ldoc.item_header(item) *}
<h1>{* ldoc.realm_icon(item.tags.realm[1]) *}</span>{{ldoc.display_name(item)}}</h1>
</a> {% if item.tags.deprecated then %}
<div class="notice warning">
<div class="title">Deprecated</div>
<p>This API is deprecated and shouldn&#x27;t be used anymore.</p>
</div>
{% end %}
{% if (item.tags.internal) then %} {% if (item.tags.internal) then %}
<div class="notice error"> <div class="notice error">
+2 -16
View File
@@ -59,14 +59,7 @@ end
{% for k, v in pairs(currentMod.items) do %} {% for k, v in pairs(currentMod.items) do %}
{% if (v.kind == "functions") then %} {% if (v.kind == "functions") then %}
<li> <li>
{* ldoc.realm_icon(v.tags.realm[1]) *} {* ldoc.sidebar_item(v, currentMod) *}
<a href="{* ldoc.ref_to_module(currentMod) *}#{{v.name}}">
{% if (ldoc.is_kind_classmethod(currentMod.kind)) then
echo((v.name:gsub(".+:", "")))
else
echo((v.name:gsub(currentMod.name .. ".", "")))
end %}
</a>
</li> </li>
{% end %} {% end %}
{% end %} {% end %}
@@ -90,14 +83,7 @@ end
{% for k, v in pairs(currentMod.items) do %} {% for k, v in pairs(currentMod.items) do %}
{% if (v.kind == "fields" or v.kind == "tables") then %} {% if (v.kind == "fields" or v.kind == "tables") then %}
<li> <li>
{* ldoc.realm_icon(v.tags.realm[1]) *} {* ldoc.sidebar_item(v, currentMod) *}
<a href="{* ldoc.ref_to_module(currentMod) *}#{{v.name}}">
{% if (ldoc.is_kind_classmethod(currentMod.kind)) then
echo((v.name:gsub(".+:", "")))
else
echo((v.name:gsub(currentMod.name .. ".", "")))
end %}
</a>
</li> </li>
{% end %} {% end %}
{% end %} {% end %}