Skip to content

Commit 0daad7c

Browse files
committed
Create labels from roles in docs (#211)
Usage `[role=label--*]` Can be existing labels eg `[role=label--enterprise-edition]` or action-version labels such as `[role=label--new-5.11]` or `[role=label--deprecated-5.13]` - Roles are converted to labels. - Roles applied to headings and table captions are displayed inline, right-aligned. - Roles on block level elements are displayed before the corresponding block element.
1 parent 37447df commit 0daad7c

File tree

9 files changed

+669
-98
lines changed

9 files changed

+669
-98
lines changed

gulp.d/tasks/rollup.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const rollupPluginNodeResolve = require('@rollup/plugin-node-resolve').nodeResol
55
const rollupPluginCommonJS = require('@rollup/plugin-commonjs')
66
const rollupPluginBabel = require('@rollup/plugin-babel').babel
77
const rollupPluginTerser = require('rollup-plugin-terser').terser
8+
const rollupPluginJSON = require('@rollup/plugin-json')
89

910
const toCamel = (s) => {
1011
return s.replace(/([-_][a-z])/ig, ($1) => {
@@ -35,6 +36,7 @@ async function bundle (vinylFile) {
3536
babelHelpers: 'bundled',
3637
}),
3738
rollupPluginTerser(),
39+
rollupPluginJSON(),
3840
],
3941
onwarn: (warning) => {
4042
if (warning.code === 'CIRCULAR_DEPENDENCY' && ignoredCircular.some((d) => warning.importer.includes(d))) {

package-lock.json

Lines changed: 107 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"@gram-data/gram-d3": "^0.1.2",
1919
"@rollup/plugin-babel": "^5.2.3",
2020
"@rollup/plugin-commonjs": "^17.1.0",
21+
"@rollup/plugin-json": "^6.1.0",
2122
"@rollup/plugin-node-resolve": "^11.1.1",
2223
"asciidoctor.js": "1.5.9",
2324
"auth0-js": "^9.14.0",

preview-src/docs-roles.adoc

Lines changed: 102 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
= Docs `code test` flags
2-
:page-role: not-on-aura
1+
= Docs roles with a long title
2+
:page-role: not-on-aura new-5.17
33
:page-theme: docs
44
:page-banner: warning
55
:page-banner-text: Lorem ipsum dolor sit est.
@@ -12,9 +12,96 @@
1212
Flags sections as Not Available on Aura, Aura DB Enterprise, Enterprise Edition, Fabric, and Deprecated
1313
--
1414

15-
Blocks with the appropriate roles have text appended.
1615

17-
[role=not-on-aura]
16+
[role="label--new-5.17 label--enterprise-edition"]
17+
== Relationship property type constraints
18+
19+
Blocks with the appropriate roles have labels added.
20+
21+
22+
[role=label--aura-db-enterprise label--not-on-aura]
23+
=== H3 AuraDB Enterprise AND Not on Aura
24+
25+
Lorem ipsum dolor sit
26+
27+
Open blocks can be used to mark multiple paragraphs within a section.
28+
29+
[role=label--new-5.17]
30+
--
31+
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
32+
Mauris eget leo nunc, nec tempus mi? Curabitur id nisl mi, ut vulputate urna.
33+
34+
Quisque porta facilisis tortor, vitae bibendum velit fringilla vitae! Lorem ipsum dolor sit amet, consectetur adipiscing elit.
35+
--
36+
37+
38+
This is a normal paragraph.
39+
40+
The next paragraph has a label, but it's not one we support.
41+
42+
[role=label--invented-label]
43+
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
44+
45+
[role=label--enterprise-edition]
46+
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
47+
Mauris eget leo nunc, nec tempus mi? Curabitur id nisl mi, ut vulputate urna.
48+
49+
[role=label--deprecated-5.17]
50+
. list with label
51+
. item 2
52+
. item 3
53+
54+
These labels from roles should be used for block elements only.
55+
For inline elements, use a label.
56+
57+
58+
=== Code
59+
60+
Intro para
61+
62+
[role=label--deprecated-5.17]
63+
.Title
64+
[source, shell]
65+
----
66+
How does a label look on a code block?
67+
----
68+
69+
70+
=== Examples
71+
72+
Intro para
73+
74+
[role=label--new-5.17]
75+
.This is a short one
76+
[example]
77+
====
78+
Lorem Ipsunm
79+
====
80+
81+
82+
=== Tables
83+
84+
Intro para
85+
86+
[[procedure_db_create_setVectorProperty]]
87+
[role=label--admin-only label--deprecated-5.9]
88+
.db.create.setVectorProperty()
89+
[cols="<15s,<85"]
90+
|===
91+
| Description
92+
a|
93+
Set a vector property on a given node in a more space efficient representation than Cypher’s link:{neo4j-docs-base-uri}/cypher-manual/{page-version}/clauses/set#set-set-a-property[`SET`].
94+
| Signature
95+
m| db.create.setVectorProperty(node :: NODE, key :: STRING, vector :: LIST<FLOAT>) :: (node :: NODE)
96+
| Mode
97+
m|WRITE
98+
| Replaced by
99+
a|xref:reference/procedures.adoc#procedure_db_create_setNodeVectorProperty[`db.create.setNodeVectorProperty()`]
100+
|===
101+
102+
103+
104+
[role=label--not-on-aura]
18105
== Not on `code test` Aura
19106

20107
Lorem ipsum dolor `code test` sit
@@ -42,13 +129,13 @@ And so does this table
42129
|===
43130

44131

45-
[role=aura-db-enterprise]
132+
[role=label--aura-db-enterprise]
46133
== AuraDB Enterprise
47134

48135
Lorem ipsum dolor sit
49136

50137

51-
[role=aura-db-enterprise not-on-aura]
138+
[role=label--aura-db-enterprise label--not-on-aura]
52139
== H2 AuraDB Enterprise AND Not on Aura
53140

54141
Lorem ipsum dolor sit
@@ -59,23 +146,23 @@ Lorem ipsum dolor sit
59146
Lorem ipsum dolor sit
60147

61148

62-
[role=aura-db-enterprise not-on-aura]
149+
[role=label--aura-db-enterprise label--not-on-aura]
63150
=== H3 AuraDB Enterprise AND Not on Aura
64151

65152
Lorem ipsum dolor sit
66153

67-
[role=aura-db-enterprise not-on-aura]
154+
[role=label--aura-db-enterprise label--not-on-aura]
68155
=== H4 show roles
69156

70157
Lorem ipsum dolor sit
71158

72159

73-
[role=fabric]
160+
[role=label--fabric]
74161
== Fabric Heading
75162

76163
Lorem ipsum
77164

78-
[role=enterprise-edition]
165+
[role=label--enterprise-edition]
79166
== Enterprise Edition content
80167

81168
Lorem ipsum
@@ -86,7 +173,7 @@ Lorem ipsum
86173

87174
==== H4 inside labeled section
88175

89-
[role=deprecated]
176+
[role=label--deprecated]
90177
== Deprecated content
91178

92179
Other blocks can have deprecated roles added.
@@ -100,13 +187,13 @@ This is a second paragraph in the example.
100187
This is the third.
101188
====
102189

103-
[role=deprecated]
190+
[role=label--deprecated]
104191
.Example 2 title
105192
====
106193
Example 2 content - this example is deprecated
107194
====
108195

109-
[role=alpha]
196+
[role=label--alpha]
110197
== Alpha content
111198

112199

@@ -120,7 +207,7 @@ For more information on algorithm tiers, see <<algorithms>>.
120207
Lorem ipsum
121208

122209

123-
[role=beta]
210+
[role=label--beta]
124211
== Beta content
125212

126213

@@ -135,7 +222,7 @@ For more information on algorithm tiers, see <<algorithms>>.
135222
Lorem ipsum
136223

137224

138-
[role=deprecated]
225+
[role=label--deprecated]
139226
== Deprecated content
140227

141228
Lorem ipsum

0 commit comments

Comments
 (0)