From ec356e00a640159d9f4344f12b6f1ad2869978dd Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Sat, 27 Mar 2021 19:22:03 +0100 Subject: [PATCH 1/2] tools,doc: add "legacy" badge in the TOC --- doc/api_assets/style.css | 8 ++++++++ tools/doc/html.js | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/api_assets/style.css b/doc/api_assets/style.css index 04299595ca80d6..3176b7db252049 100644 --- a/doc/api_assets/style.css +++ b/doc/api_assets/style.css @@ -515,6 +515,14 @@ hr { padding: 1px 3px; border-radius: 3px; } +#toc .stability_3::after { + background-color: var(--blue1); + color: var(--white); + content: "legacy"; + margin-left: .25rem; + padding: 1px 3px; + border-radius: 3px; +} #apicontent li { margin-bottom: .5rem; diff --git a/tools/doc/html.js b/tools/doc/html.js index 9089ce7e443232..276da20bf1fd24 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -265,9 +265,9 @@ function preprocessElements({ filename }) { const [, prefix, number, explication] = text.value.match(STABILITY_RE); - const isStabilityIndex = - index - 2 === headingIndex || // General. - index - 3 === headingIndex; // With api_metadata block. + // Stability indexes are never more than 3 nodes away from their + // heading. + const isStabilityIndex = index - headingIndex < 3; if (heading && isStabilityIndex) { heading.stability = number; From 7e1d1b0af5c6756c78848eaeb704b6e8996febf7 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 29 Mar 2021 10:23:00 +0200 Subject: [PATCH 2/2] fixup! tools,doc: add "legacy" badge in the TOC Co-authored-by: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Co-authored-by: Luigi Pinca --- tools/doc/html.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/doc/html.js b/tools/doc/html.js index 276da20bf1fd24..671cb4adf62065 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -265,9 +265,9 @@ function preprocessElements({ filename }) { const [, prefix, number, explication] = text.value.match(STABILITY_RE); - // Stability indexes are never more than 3 nodes away from their + // Stability indices are never more than 3 nodes away from their // heading. - const isStabilityIndex = index - headingIndex < 3; + const isStabilityIndex = index - headingIndex <= 3; if (heading && isStabilityIndex) { heading.stability = number;