dmr Configuration and Command Line Arguments

dmr configuration parsing is done in several phases:

  1. Command-line arguments are parsed to get the -c (config file) option. All core options are parsed in order to give a good help message, but that’s the only one we care about in this phase.
  2. /etc/dmr.conf or the file specified with -c is parsed
  3. $HOME/.dmr/config is parsed, and overwrites settings from /etc/dmr.conf
  4. Core command-line arguments are re-parsed, and overwrite the settings in config files.
  5. Once the output format is known, options specific to the output format are parsed from the config files.
  6. Output format options are parsed from the command line.
  7. Options are parsed from the document that is being rendered.

Each phase overwrites values that were read in the previous phase.

Some options can take multiple values --exclude. These are specified differently depending on where they are configured:

On the command line, give multiple option strings:

dmr --exclude foo --exclude "bar and baz"

In the config file, use a quoted, space-separated list:

.. code-block:: cfg
[global] exclude = foo “bar and baz”

In the document, give multiple option strings:

In-document options are specified as comments. For instance:

.. options
   footer
   exclude Experience

You can specify options for a specific output format thusly:

.. options=json
   footer
   exclude Experience

Output-specific options override generic in-document options.

See ConfigParser.RawConfigParser.getboolean() for acceptable values for boolean configuration options.

Global configuration options

All of the options below may be configured in the [global] section of the config file.

Command line Config file In Document Description Default Values
--config -c N/A N/A Specify a config file /etc/dmr.conf string
--footer footer footer Include a footer in the document with the DMR version False boolean
--no-footer N/A no-footer Override a default footer setting. False boolean
--verbose -v verbose N/A Be verbose. Specify this multiple times on the command line, or higher values in the config file, to increase verbosity. 0 int
--format -f output_format N/A Specify the output format html html, json, latex
--exclude exclude exclude Exclude the named sections or groups from the output. See Exclusions for more details. None multiple strings
--include include include Include the named sections or groups from the output. See Exclusions for more details. None multiple strings
--outfile -o outfile N/A Path to the output file. Specify - for stdout. stdout string
First positional argument infile N/A Path to the input file. Specify - for stdin. stdin string

Output format configuration options

Individual output formatters can have their own configuration options. These options are generally set in a section of the config file named after the output format, although there are some sections (see, e.g., Genshi output options).

JSON output options

This option is configured in the [json] section of the config file.

Command line Config file Description Default Values
--pretty pretty Output prettified JSON False boolean

Genshi output options

All output formats that use Genshi may use the following options. (Currently, that’s just the LaTeX output format.)

Command line Config file Description Default Values
--template-path template_path in [genshi] Path to Genshi template directory See below string
--template template in output format section Template to use, relative to the template path See below string

The default template path is platform-specific, but will generally be something like /usr/share/dmr/templates. ~/.dmr/templates is also checked, regardless of what you specify for the template path.

The default template is <output name>.genshi, where <output name> is the all-lowercase name of the output format. For the LaTeX output, for instance, the default template is latex.genshi.

Example

[global]
footer = yes
verbose = 1
format = latex
infile = resume.rst
outfile = resume.tex

[json]
pretty = yes

[genshi]
template_path = /usr/share/dmr/templates

[latex]
template = myresume.genshi

Project Versions

Table Of Contents

Previous topic

dmr Output Formats

Next topic

dmr API

This Page