The Apache OFBiz Project // (1) :imagesdir: ./images // (2) ifdef::backend-pdf[] // (3) :title-logo-image: image::OFBiz-Logo.svg[Apache OFBiz Logo, pdfwidth=4.25in, align=center] // (4) :source-highlighter: rouge // (5) endif::[] // (6)
18 mai 2021
These guidelines serve as a general style guide and collection of examples of how we are documenting the project. This is intentionally not a complete user manual, but lists the subset of functionality and formatting options we would like to use.
For further reference and more examples see
If you would like to help out with the documentation of the project, please see the following wiki page [5] for further information and how we are organised.
Documents that will be published as standalone guides (e.g. developer manual, user manual) should contain common configuration so that the output will be generated in exactly the same way for all documents.
Note
|
This is not necessary for documents that will only be included as part of parent documents. In this case the documents will inherit the configuration from the parent. |
Please see below for details of the proposed configuration:
The Apache OFBiz Project // (1) :imagesdir: ./images // (2) ifdef::backend-pdf[] // (3) :title-logo-image: image::OFBiz-Logo.svg[Apache OFBiz Logo, pdfwidth=4.25in, align=center] // (4) :source-highlighter: rouge // (5) endif::[] // (6)
author
global definition of the image directory
begin block of configurations only for pdf rendering
define the title logo image
use the Rouge source code highlighter
end block of configurations only for PDF rendering
The following configuration options are set globally in the Gradle build file. They are not configured in the document itself and are listed for reference only:
'doctype': 'book', // (1) 'revnumber': 'Trunk', // (2) 'experimental': '', // (3) 'icons': 'font', // (4) 'sectnums': '', // (5) 'chapter-label': '', // (6) 'toc': '', // (7) 'toclevels': '5' // (8)
doctype book
target release, indicates the release for which the documentation is valid
allow experimental features like keyboard shortcuts
make font awesome icons available
number chapters and sections automatically
do not prefix the chapters
insert a table of contents
max levels to show in the table of contents
Each .adoc file must contain the Apache license header (put between "//// license… ////"). You can just copy the following block:
//// Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ////
There are one main file per application (located in the 'src/docs/asciidoc' directory), which include some other files located in 'src/docs/asciidoc/_include'.
src |- docs |- asciidoc |- _include |- images |- ${componentName}
So, for include file use
include::_include/xxxxxxx
and for image, it’s necessary to add on top of main file
:imagesdir: ./images/${compnentName}
and so include them with
image::/xxxxxxx
During generating process images are copied on the root asciidoc/images directory
We will be implementing a consistent naming convention for the documentation content files.
Filenames should be in lower case with the extension .adoc
.
Each guide will be named after the component / module name (e.g. humanres.adoc, accounting.adoc, manufacturing.adoc,
party.adoc etc).
Lower level files that are in the include directory will include a prefix/shortname indicating the component name,
separated by dashes (e.g hr-intro.adoc
, hr-glossary.adoc
, etc.)
Similar pages will have consistent naming. We will have several intro, glossary, FAQ, settings, security pages,
so the naming format will be ([shortname]-intro, [shortname]-glossary, [shortname]-faq, [shortname]-settings,
[shortname]-security etc.)
humanres.adoc |- hr-intro.adoc |- hr-employee-evaluations.adoc |- hr-glossary.adoc |- hr-employee-positions.adoc |- hr-employees.adoc |- hr-employments.adoc |- hr-performance-review.adoc |- hr-positions.adoc |- hr-qualifications.adoc |- hr-recruitment.adoc |- hr-skills.adoc |- hr-resumes.adoc |- hr-training.adoc |- hr-leave.adoc |- hr-security.adoc |- hr-global-settings.adoc
It is recommended to write one sentence per line and/or manually break the line after approximately 80 to 120 characters.
Section titles will use asymmetric atx style
(e.g. == This is an example of an Asymmetric Section Title
)
When including another file using the include
directive, please ensure that there is a blank line between each
include line.
Words and phrases can be formatted by enclosing inline text with quote characters:
Word phrases enclosed in 'single quote characters' (acute accents) or underline characters are emphasized.
Word phrases enclosed in asterisk characters are rendered in a strong font (usually bold).
Word phrases enclosed in plus characters are rendered in a monospaced font.
Word phrases enclosed in backtick characters
(grave accents) are also rendered in a monospaced font but in this case
the enclosed text is rendered literally and is not subject to further expansion (see inline literal passthrough).
Phrases enclosed with a `single grave accent to the left and a single acute accent to the right' are rendered in single quotation marks.
Phrases enclosed with ``two grave accents to the left and two acute accents to the right'' are rendered in quotation marks.
Placing hashes around text does nothing, it is a mechanism to allow inline attributes to be applied to otherwise unformatted text.
You can indicate special information with an eye catching symbol. Please don’t overuse this (less is more).
[TIP] This is a tip or idea.
Tip
|
This is a tip or idea. |
You can also have multiple lines and empty lines inside the paragraph using a whitespace and a plus sign:
[TIP] This is a tip or idea. + This is another idea. + + More ideas...
Tip
|
This is a tip or idea. This is another idea. More ideas… |
[NOTE] This is an information note.
Note
|
This is an information note. |
[IMPORTANT] This indicates important information.
Important
|
This indicates important information. |
[WARNING] This is a warning or something to pay attention to.
Warning
|
This is a warning or something to pay attention to. |
[CAUTION] This is something you should treat with caution.
Caution
|
This is something you should treat with caution. |
[normal] This is a Normal paragraph.
This is a Normal paragraph.
[literal] This is a Literal paragraph.
This is a Literal paragraph.
[quote] This is a Quote paragraph.
This is a Quote paragraph.
[listing] This is a Listing paragraph.
This is a Listing paragraph.
[abstract] This is an Abstract paragraph.
This is an Abstract paragraph.
[comment] This is a Comment paragraph. It does not show up in the rendered text ;-)
[example] This is a Example paragraph.
[sidebar] This is a Sidebar paragraph.
[source] This is a Source paragraph. See Code formatting for further examples.
This is a Source paragraph. See Code formatting for further examples.
This is the text for the simple description headline
Just a simple block example.
You can also define keyboard shortcuts with the kbd
macro.
kbd:[Alt+F11] - Toggle Full Screen Mode in the Eclipse IDE
The result is the following:
kbd:[Alt+F11] - Toggle Full Screen Mode in the Eclipse IDE
The result will be different depending on the rendering (PDF, HTML).
You can also add the :icons: font
directive to the top of your document, which allows you to use the icons
from http://fortawesome.github.io/Font-Awesome/icons/ directory via a macro using any of the following icon sets:
fa - https://fontawesome.com/v4.7.0/icons (default)
fas - Font Awesome - Solid
fab - Font Awesome - Brands
far - Font Awesome - Regular
fi - Foundation Icons
pf - Payment font
The fa icon set is deprecated. Please use one of the other three FontAwesome icon sets.
when icon is not available in fa icon set but in an other, it’s possible to give the correct set.
The generate Document process generate a INFOS message, if icon is available in an other set and it is not given.
icon:comment[set=far] This is a comment icon icon:file[set=far] And a file icon icon:battery-full[set=fas] And a battery icon
Asciidoc and the used highlighter provide support for code syntax highlighting of several programming languages and formats. The following are examples for code which is widely used within OFBiz.
[source,java] ---- public class Foo { public String bar; public String bar() { return bar; } } ----
Renders to
public class Foo {
public String bar;
public String bar() {
return bar;
}
}
public class Foo {
public String bar;
public String bar() {
return bar;
}
}
public class Foo {
public String bar; # (1)
public String bar() {
return bar; # (2)
}
}
Declares the bar
field
Returns the bar
value
selected = UtilHttp.parseMultiFormData(parameters)
selected.each { row ->
payment = from("Payment").where("paymentId", row.paymentId).queryOne()
if (payment) {
payments.add(payment)
}
}
context.payments = payments
<author id="1">
<personname>
<firstname>Lazarus</firstname>
<surname>het Draeke</surname>
</personname>
</author>
body {
background: transparent url(/images/ofbiz_logo.png) no-repeat scroll left top;
color: #000;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: .75em;
line-height: 1.5em;
padding: 50px 0 0;
bgcolor: #ffffcc;
}
function msg(){
alert("Hello OFBiz");
}
{
"id": 1,
"name": "A green door",
"price": 12.50,
"tags": ["home", "green"]
}
foo = bar
SELECT * FROM FOO;
<!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body style="background-color: rgb(255, 255, 255);">
<h1>Headline</h1>
</body>
</html>
You can import files via the include macro.
This also works for source code includes.
It’s possible to use [listing] ---- before include to have the correct style.
The following example imports a file formatted as Java source code.
[source,java] ---- include::resource/source.java[] ----
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
System.out.println("Hello");
Via the leveloffset
attribute you can change the section offset, for example a =
section will become ==
if you
add the following statement :leveloffset: 1
.
Use :leveloffset: 0
to reset the offset.
It is also possible to include partial files. For this, please mark the part of the file to be included with a tag similar to the following:
# tag::tagname[] This should be included! # end::tagname[] This text will not be included!
and include the file with the tagname in the brackets like this:
include::resource/article.adoc[tags=tagname]
The result would be
This should be included!
You can import images with
image::
For the HTML output you can add the alt text within the brackets []. If the image is located in the images folder then the import would look like this:
image::OFBiz-Logo.svg[Apache OFBiz Logo, pdfwidth=3.0in, align=left]
Result:
Please notice that the images folder is specified in the document header configuration and is therefore not provided here again.
The import of an image with image::
will add the image in a new line.
If you want to add an image to be inline then use the macro image:
This is just a text image:OFBiz-Logo.svg[Apache OFBiz Logo, width=40%] to show inline images.
Result:
This is just a text to show inline images.
FAQ’s and glossaries should be written as a labeled list. For hyperlinking, they should also have an ID which can be linked within a list.
For example
<<faq_entry_1,FAQ entry 1>> <<faq_entry_2,FAQ entry 2>> [#faq_entry_1] FAQ entry 1:: This is entry #1 in our example FAQ. [#faq_entry_2] FAQ entry 2:: This is entry #2 in our example FAQ.
Renders to
This is entry #1 in our example FAQ.
This is entry #2 in our example FAQ.
There is one Glossary per Component and a General Glossary in user-manual.
For glossary entries ID should be in Uppercase with space replace by "_"
You can deactivate the counter for a section:
:sectnums!: == Preface :sectnums: == First Chapter