Skip to content

Commit

Permalink
Create labels from roles in docs (#211)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
recrwplay committed Mar 6, 2024
1 parent 7d1c353 commit 4dcccc9
Show file tree
Hide file tree
Showing 9 changed files with 669 additions and 98 deletions.
2 changes: 2 additions & 0 deletions gulp.d/tasks/rollup.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const rollupPluginNodeResolve = require('@rollup/plugin-node-resolve').nodeResol
const rollupPluginCommonJS = require('@rollup/plugin-commonjs')
const rollupPluginBabel = require('@rollup/plugin-babel').babel
const rollupPluginTerser = require('rollup-plugin-terser').terser
const rollupPluginJSON = require('@rollup/plugin-json')

const toCamel = (s) => {
return s.replace(/([-_][a-z])/ig, ($1) => {
Expand Down Expand Up @@ -35,6 +36,7 @@ async function bundle (vinylFile) {
babelHelpers: 'bundled',
}),
rollupPluginTerser(),
rollupPluginJSON(),
],
onwarn: (warning) => {
if (warning.code === 'CIRCULAR_DEPENDENCY' && ignoredCircular.some((d) => warning.importer.includes(d))) {
Expand Down
119 changes: 107 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@gram-data/gram-d3": "^0.1.2",
"@rollup/plugin-babel": "^5.2.3",
"@rollup/plugin-commonjs": "^17.1.0",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^11.1.1",
"asciidoctor.js": "1.5.9",
"auth0-js": "^9.14.0",
Expand Down
117 changes: 102 additions & 15 deletions preview-src/docs-roles.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
= Docs `code test` flags
:page-role: not-on-aura
= Docs roles with a long title
:page-role: not-on-aura new-5.17
:page-theme: docs
:page-banner: warning
:page-banner-text: Lorem ipsum dolor sit est.
Expand All @@ -12,9 +12,96 @@
Flags sections as Not Available on Aura, Aura DB Enterprise, Enterprise Edition, Fabric, and Deprecated
--

Blocks with the appropriate roles have text appended.

[role=not-on-aura]
[role="label--new-5.17 label--enterprise-edition"]
== Relationship property type constraints

Blocks with the appropriate roles have labels added.


[role=label--aura-db-enterprise label--not-on-aura]
=== H3 AuraDB Enterprise AND Not on Aura

Lorem ipsum dolor sit

Open blocks can be used to mark multiple paragraphs within a section.

[role=label--new-5.17]
--
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Mauris eget leo nunc, nec tempus mi? Curabitur id nisl mi, ut vulputate urna.

Quisque porta facilisis tortor, vitae bibendum velit fringilla vitae! Lorem ipsum dolor sit amet, consectetur adipiscing elit.
--


This is a normal paragraph.

The next paragraph has a label, but it's not one we support.

[role=label--invented-label]
Lorem ipsum dolor sit amet, consectetur adipiscing elit.

[role=label--enterprise-edition]
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Mauris eget leo nunc, nec tempus mi? Curabitur id nisl mi, ut vulputate urna.

[role=label--deprecated-5.17]
. list with label
. item 2
. item 3

These labels from roles should be used for block elements only.
For inline elements, use a label.


=== Code

Intro para

[role=label--deprecated-5.17]
.Title
[source, shell]
----
How does a label look on a code block?
----


=== Examples

Intro para

[role=label--new-5.17]
.This is a short one
[example]
====
Lorem Ipsunm
====


=== Tables

Intro para

[[procedure_db_create_setVectorProperty]]
[role=label--admin-only label--deprecated-5.9]
.db.create.setVectorProperty()
[cols="<15s,<85"]
|===
| Description
a|
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`].
| Signature
m| db.create.setVectorProperty(node :: NODE, key :: STRING, vector :: LIST<FLOAT>) :: (node :: NODE)
| Mode
m|WRITE
| Replaced by
a|xref:reference/procedures.adoc#procedure_db_create_setNodeVectorProperty[`db.create.setNodeVectorProperty()`]
|===



[role=label--not-on-aura]
== Not on `code test` Aura

Lorem ipsum dolor `code test` sit
Expand Down Expand Up @@ -42,13 +129,13 @@ And so does this table
|===


[role=aura-db-enterprise]
[role=label--aura-db-enterprise]
== AuraDB Enterprise

Lorem ipsum dolor sit


[role=aura-db-enterprise not-on-aura]
[role=label--aura-db-enterprise label--not-on-aura]
== H2 AuraDB Enterprise AND Not on Aura

Lorem ipsum dolor sit
Expand All @@ -59,23 +146,23 @@ Lorem ipsum dolor sit
Lorem ipsum dolor sit


[role=aura-db-enterprise not-on-aura]
[role=label--aura-db-enterprise label--not-on-aura]
=== H3 AuraDB Enterprise AND Not on Aura

Lorem ipsum dolor sit

[role=aura-db-enterprise not-on-aura]
[role=label--aura-db-enterprise label--not-on-aura]
=== H4 show roles

Lorem ipsum dolor sit


[role=fabric]
[role=label--fabric]
== Fabric Heading

Lorem ipsum

[role=enterprise-edition]
[role=label--enterprise-edition]
== Enterprise Edition content

Lorem ipsum
Expand All @@ -86,7 +173,7 @@ Lorem ipsum

==== H4 inside labeled section

[role=deprecated]
[role=label--deprecated]
== Deprecated content

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

[role=deprecated]
[role=label--deprecated]
.Example 2 title
====
Example 2 content - this example is deprecated
====

[role=alpha]
[role=label--alpha]
== Alpha content


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


[role=beta]
[role=label--beta]
== Beta content


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


[role=deprecated]
[role=label--deprecated]
== Deprecated content

Lorem ipsum
Expand Down

0 comments on commit 4dcccc9

Please sign in to comment.