- Technical updates to reflect new project structure.
- Addition of project structure section to explain project relationships.
- General readability improvements.
Signed-off-by: Jeff Scheel <scheel@us.ibm.com>
<title>Example of code citations and user input</title>
<para>When showing user input, you want a nice sceen-looking layout, a prompt, monospace text, and a way to differentiate input from output. Here's an example:
<para>Docbook also allows for formatting and display of common languages, allowing for whitespace
and line returns just as they are written. Here's a sample snippet of C code with line numbering enabled:<programlisting linenumbering="numbered"><![CDATA[#include<stdio.h>
<para>Maven/docbkx failures generally fall into one of two categories, validation errors or build failures. Correcting the document begins with understanding which type of failure has occurred and understanding where to look in your document source.</para>
<para>Maven/docbkx failures generally fall into these categories:</para>
<para>Correcting the document errors starts with understanding which type of failure has occurred and
understanding where to look in your document source.</para>
<section>
<title>Project structure errors</title>
<para>Because the OpenPOWER Foundation documentation projects are not self-contained in the
GitHub repositories, forgetting to clone the <literal>Docs-Master</literal> project in addition
to the document project or cloning it in the wrong location is a common problem. Failures of this kind
produce the following error:</para>
<screen>...
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project org.openpowerfoundation.docs:workgroup-pom:1.0.0-SNAPSHOT (/home/scheel/Docs-Template/pom.xml) has 1 error
[ERROR] Non-resolvable parent POM: Could not find artifact org.openpowerfoundation.docs:master-pom:pom:1.0.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 6, column 11 -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
<para>The location within the file of the syntax error. For the above example, the key information is "<literal>lineNumber: 272; columnNumber: 70</literal>.</para>
@ -35,6 +79,12 @@ lineNumber: 272; columnNumber: 70; text not allowed here; expected element "add
<para>An explanation of the failure. This information in the above error reads, "text not allowed here; expected element "address", ...".</para>
</listitem>
</orderedlist>
</section>
<section>
<title>Build failures</title>
<para>Build errors are easily identified as well. Below is an example:
[ERROR] Failed to execute goal org.openpowerfoundation.docs:openpowerdocs-maven-plugin:1.0.0:generate-webhelp (generate-webhelp) on project openpower-template-guide: Execution generate-webhelp of goal org.openpowerfoundation.docs:openpowerdocs-maven-plugin:1.0.0:generate-webhelp failed: XInclude resource error (sec_template_new_document.xml) and no fallback provided. XProc error err:XD0011: org.xml.sax.SAXParseException; systemId: file:/home/user1/openpower-foundation-docbkx-framework/doc/template/sec_template_new_document.xml; lineNumber: 55; columnNumber: 17; The element type "para" must be terminated by the matching end-tag "</para>". -> [Help 1]...
</screen></para>
<para>Like validation errors, three key pieces of information are again provided:</para>
<orderedlist>
<listitem>
<para>The full path and filename of our failure is
<para>The location within the file of the error is "<literal>lineNumber: 55; columnNumber: 17</literal>.</para>
</listitem>
<listitem>
<para>An explanation of the failure begins with the text, "The element type "para" must be terminated by the matching end-tag "</para>."</para>
<para>An explanation of the failure begins with the text, "The element type "para" must be terminated by the
matching end-tag "</para>."</para>
</listitem>
</orderedlist>
<para>With these details in hand for either error, one simply locates the offending syntax and makes the appropriate correction. Online resources such as those listed in <xref linkend="section_template_references"/> may be helpful.</para>
<para>With these details in hand for either error, one simply locates the offending syntax and makes the appropriate
correction. Online resources such as those listed in <xref linkend="section_template_references"/> may be helpful.</para>
<para>To obtain a copy of the existing template document framework and all public documents from the
public OpenPOWER git repository, simply clone the project using this command:<screen><prompt>$</prompt><userinput>git clone https://github.com/open-power/openpower-foundation-docbkx-framework.git</userinput>
Cloning into 'openpower-foundation-docbkx-framework'...
<para>To build a document such as the template guide, follow these steps from the directory where you just cloned:<screen><prompt>$</prompt><userinput>cd openpower-foundation-docbkx-framework/doc/template</userinput>
<para>If all goes well, the generated pdf should be available in <literal>~/openpower-foundation-docbkx-framework/doc/template/target/docbkx/webhelp/template-guide/</literal>.</para>
<prompt>$ </prompt></screen></para>
<note><para>The permutations of Maven invocations may be combined into one operation where the parameters are specified in the order
in which one wishes to execute them. Thus, the command <literal>mvn clean generate-sources</literal> would accomplish the
same thing as the above sequence of commands.</para></note>
<para>If all goes well, the generated pdf should be available in <literal>~/Docs-Template/template/target/docbkx/webhelp/template-guide/</literal>.</para>
<para>For assistance correcting commmon build failures, see <xref linkend="section_template_debug"/>.</para>
<note><para>Projects may contain multiple documents. While specific documents can be built by executing a
<literal>mvn clean generate-sources</literal> in the specific document directory, executing this command in
the base project directory will build all projects identified in the <literal><module></literal> list in the
top-level <literal>pom.xml</literal> file, known as the "workgroup-pom".</para></note>
<para>To successfully build OpenPOWER Foundation documents, common document files must be in place in addition to the specific
document files. These common files are obtained by cloning the OpenPOWER Foundation public project <literal>Docs-Master</literal>.</para>
<para>To clone the master template document framework use the clone git command:<screen><prompt>$ </prompt><userinput>git clone https://github.com/OpenPOWERFoundation/Docs-Master.git</userinput>
<para>Creating a new document from scratch follows four simple steps:</para>
<orderedlist>
<listitem>
<para>Clone the appropriate template document framework.</para>
</listitem>
<listitem>
<para>Copy the template directory into a new project directory.</para>
</listitem>
<listitem>
<para>Modify core project files.</para>
</listitem>
<listitem>
<para>Begin adding document content, either from scratch or from another document.</para>
</listitem>
<listitem>
<para>Cloning the project source.</para>
</listitem>
<listitem>
<para>Finding a document framework.</para>
</listitem>
<listitem>
<para>Modifying core project files.</para>
</listitem>
<listitem>
<para>Adding new document content.</para>
</listitem>
</orderedlist>
<section>
<title>Cloning the base document framework</title>
<para>All new projects need to begin by cloning the appropriate documentation template. The template document project resides at <link xlink:href="https://github.com/open-power/openpower-foundation-docbkx-framework.git">https://github.com/open-power/openpower-foundation-docbkx-framework.git</link>. This template should be used for both private and public OpenPOWER Foundation documents.</para>
<para>To clone the existing template document framework use the clone git command:<screen><prompt>$</prompt><userinput>git clone https://github.com/open-power/openpower-foundation-docbkx-framework.git</userinput>
Cloning into 'openpower-foundation-docbkx-framework'...
<para>This command clones the head of the git tree into your current working directory. If successful, the contents of the current directory should now include a new <literal>openpower-foundation-docbkx-framework</literal> directory.</para>
</section>
<prompt>$ </prompt></screen> The results should look roughly something like above with actual numbers of objects, files, etc. varying
for different projects.</para>
<note><para>Private projects prompt for a GitHub userid and and password. When cloning public projects, these prompts
are skipped.</para></note>
<para>The base project has now been cloned.</para>
</section>
<section>
<title>Copying the template directory into a new project directory</title>
<para>To create a new document directory, follow these steps:</para>
<title>Finding a document framework</title>
<para>If this is your first document, in a brand new project (git tree), you have the fewest number of steps
to perform because your project should have been primed with a single project based on <literal>Docs-Template</literal>.
You can verify this by inspecting
the files in your project directory. A new project will contain a <literal>template</literal> directory, a <literal>pom.xml
</literal> file, a <literal>LICENSE</literal> file, and a <literal>README.md</literal> file. If this is the case, you simply
need to perform the following three steps:</para>
<orderedlist>
<listitem>
<para>Navigate down to the <literal>doc</literal> sub-directory. On Linux and Mac OS command lines, this can be achieved using the <literal>cd</literal> command:
<para>This directory should contain at least two directories, one named <literal>doc</literal> and another <literal>template</literal>, as well as a <literal>pom.xml</literal> file.</para>
<listitem>
<para>Navigate down to your project directory, called <literal>my_project</literal> for this example. This can be achieved
<para>This directory should contain the <literal>template</literal> folder used to prime the project.</para>
</listitem>
<listitem>
<para>To create a new project directory, simply create a new directory and copy the contents of the <literal>template</literal> directory. If creating a new project named <literal>my_proj</literal> via a command line in Linux or Mac OS, the command sequence would look like this:
<para>Once copied, the Docs-Template directory and all its contents should be removed from your project so that it does accidentally get
included in your project. The command <userinput>rm -rf Docs-Template</userinput></para>
</listitem>
<listitem>
<para>Finally, add the new project to the workgroup POM.xml file. Using your editor, add the following lines
between the <modules> and the </modules> tags near the top of the file:<programlisting><![CDATA[<module>my_doc</module>
]]></programlisting></para>
</listitem>
</orderedlist>
</section>
<section>
<note><para>Before committing the project back to git, you will need to add the new directory to the git repository. This can
be performed using the <literal>git add my_doc/</literal> command on the whole directory.</para></note>
<warning><para></para></warning>
<para>You are now ready to begin making updates to your new document. The next section will provided detailed steps of where to
get started.</para>
</section>
<section xml:id="section_modifying_project">
<title>Modifying core project files</title>
<para>The first step to customizing a new project is to modify two core project files--<literal>pom.xml</literal> and <literal>bk_main.xml</literal>. Within these two files are XML comment tags that begin "<literal><!-- TODO:</literal>" to identify places which need customization. The surrounding comments will provide guidance on what needs to change and how it may be changed. Simply work through each item, making updates as requested.</para>
<note><para>Be sure to remember two key values you used in the <literal>pom.xml</literal> file, <literal><webhelpDirname></literal> and <literal><pdfFilenameBase></literal>, as these will be used to locate your generated document.</para></note>
<para>When complete, be sure to build your new document using standard maven commands like this:<screen><prompt>$</prompt><userinput>cd openpower-foundation-docbkx-framework/doc/template</userinput>
<para>If all goes well, the new generated pdf should be available in <literal>target/docbkx/webhelp/<webhelpDirname>/<pdfFilenameBase>.pdf</literal>.</para>
<prompt>$ </prompt></screen></para>
<para>If all goes well, the new generated pdf should be available in
<para>For assistance correcting commmon build failures, see <xref linkend="section_template_debug"/>.</para>
<note><para>The permutations of Maven invocations may be combined into one operation where the parameters are specified in the order
in which one wishes to execute them. Thus, the command <literal>mvn clean generate-sources</literal> would accomplish the
same thing as the above sequence of commands.</para></note>
</section>
<section>
<title>Adding new content</title>
<para>The starting point for book content is the <literal>bk_main.xml</literal> file (or whatever to which it was renamed in the previous step). Removal and additions of the main chapter files files will be controlled by entries near the end of that file which appear as follows:<programlisting><![CDATA[ <!-- The ch_preface.xml file is required by all documents -->
<xi:include href="../common/ch_preface.xml"/>
<section>
<title>Adding new content</title>
<para>The starting point for book content is the <literal>bk_main.xml</literal> file (or whatever to which it was renamed
in the previous step). Removal and additions of the main chapter files files will be controlled by entries near the
end of that file which appear as follows:<programlisting><![CDATA[ <!-- The ch_preface.xml file is required by all documents -->
<!-- TODO: The following template document may be modified to create additional appendices -->
<!-- TODO: The following template document may be modified to create additional appendices as needed. -->
<xi:include href="app_template.xml"/>
]]></programlisting></para>
<para>Copying and modifying existing files from the template or other documents is a great way to get started. When creating whole new chapter or appendix files from scratch, the <literal>ch_example.xml</literal> and <literal>app_template.xml</literal> files may serve as excellent starting points. For XML examples of various document structures, please see <xref linkend="section_template_examples"/> and its supporting source files in this document. Online resources such as those listed in <xref linkend="section_template_references"/> may also be helpful.</para>
<note><para>When creating new files for the project, remember to use the <literal>git add <file name></literal> command to add new files to the git tree.</para></note>
<para>Copying and modifying existing files from the template or other documents is a great way to get started. When creating
whole new chapter or appendix files from scratch, the <literal>ch_example.xml</literal> and <literal>app_template.xml</literal> files
may serve as excellent starting points. For XML examples of various document structures, please see <xref linkend="section_template_examples"/>
and its supporting source files in this document. Online resources such as those listed in <xref linkend="section_template_references"/>
may also be helpful.</para>
<note><para>When creating new files for the project, remember to use the <literal>git add <file name></literal> command to
<para>Most document style policies are established simply by using the template documentation framework. However, by applying some conventions to the document source structure, community members will be able to work across more documentation projects.</para>
<para>Most document style policies are established simply by using the template documentation framework. However,
by applying some conventions to the document source structure, community members will be able to work across more d
ocumentation projects.</para>
<para>The recommended documentation structure guidelines are as follows:
<orderedlist>
<listitem>
<para>The head book file should be named with the prefix "bk_".</para>
</listitem>
<listitem>
<para>The document versioning as defined by the <literal>releaseinfo</literal> tag in the main book file <literal>bk_xxx</literal> should be named "Revision N.N", not "Version N.N" or simply "N.N"</para>
<para>The document versioning as defined by the <literal>releaseinfo</literal> tag in the main book
file <literal>bk_xxx</literal> should be named "Revision N.N", not "Version N.N" or simply "N.N"</para>
</listitem>
<listitem>
<para>Chapters files should be named with the prefix "ch_".</para>