Skip to content

Commit d0a5c5b

Browse files
author
Marek Suchánek
authored
Merge pull request #15 from redhat-documentation/pantheon-2-metadata-14
Add Pantheon 2 metadata in the templates
2 parents 9a769f6 + c35f4fe commit d0a5c5b

File tree

5 files changed

+127
-63
lines changed

5 files changed

+127
-63
lines changed

src/module.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,22 @@ impl Input {
129129
title_with_replacements = title_with_replacements.replace("--", "-");
130130
}
131131

132-
title_with_replacements
132+
let prefix = self.prefix();
133+
134+
[prefix, title_with_replacements].join("")
133135
}
134136

135137
/// Prepare the file name for the generated file.
136138
///
137-
/// The file name is based on the module ID, with the `.adoc` extension and an optional prefix.
139+
/// The file name is based on the module ID, with the `.adoc` extension.
138140
pub fn file_name(&self) -> String {
139-
let prefix = if self.options.prefixes {
141+
let suffix = ".adoc";
142+
143+
[&self.id(), suffix].join("")
144+
}
145+
146+
fn prefix(&self) -> String {
147+
if self.options.prefixes {
140148
// If prefixes are enabled, pick the right file prefix
141149
match self.mod_type {
142150
ModuleType::Assembly => "assembly_",
@@ -147,11 +155,7 @@ impl Input {
147155
} else {
148156
// If prefixes are disabled, use an empty string for the prefix
149157
""
150-
};
151-
152-
let suffix = ".adoc";
153-
154-
[prefix, &self.id(), suffix].join("")
158+
}.to_string()
155159
}
156160

157161
/// Prepare an include statement that can be used to include the generated file from elsewhere.
@@ -376,7 +380,7 @@ mod tests {
376380
assembly.title,
377381
"A testing assembly with /special-characters*"
378382
);
379-
assert_eq!(assembly.id, "a-testing-assembly-with-special-characters");
383+
assert_eq!(assembly.id, "assembly_a-testing-assembly-with-special-characters");
380384
assert_eq!(
381385
assembly.file_name,
382386
"assembly_a-testing-assembly-with-special-characters.adoc"

templates/assembly.adoc

Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,43 @@
22
//
33
// <List assemblies here, each on a new line>
44

5-
// Retains the context of the parent assembly if this assembly is nested within another assembly.
6-
// For more information about nesting assemblies, see: https://redhat-documentation.github.io/modular-docs/#nesting-assemblies
7-
// See also the complementary step on the last line of this file.
5+
////
6+
Retains the context of the parent assembly if this assembly is nested within another assembly.
7+
For more information about nesting assemblies, see: https://redhat-documentation.github.io/modular-docs/#nesting-assemblies
8+
See also the complementary step on the last line of this file.
9+
////
10+
811
ifdef::context[:parent-context-of-${module_id}: {context}]
912

10-
// Base the file name and the ID on the assembly title. For example:
11-
// * file name: my-assembly-a.adoc
12-
// * ID: [id="my-assembly-a"]
13-
// * Title: = My assembly A
13+
////
14+
Base the file name and the ID on the assembly title. For example:
15+
* file name: assembly-my-user-story.adoc
16+
* ID: [id="assembly-my-user-story_{context}"]
17+
* Title: = My user story
18+
19+
The ID is an anchor that links to the module. Avoid changing it after the module has been published to ensure existing links are not broken. Include {context} in the ID so the assembly can be reused.
20+
////
1421

15-
// 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.
16-
// If the assembly is reused in other assemblies in a guide, include {context} in the ID: [id="a-collection-of-modules_{context}"].
1722
ifndef::context[]
1823
[id="${module_id}"]
1924
endif::[]
2025
ifdef::context[]
2126
[id="${module_id}_{context}"]
2227
endif::[]
2328
= ${module_title}
24-
// If the assembly covers a task, start the title with a verb in the gerund form, such as Creating or Configuring.
29+
////
30+
If the assembly covers a task, start the title with a verb in the gerund form, such as Creating or Configuring.
31+
////
2532
2633
:context: ${module_id}
27-
// 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.
2834
35+
////
36+
The `context` attribute enables module reuse. Every module ID includes {context}, which ensures that the module has a unique ID so you can include it multiple times in the same guide.
37+
////
38+
39+
[role="_abstract"]
2940
// <example>
30-
This paragraph is the assembly introduction. It explains what the user will accomplish by working through the modules in the assembly and sets the context for the user story the assembly is based on. Can include more than one paragraph. Consider using the information from the user story.
41+
This paragraph is the assembly introduction. It explains what the user will accomplish by working through the modules in the assembly and sets the context for the user story the assembly is based on. The text that immediately follows the `[role="_abstract"]` tag is used for search metadata.
3142
// </example>
3243
3344
.Prerequisites
@@ -36,27 +47,41 @@ This paragraph is the assembly introduction. It explains what the user will acco
3647
* A bulleted list of conditions that must be satisfied before the user starts following this assembly.
3748
* You can also link to other modules or assemblies the user must follow before starting this assembly.
3849
* Delete the section title and bullets if the assembly has no prerequisites.
50+
* X is installed. For information about installing X, see <link>.
51+
* You can log in to X with administrator privileges.
3952
// </example>
4053
41-
// The following include statements pull in the module files that comprise the assembly. Include any combination of concept, procedure, or reference modules required to cover the user story. You can also include other assemblies.
54+
////
55+
The following include statements pull in the module files that comprise the assembly. Include any combination of concept, procedure, or reference modules required to cover the user story. You can also include other assemblies.
4256
43-
// include::modules/TEMPLATE_CONCEPT_explaining_a_concept.adoc[leveloffset=+1]
44-
// [leveloffset=+1] ensures that when a module starts with a level-1 heading (= Heading), the heading will be interpreted as a level-2 heading (== Heading) in the assembly.
45-
46-
// include::modules/TEMPLATE_PROCEDURE_doing_one_procedure.adoc[leveloffset=+1]
57+
include::modules/TEMPLATE_CONCEPT_explaining_a_concept.adoc[leveloffset=+1]
58+
////
4759
4860
${include_statements}
4961
62+
////
63+
[leveloffset=+1] ensures that when a module title is a level 1 heading (= Title), the heading will be interpreted as a level-2 heading (== Title) in the assembly. Use [leveloffset=+2] and [leveloffset=+3] to nest modules in an assembly.
64+
65+
include::modules/TEMPLATE_PROCEDURE_doing_one_procedure.adoc[leveloffset=+2]
66+
67+
include::modules/TEMPLATE_PROCEDURE_reference-material.adoc[leveloffset=2]
68+
////
5069
70+
[role="_additional-resources"]
5171
== Additional resources (or Next steps)
72+
////
73+
Optional. Delete if not used.
74+
////
5275
5376
// <example>
5477
* A bulleted list of links to other material closely related to the contents of the assembly, including xref links to other assemblies in your collection.
5578
* For more details on writing assemblies, see the link:https://github.com/redhat-documentation/modular-docs#modular-documentation-reference-guide[Modular Documentation Reference Guide].
5679
* Use a consistent system for file names, IDs, and titles. For tips, see _Anchor Names and File Names_ in link:https://github.com/redhat-documentation/modular-docs#modular-documentation-reference-guide[Modular Documentation Reference Guide].
5780
// </example>
5881

59-
// Restore the context to what it was before this assembly.
82+
////
83+
Restore the context to what it was before this assembly.
84+
////
6085
ifdef::parent-context-of-${module_id}[:context: {parent-context-of-${module_id}}]
6186
ifndef::parent-context-of-${module_id}[:!context:]
6287

templates/concept.adoc

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,28 @@
22
//
33
// <List assemblies here, each on a new line>
44

5-
// Base the file name and the ID on the module title. For example:
6-
// * file name: my-concept-module-a.adoc
7-
// * ID: [id="my-concept-module-a-{context}"]
8-
// * Title: = My concept module A
5+
////
6+
Base the file name and the ID on the module title. For example:
7+
* file name: con-my-concept-module-a.adoc
8+
* ID: [id="con-my-concept-module-a_{context}"]
9+
* Title: = My concept module A
10+
////
11+
12+
////
13+
The ID is an anchor that links to the module. Avoid changing it after the module has been published to ensure existing links are not broken.
14+
15+
The `context` attribute enables module reuse. Every module ID includes {context}, which ensures that the module has a unique ID so you can include it multiple times in the same guide.
16+
////
917

10-
// 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.
1118
[id="${module_id}_{context}"]
12-
// 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.
1319
= ${module_title}
14-
// 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.
15-
// Do not start the title of concept modules with a verb. See also _Wording of headings_ in _The IBM Style Guide_.
20+
////
21+
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. Do not start the title of concept modules with a verb. See also _Wording of headings_ in _The IBM Style Guide_.
22+
////
1623

24+
[role="_abstract"]
1725
// <example>
18-
A short introductory paragraph is required for the concept module.
19-
It will provide an overview of the module.
26+
Write a short introductory paragraph that provides an overview of the module. The text that immediately follows the `[role="_abstract"]` tag is used for search metadata.
2027

2128
The contents of a concept module give the user descriptions and explanations needed to understand and use a product.
2229

@@ -25,8 +32,11 @@ The contents of a concept module give the user descriptions and explanations nee
2532
* Do not include any instructions to perform an action, such as executing a command. Action items belong in procedure modules.
2633
// </example>
2734

35+
[role="_additional-resources"]
2836
.Additional resources
29-
37+
////
38+
Optional. Delete if not used.
39+
////
3040
// <example>
3141
* A bulleted list of links to other material closely related to the contents of the concept module.
3242
* Currently, modules cannot include xrefs, so you cannot include links to other content in your collection. If you need to link to another assembly, add the xref to the assembly that includes this module.

templates/procedure.adoc

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,67 @@
22
//
33
// <List assemblies here, each on a new line>
44

5-
// Base the file name and the ID on the module title. For example:
6-
// * file name: doing-procedure-a.adoc
7-
// * ID: [id="doing-procedure-a"]
8-
// * Title: = Doing procedure A
5+
////
6+
Base the file name and the ID on the module title. For example:
7+
* file name: proc-doing-procedure-a.adoc
8+
* ID: [id="doing-procedure-a_{context}"]
9+
* Title: = Doing procedure A
10+
11+
The ID is an anchor that links to the module. Avoid changing it after the module has been published to ensure existing links are not broken.
12+
13+
The `context` attribute enables module reuse. Every module ID includes {context}, which ensures that the module has a unique ID even if it is reused multiple times in a guide.
14+
////
915

10-
// 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.
1116
[id="${module_id}_{context}"]
12-
// 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.
1317
= ${module_title}
14-
// 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_.
18+
////
19+
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_.
20+
////
1521

22+
[role="_abstract"]
1623
// <example>
17-
This paragraph is the procedure module introduction: a short description of the procedure.
24+
Write a short introductory paragraph that provides an overview of the module. Procedure modules should include the steps that users perform and address user motivation.The text that immediately follows the `[role="_abstract"]` tag is used for search metadata.
1825
// </example>
1926

2027
.Prerequisites
2128

2229
// <example>
23-
* A bulleted list of conditions that must be satisfied before the user starts following this assembly.
24-
* You can also link to other modules or assemblies the user must follow before starting this assembly.
25-
* Delete the section title and bullets if the assembly has no prerequisites.
30+
* A bulleted list of conditions that must be satisfied before the user starts following this module.
31+
* You can also link to other modules or assemblies the user must follow before starting this module.
32+
* Delete the section title and bullets if the module has no prerequisites.
2633
// </example>
2734

2835
.Procedure
2936

3037
// <example>
3138
. Start each step with an active verb.
32-
. Include one command or action per step.
39+
40+
. Include one command or action for each step with the exception of simple follow-step, for example:
41+
.. Do this thing and then select *Next*.
42+
.. Do this other thing and then select *Next*.
43+
3344
. Use an unnumbered bullet (*) if the procedure includes only one step.
3445
// </example>
3546

3647
.Verification steps
48+
////
49+
Delete this section if it does not apply to your module. Provide the user with verification methods for the procedure, such as expected output or commands that confirm success or failure.
50+
////
3751

3852
// <example>
39-
. Optional: Provide the user with verification method(s) for the procedure, such as expected output or commands that can be used to check for success or failure.
53+
. Start each step with an active verb.
54+
55+
. Include one command or action per step.
56+
4057
. Use an unnumbered bullet (*) if the procedure includes only one step.
4158
// </example>
4259

43-
.Additional resources
4460

61+
[role="_additional-resources"]
62+
.Additional resources
63+
////
64+
Optional. Delete if not used.
65+
////
4566
// <example>
4667
* A bulleted list of links to other material closely related to the contents of the procedure module.
4768
* Currently, modules cannot include xrefs, so you cannot include links to other content in your collection. If you need to link to another assembly, add the xref to the assembly that includes this module.

templates/reference.adoc

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,26 @@
22
//
33
// <List assemblies here, each on a new line>
44

5-
// Base the file name and the ID on the module title. For example:
6-
// * file name: my-reference-a.adoc
7-
// * ID: [id="my-reference-a"]
8-
// * Title: = My reference A
5+
////
6+
Base the file name and the ID on the module title. For example:
7+
* file name: ref-my-reference-a.adoc
8+
* ID: [id="ref-my-reference-a_{context}"]
9+
* Title: = My reference A
10+
11+
The ID is an anchor that links to the module. Avoid changing it after the module has been published to ensure existing links are not broken.
12+
13+
The `context` attribute enables module reuse. Every module ID includes {context}, which ensures that the module has a unique ID even if it is reused multiple times in a guide.
14+
////
915

10-
// 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.
1116
[id="${module_id}_{context}"]
12-
// 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.
1317
= ${module_title}
14-
// 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.
18+
////
19+
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.
20+
////
1521

22+
[role="_abstract"]
1623
// <example>
17-
A short introductory paragraph is required for the reference module.
18-
It will provide an overview of the module.
19-
20-
A reference module provide data that users might want to look up, but do not need to remember.
24+
Write a short introductory paragraph that provides an overview of the module. The text that immediately follows the `[role="_abstract"]` tag is used for search metadata. A reference module provides data that users might want to look up, but do not need to remember.
2125
It has a very strict structure, often in the form of a list or a table.
2226
A well-organized reference module enables users to scan it quickly to find the details they want.
2327
AsciiDoc markup to consider for reference data:

0 commit comments

Comments
 (0)