diff --git a/docs/config.ld b/docs/config.ld index b0b9ed32d..bd278528e 100644 --- a/docs/config.ld +++ b/docs/config.ld @@ -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} } diff --git a/docs/css/ldoc.css b/docs/css/ldoc.css index 7f4c90734..4f590feb1 100644 --- a/docs/css/ldoc.css +++ b/docs/css/ldoc.css @@ -537,3 +537,7 @@ a.type { background-color: inherit; padding: 0 8px 0 8px; } + +.strikethrough { + text-decoration: line-through; +} diff --git a/docs/templates/ldoc.ltp b/docs/templates/ldoc.ltp index 95ad3f592..b42ac394c 100644 --- a/docs/templates/ldoc.ltp +++ b/docs/templates/ldoc.ltp @@ -14,7 +14,55 @@ function ldoc.url(path) end function ldoc.realm_icon(realm) - return ""; + return "" +end + +function ldoc.sidebar_item(item, module) + local text = "" + + local deprecated = item.tags.deprecated + if deprecated then + text = text .. "" + else + text = text .. "" + end + + text = text .. ldoc.realm_icon(item.tags.realm[1]) + text = text .. "" + + if ldoc.is_kind_classmethod(module.kind) then + text = text .. item.name:gsub(".+:", "") + else + text = text .. item.name:gsub(module.name .. ".", "") + end + + text = text + .. "" + .. "" + return text +end + +function ldoc.item_header(item) + local text = "" + + text = text .. "" + + local deprecated = item.tags.deprecated + if deprecated then + text = text .. "

" + else + text = text .. "

" + end + + text = text + .. ldoc.realm_icon(item.tags.realm[1]) + .. ldoc.display_name(item) + .. "

" + .. "
" + + return text end function ldoc.is_kind_classmethod(kind) diff --git a/docs/templates/module.ltp b/docs/templates/module.ltp index 6e9e76931..b3903674c 100644 --- a/docs/templates/module.ltp +++ b/docs/templates/module.ltp @@ -40,9 +40,14 @@ {% for item, _ in pairs(items) do %}
- -

{* ldoc.realm_icon(item.tags.realm[1]) *}{{ldoc.display_name(item)}}

-
+ {* ldoc.item_header(item) *} + + {% if item.tags.deprecated then %} +
+
Deprecated
+

This API is deprecated and shouldn't be used anymore.

+
+ {% end %} {% if (item.tags.internal) then %}
diff --git a/docs/templates/sidebar.ltp b/docs/templates/sidebar.ltp index c3f6dc3dc..322b3fd1f 100644 --- a/docs/templates/sidebar.ltp +++ b/docs/templates/sidebar.ltp @@ -59,14 +59,7 @@ end {% for k, v in pairs(currentMod.items) do %} {% if (v.kind == "functions") then %}
  • - {* ldoc.realm_icon(v.tags.realm[1]) *} - - {% if (ldoc.is_kind_classmethod(currentMod.kind)) then - echo((v.name:gsub(".+:", ""))) - else - echo((v.name:gsub(currentMod.name .. ".", ""))) - end %} - + {* ldoc.sidebar_item(v, currentMod) *}
  • {% end %} {% end %} @@ -90,14 +83,7 @@ end {% for k, v in pairs(currentMod.items) do %} {% if (v.kind == "fields" or v.kind == "tables") then %}
  • - {* ldoc.realm_icon(v.tags.realm[1]) *} - - {% if (ldoc.is_kind_classmethod(currentMod.kind)) then - echo((v.name:gsub(".+:", ""))) - else - echo((v.name:gsub(currentMod.name .. ".", ""))) - end %} - + {* ldoc.sidebar_item(v, currentMod) *}
  • {% end %} {% end %}