API
_copyFiles(srcFolder, destFolder)
Collects images to include in the documenatation.
Copies them from the source to the destination folder.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
srcFolder |
str
|
The source folder(s) (where images are located) |
required |
destFolder |
str
|
The destination folder (where the documentation is built) |
required |
_makeClean(destFolder)
Deletes previously collected and built files.
Deletes all .html, .png, and .gif files within the destination folder.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
destFolder |
str
|
The destination folder (where the documentation is built) |
required |
getID(html)
Returns the ID of the current section.
The value of the first a-element's name attribute is assumed to be the ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
html |
str
|
The HTML snippet to get the next ID from |
required |
Returns:
Type | Description |
---|---|
str
|
The next ID found in the snippet |
getName(html)
Returns the name of the current section.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
html |
str
|
The HTML snippet to get the next name from |
required |
Returns:
Type | Description |
---|---|
str
|
The next name found in the snippet |
main(arguments=None)
The main method using parameter from the command line.
The application deletes previously collected and build .html, .png, and .gif-files within the folder defined by --destination. Then, it copies .png and .gif-files from the folders defined using --files into the destination folder.
It then reads the HTML-file generated from DocBook defined using --input and processes it. Processing means here that the file is split at sections and appendices. Each subpart is written into the destination folder defined using --destination and included in the table of contents (toc). The paths to references images as defined using --files are replaced by the destination path defined using --destination. In addition, the headers are included in the list of keywords.
Then, the qhp-templated defined using --template is loaded and the placeholders (see above) are replaced by the given / collected data.
db2qthelp generates a qhcp file afterwards as "<DESTINATION_FOLDER>/<APPLICATION_NAME>.qhcp".
Finally, the script calls two QtHelp processing applications which must be located in the folder defined using --path:
<QT_PATH>/qhelpgenerator <APPLICATION_NAME>.qhp -o <APPLICATION_NAME>.qch <QT_PATH>/qcollectiongenerator <APPLICATION_NAME>.qhcp -o <APPLICATION_NAME>.qhc
Parameters:
Name | Type | Description | Default |
---|---|---|---|
arguments |
List[str]
|
The command line arguments, parsed as options using OptionParser. |
None
|
Options
The following options must be set:
--input / -i <DOCBOOK_HTML>: Defines the DocBook HTML document to parse
--appname / -a <APPLICATION_NAME>: Sets the name of the application
--source / -s <ADDITIONAL_FILES_FOLDER>: Sets the documentation source url
The following options are optional:
--files / -f <ADDITIONAL_FILES_FOLDER>[,<ADDITIONAL_FILES_FOLDER>]*: Sets the folder(s) to collect files from
--destination / -d <DESTINATION_FOLDER>: Sets the output folder
--template / -t <TEMPLATE_FILE>: Defines the QtHelp project template to use; default: 'template.qhp'
--generate / -g: If set, the template is written to the file as defined by --template; The application quits afterwards
--path / -p <QT_PATH>: Sets the path to the Qt binaries to use
--help: Prints the help screen
writeSectionsRecursive(c, srcFolder, destFolder, sourceURL, fdo_content, level)
Writes the given section and it's sub-sections recursively.
The id and the name of the section are retrieved, first.
Then, the toc HTML file is extended and the reference to this section is appended to the returned toc. Keywords are extended by the section's name.
The section is then split along the '<div class="sect<INDENT>">' elements which are processed recursively.
The (recursively) collected keywords and toc are returned.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
c |
str
|
The (string) content of the DocBook book section or appendix |
required |
srcFolder |
List[str]
|
The source folder(s) (where images are located) |
required |
destFolder |
str
|
The destination folder (where the documentation is built) |
required |
sourceURL |
str
|
The URL of the built QtHelp pages |
required |
fdo_content |
file
|
The content output file |
required |
level |
int
|
intendation level |
required |
Returns:
Type | Description |
---|---|
Tuple[str, str]: The table of content and the collected keywords |