Skip to main content

A script to generate assembly and module AsciiDoc files from templates.

Project description

# README: The newdoc script

## How do I install the script?

The script is now compatible with both Python 3 (for Fedora and community distributions) and Python 2.7 (for RHEL 7 and macOS).

It hasn’t been tested on Windows.

To install newdoc, use the pip package manager:

` $ pip --user install newdoc `

## How do I add a new module?

  1. In the directory where modules are located, use the newdoc script to create a new file:

` _modules-dir_]$ newdoc _--procedure_ "_Setting up thing_" `

The script also accepts the –concept and –reference options. You can use these short forms instead: -p, -c, and -r.

  1. Rewrite the information in the template with your docs.

## How do I add a new assembly?

  1. In the directory where assemblies are located, use the newdoc script to create a new file:

` _assemblies-dir_]$ newdoc --assembly "_Achieving thing_" `

You can use the short form of the option instead: newdoc -a “_Achieving thing_”.

  1. Rewrite the information in the template with your docs.

Add AsciiDoc include statements to include modules. See [Include Files](https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#include-files) in the AsciiDoc Syntax Quick Reference.

## Configuration

newdoc enables you to configure multiple aspects of its behavior:

  • Custom templates for assemblies and modules,

  • How IDs are capitalized when converted from a title,

  • What symbol is used to replace spaces in IDs.

These options can be set in the newdoc.ini configuration file, which is located:

  • On Fedora, RHEL, and other Linux distributions, in ~/.config/newdoc/newdoc.ini

  • On macOS, in ~/Library/Preferences/newdoc/newdoc.ini

The configuration file is not created automatically: if you want to set custom options, create it using a plain text editor.

The file must always start with the [newdoc] header. An example configuration is available in this repo at examples/newdoc.ini.

### Custom templates

In the config file, you can set paths to custom AsciiDoc template files for each module type. The options are:

  • assembly_template

  • concept_template

  • procedure_template

  • reference_template

For example, to use a custom template for reference modules, use:

` reference_template = _~/.config/newdoc/my-reference-template.adoc_ `

newdoc performs substitutions on the templates using the Python string.template library. The following strings are replaced:

  • ${module_title} with the entered title of the module

  • ${module_id} with the generated ID of the module

  • ${filename} with the generated file name of the module

For more details on the template syntax, see: link:https://docs.python.org/3/library/string.html#template-strings[]

### ID substitutions

  • The id_case option in the config file controls how the letter case should change from the title to the ID:

id_case = lowercase:: All letters in the ID will be lower-case id_case = capitalize:: The first letter will be upper-case, the rest lower-case id_case = preserve:: Keep the capitalization as entered in the title

  • The word_separator option lets you choose the symbol (or string) used to replace spaces in the ID. The default is a dash:

` word_separator = - `

## Notes

  • If you prefer newdoc to generate file without the explanatory comments, add the –no-comments or -C option when creating documents.

## Additional resources

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

newdoc-1.2.2-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

newdoc-1.2.2-py2-none-any.whl (9.6 kB view details)

Uploaded Python 2

File details

Details for the file newdoc-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: newdoc-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.9.1 pkginfo/1.3.2 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.19.6 CPython/3.6.6

File hashes

Hashes for newdoc-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4a858e8ff4a17b7937418e04408faba68560a97758cfa47f82892c41ffa8f84a
MD5 c6c6b16b1a49c8ad9648defb7b710267
BLAKE2b-256 37560ef1d57c0c12c6555b09878d29b091e2a1bd7735bf0d0ba463f4ebaf7483

See more details on using hashes here.

File details

Details for the file newdoc-1.2.2-py2-none-any.whl.

File metadata

  • Download URL: newdoc-1.2.2-py2-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.9.1 pkginfo/1.3.2 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.19.6 CPython/3.6.6

File hashes

Hashes for newdoc-1.2.2-py2-none-any.whl
Algorithm Hash digest
SHA256 ce8fb2f634805f9201a61cd3452104c674a491fe9399500fcad2e1d72efb689c
MD5 eefbec8994345700f3170eae47fe6f66
BLAKE2b-256 f5b08123009b41f1e0097511c69bfc9c0ddfac10d09fec0967cbd9a2b80f307f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page