Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c6865c6

Browse files
authoredOct 14, 2019
Merge pull request #108 from redhat-documentation/94-hyphens-in-anchor-id
Issue 94: Use underscore to separate {context}
2 parents b079f30 + 37d2884 commit c6865c6

7 files changed

+20
-18
lines changed
 

‎modular-docs-manual/content/topics/module_anchor-and-file-names-concept.adoc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33

44
To optimize modular documentation, follow these guidelines for naming module anchors and files:
55

6-
Anchor names:: Provide an anchor in the format `+++[id="anchor-name-{context}"]+++` for every module so that it can be identified by Asciidoctor when reused or cross-referenced. `+++{context}+++` is a variable whose value you define in the assembly. Give the anchor the same or similar name as the module heading. Separate the words in the anchor with hyphens:
6+
Anchor names:: Provide an anchor in the format `+++[id="anchor-name_{context}"]+++` for every module so that it can be identified by Asciidoctor when reused or cross-referenced. `+++{context}+++` is a variable whose value you define in the assembly. Give the anchor the same or similar name as the module heading. Separate the words in the anchor with hyphens and use an underscore to separate the `+++{context}+++` part:
77
+
88
--
99
[source]
1010
----
11-
[id="anchor-name-{context}"]
11+
[id="anchor-name_{context}"]
1212
= Module Heading
1313
1414
The first sentence of the topic.
@@ -17,7 +17,7 @@ The first sentence of the topic.
1717
.Example 1. Concept Module
1818
[source]
1919
----
20-
[id="guided-decision-tables-{context}"]
20+
[id="guided-decision-tables_{context}"]
2121
= Guided Decision Tables
2222
2323
The guided decision tables feature works similarly to ...
@@ -26,7 +26,7 @@ The guided decision tables feature works similarly to ...
2626
.Example 2. Procedure Module
2727
[source]
2828
----
29-
[id="creating-guided-decision-tables-{context}"]
29+
[id="creating-guided-decision-tables_{context}"]
3030
= Creating Guided Decision Tables
3131
3232
You can use guided decision tables to ...
@@ -38,6 +38,8 @@ You can use guided decision tables to ...
3838
The format defined here is recommended because it is the most stable and versatile of anchor formats, and supports variables that enable topics to be reused and cross-referenced properly. For details, see xref:reusing-modules[]. Other anchor formats include `+++[[anchor-name]]+++` and `+++[#anchor-name]+++`, but these formats either do not support variables for content reuse or do not support certain character types, such as periods. These limitations cause errors at build time.
3939
====
4040

41+
NOTE: The underscore is recommended as the separator for `+++{context}+++`, because this facilitates tooling to distinguish the context part from the base anchor ID.
42+
4143
For more information about Asciidoc anchors, see the link:http://asciidoctor.org/docs/user-manual/#anchordef[Asciidoctor User Manual].
4244
--
4345

‎modular-docs-manual/content/topics/module_reusing-modules-procedure.adoc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@ This error is resolved by adding and defining a document variable.
1717
[discrete]
1818
.Procedure
1919

20-
. In the module file that will be reused, add the `+++{context}+++` suffix with a hyphen to the anchor name in the format `[id="anchor-name-+++{context}"+++]`.
20+
. In the module file that will be reused, add the `+++{context}+++` suffix with a hyphen to the anchor name in the format `[id="anchor-name_{context}"]`.
2121
+
2222
NOTE: Although you can use any document variable that clearly indicates the variable in question, such as `+++{product}+++` or `+++{chapter}+++`, the `+++{context}+++` variable is recommended. This variable indicates more generally that the same module can be reused in the specified "context" of one section of a document or another, regardless of whether that section is product-specific or not, whether it is a whole chapter or a small assembly, or some other limitation.
2323

2424
+
2525
.Two Modules to Be Reused: Module A and Module B
2626
[source]
2727
----
28-
[id="module-A-being-reused-{context}"]
28+
[id="module-A-being-reused_{context}"]
2929
= Module A Heading
3030
----
3131
+
3232
[source]
3333
----
34-
[id="module-B-being-reused-{context}"]
34+
[id="module-B-being-reused_{context}"]
3535
= Module B Heading
3636
----
3737

@@ -97,7 +97,7 @@ include::module-A-being-reused.adoc
9797
//
9898
// ...
9999
100-
[id="module-A-being-reused-{context}"]
100+
[id="module-A-being-reused_{context}"]
101101
= Module A Heading
102102
----
103103

@@ -142,7 +142,7 @@ The module files contain the following content:
142142
// asset-definitions.adoc
143143
// business-rules.adoc
144144
145-
[id="projects-{context}"]
145+
[id="projects_{context}"]
146146
= Projects
147147
----
148148

@@ -154,7 +154,7 @@ The module files contain the following content:
154154
// asset-definitions.adoc
155155
// business-rules.adoc
156156
157-
[id="creating-assets-{context}"]
157+
[id="creating-assets_{context}"]
158158
= Creating Assets
159159
----
160160

@@ -220,7 +220,7 @@ The module file contains the following content:
220220
.projects.adoc
221221
[source]
222222
----
223-
[id="projects-{context}"]
223+
[id="projects_{context}"]
224224
= Projects
225225
----
226226

‎modular-docs-manual/content/topics/using_text_snippets_or_text_fragments.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
// Base the file name and the ID on the module title. For example:
66
// * file name: my-concept-module-a.adoc
7-
// * ID: [id="my-concept-module-a-{context}"]
7+
// * ID: [id="my-concept-module-a_{context}"]
88
// * Title: = My concept module A
99

1010
// The ID is used as an anchor for linking to the module. Avoid changing it after the module has been published to ensure existing links are not broken.
11-
[id="using_text_snippets_or_text_fragments-{context}"]
11+
[id="using_text_snippets_or_text_fragments_{context}"]
1212
// The `context` attribute enables module reuse. Every module's ID includes a variable that sets the context, such as {context}, which ensures that the module has a unique ID even if it is reused multiple times in a guide.
1313
= Text Snippets or Text Fragments (Pseudo-modules)
1414
//In the title of concept modules, include nouns or noun phrases that are used in the body text. This helps readers and search engines find the information quickly.

‎modular-docs-manual/files/TEMPLATE_ASSEMBLY_a-collection-of-modules.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ifdef::context[:parent-context: {context}]
1414

1515
// The ID is used as an anchor for linking to the module. Avoid changing it after the module has been published to ensure existing links are not broken.
1616
[id="a-collection-of-modules"]
17-
// If the assembly is reused in other assemblies in a guide, include {context} in the ID: [id="a-collection-of-modules-{context}"].
17+
// If the assembly is reused in other assemblies in a guide, include {context} in the ID: [id="a-collection-of-modules_{context}"].
1818
= A collection of modules
1919
//If the assembly covers a task, start the title with a verb in the gerund form, such as Creating or Configuring.
2020
:context: assembly-keyword

‎modular-docs-manual/files/TEMPLATE_CONCEPT_concept-explanation.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
// Base the file name and the ID on the module title. For example:
66
// * file name: my-concept-module-a.adoc
7-
// * ID: [id="my-concept-module-a-{context}"]
7+
// * ID: [id="my-concept-module-a_{context}"]
88
// * Title: = My concept module A
99

1010
// The ID is used as an anchor for linking to the module. Avoid changing it after the module has been published to ensure existing links are not broken.
11-
[id="concept-explanation-{context}"]
11+
[id="concept-explanation_{context}"]
1212
// The `context` attribute enables module reuse. Every module's ID includes {context}, which ensures that the module has a unique ID even if it is reused multiple times in a guide.
1313
= Concept explanation
1414
//In the title of concept modules, include nouns or noun phrases that are used in the body text. This helps readers and search engines find the information quickly.

‎modular-docs-manual/files/TEMPLATE_PROCEDURE_doing-one-procedure.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// * Title: = Doing procedure A
99

1010
// The ID is used as an anchor for linking to the module. Avoid changing it after the module has been published to ensure existing links are not broken.
11-
[id="doing-one-procedure-{context}"]
11+
[id="doing-one-procedure_{context}"]
1212
// The `context` attribute enables module reuse. Every module's ID includes {context}, which ensures that the module has a unique ID even if it is reused multiple times in a guide.
1313
= Doing one procedure
1414
// Start the title of a procedure module with a verb, such as Creating or Create. See also _Wording of headings_ in _The IBM Style Guide_.

‎modular-docs-manual/files/TEMPLATE_REFERENCE_reference-material.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// * Title: = My reference A
99

1010
// The ID is used as an anchor for linking to the module. Avoid changing it after the module has been published to ensure existing links are not broken.
11-
[id="reference-material-{context}"]
11+
[id="reference-material_{context}"]
1212
// The `context` attribute enables module reuse. Every module's ID includes {context}, which ensures that the module has a unique ID even if it is reused multiple times in a guide.
1313
= Reference material
1414
//In the title of a reference module, include nouns that are used in the body text. For example, "Keyboard shortcuts for ___" or "Command options for ___." This helps readers and search engines find the information quickly.

0 commit comments

Comments
 (0)
Please sign in to comment.