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

View File

@@ -34,6 +34,7 @@ pretty_topic_names = true -- strips extension from manual filenames, this does n
custom_tags = {
{"realm", hidden = true},
{"deprecated", hidden = true},
{"internal", hidden = true}
}

View File

@@ -537,3 +537,7 @@ a.type {
background-color: inherit;
padding: 0 8px 0 8px;
}
.strikethrough {
text-decoration: line-through;
}

View File

@@ -14,7 +14,55 @@ function ldoc.url(path)
end
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
function ldoc.is_kind_classmethod(kind)

View File

@@ -40,9 +40,14 @@
{% for item, _ in pairs(items) do %}
<section class="method" id="{{item.name}}">
<header>
<a class="anchor">
<h1>{* ldoc.realm_icon(item.tags.realm[1]) *}</span>{{ldoc.display_name(item)}}</h1>
</a>
{* ldoc.item_header(item) *}
{% 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 %}
<div class="notice error">

View File

@@ -59,14 +59,7 @@ end
{% for k, v in pairs(currentMod.items) do %}
{% if (v.kind == "functions") then %}
<li>
{* ldoc.realm_icon(v.tags.realm[1]) *}
<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>
{* ldoc.sidebar_item(v, currentMod) *}
</li>
{% end %}
{% end %}
@@ -90,14 +83,7 @@ end
{% for k, v in pairs(currentMod.items) do %}
{% if (v.kind == "fields" or v.kind == "tables") then %}
<li>
{* ldoc.realm_icon(v.tags.realm[1]) *}
<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>
{* ldoc.sidebar_item(v, currentMod) *}
</li>
{% end %}
{% end %}