Skip to content

Commit c700537

Browse files
authored
Deprecated fix (#257)
Fixes a bug where `role=label--deprecated` was not being displayed eg https://neo4j.com/docs/cypher-manual/current/subqueries/call-subquery/#importing-with Found a bug introduced in #254 that was treating deprecated as a role that required a version to be specified. Deprecated can be used with or without a version number.
1 parent d95ab41 commit c700537

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/js/60-docs-roles.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,19 @@ document.addEventListener('DOMContentLoaded', function () {
2525
var label = role.replace('label--', '')
2626
var labelParts = label.split('-')
2727

28-
// label could be eg aura-db-enterprise - we use the full label
29-
// label could be eg new-5.20 - we use 'new' for the label and add the version as text
30-
label = (rolesData[label] && rolesData[label].labelCategory !== 'version') ? label : labelParts.slice(0, -1).join('-')
28+
// roles can be single word ie beta - use beta as label class and text from rolesDatee.beta
29+
// roles can be single word + version ie new-5.20 - use new as label class and text from rolesData.new + version number
30+
// roles can be multiple words ie aura-db-enterprise - use aura-db-enterprise as label class and text from rolesData.aura-db-enterprise
31+
// roles like deprecated can appear with or without a version number - deprecated-5.20 or deprecated
32+
// - use deprecated as label class and text from rolesData.deprecated
33+
// - use deprecated as label class and text from rolesData.deprecated + version number
34+
35+
// so if the role is a single word, we use the role as is - ie deprecated
36+
// if it is longer we test to see if it is a 'versionable' roke - ie deprecated-5.20
37+
// if it is a versionable role, and a veresion is specified, we remove the version and use the remaining text as the label class
38+
if (labelParts.length > 1) {
39+
label = (rolesData[label] && rolesData[label].labelCategory !== 'version') ? label : labelParts.slice(0, -1).join('-')
40+
}
3141

3242
// ignore labels that are not defined in rolesData
3343
if (!rolesData[label]) {

0 commit comments

Comments
 (0)