.. _config_file-name:

!!!!!!!!!!!
config_file
!!!!!!!!!!!

.. meta::
  :keywords: config_file,the,xrst.toml,configuration,file,project_name,default,example,directory,project_directory,html_directory,tex_directory,rst_directory,other,generated,files,root_file,spell_package,heading,input_files,input_files.sh,html_theme_options,include_all,rst_epilog,rst_prolog,latex_macro,project_dictionary,not_in_index

.. _toml file: https://toml.io/en/

.. index:: config_file, xrst.toml, configuration

.. _config_file-title:

The xrst.toml Configuration File
################################
A `toml file`_ is used to configure xrst.

#. The default location for this file is ``xrst.toml`` .
   You can specify a different location using the
   :ref:`run_xrst@config_file` argument.
#. This file is a sequence of toml tables,
   if a table can only have one entry, the entry is named data.
#. Each table has a default value that is used when the table
   is not present in the toml file.
   All of the defaults below will be the same in future versions
   of xrst with the possible exception of the html theme options
   :ref:`config_file@html_theme_options@Default` .
#. All of the entries in a table have the same type
   as its corresponding default.
   If an entry has components, all of the comments have the same
   type as the default components.
   The html theme options default is one exception to this rule; see
   :ref:`config_file@html_theme_options` .

.. contents::
  :local:

.. index:: project_name

.. _config_file@project_name:

project_name
************
The only value in this table is the name of this project.

.. index:: default

.. _config_file@project_name@Default:

Default
=======

.. literalinclude:: ../../xrst/get_conf_dict.py
  :lines: 57-58
  :language: toml

.. _config_file@project_name@Example:

Example
=======

.. literalinclude:: ../../xrst.toml
  :lines: 6-7
  :language: toml

.. index:: directory

.. _config_file@directory:

directory
*********
This table specifies the locations of some xrst directories:

.. index:: project_directory

.. _config_file@directory@project_directory:

project_directory
=================
This *project_directory* can be an absolute path,
or a path relative to the location where the
:ref:`run_xrst@config_file` is located.
All of the other directories are specified relative to this directory.
The other directories may have ``../`` in their specifications; i.e.,
they do not need to be sub-directories of the project directory.
This directory must exists when xrst is run.

.. index:: html_directory

.. _config_file@directory@html_directory:

html_directory
==============
This is the directory, relative to the *project_directory*,
where the output files are stored when
:ref:`run_xrst@target` is ``html`` .
If *target* is html and this directory does not exist, it will be created.

.. index:: tex_directory

.. _config_file@directory@tex_directory:

tex_directory
=============
This is the directory, relative to the *project_directory*,
where the output files are stored when
:ref:`run_xrst@target` is ``tex`` .
If *target* is tex and this directory does not exist, it will be created.

.. index:: rst_directory

.. _config_file@directory@rst_directory:

rst_directory
=============
This is the directory, relative to the *project_directory*,
where xrst writes the rst files it extracts from the source code.
For each :ref:`begin_cmd@page_name` , the file
If this  directory does not exist, it will be created.

|space| *rst_directory*\ /\ *page_name*\ ``.rst``

is the RST file for the corresponding page. There is one exception
to this rule. If *page_name* ends with ``.rst``, the extra ``.rst``
is not added at the end.

.. index:: other, generated, files

.. _config_file@directory@rst_directory@Other Generated Files:

Other Generated Files
---------------------
See :ref:`auto_file-title` for the other files generated by ``xrst``
and placed in the *rst_directory*.

.. index:: default

.. _config_file@directory@Default:

Default
=======
Note that ``'.'`` below denotes the directory where the
:ref:`run_xrst@config_file` is located.

.. literalinclude:: ../../xrst/get_conf_dict.py
  :lines: 125-129
  :language: toml

.. _config_file@directory@Example:

Example
=======

.. literalinclude:: ../../xrst.toml
  :lines: 11-16
  :language: toml

.. index:: root_file

.. _config_file@root_file:

root_file
*********
This table maps each :ref:`begin_cmd@group_name`
to its root (top) xrst input file.
These file names are relative to the
:ref:`config_file@directory@project_directory` .
Multiple groups can use the same root file.

.. index:: default

.. _config_file@root_file@Default:

Default
=======

.. literalinclude:: ../../xrst/get_conf_dict.py
  :lines: 160-161
  :language: toml

Note that ``default`` corresponds to the
:ref:`begin_cmd@group_name@Default Group` and ``project.xrst``
is the default root file.

.. _config_file@root_file@Example:

Example
=======

.. literalinclude:: ../../xrst.toml
  :lines: 20-23
  :language: toml

.. index:: spell_package

.. _config_file@spell_package:

spell_package
*************
This str is either 'pyspellchecker' or 'pyenchant' .
These are the only spell checkers support so far.

.. index:: default

.. _config_file@spell_package@Default:

Default
=======

.. literalinclude:: ../../xrst/get_conf_dict.py
  :lines: 188-189
  :language: toml

.. _config_file@spell_package@Example:

Example
=======

.. literalinclude:: ../../xrst.toml
  :lines: 36-38
  :language: toml

.. index:: heading

.. _config_file@heading:

heading
*******
This table can be used to check that the underlining and overlining
of headings is consistent for all pages.
This table has two lists,
one named ``character`` the other named ``overline``.
These list must have the same length and only headings up the
that level are checked.
The elements of the character list have type string and are used
to check the underline character at each heading level.
The elements of the overline list have type Boolean and are used
to check if the heading is overlined at each heading level.
The first entry in each list is level zero and corresponds to
:ref:`page titles <heading_links@Labels@Level Zero@page_title>` .

.. index:: default

.. _config_file@heading@Default:

Default
=======

.. literalinclude:: ../../xrst/get_conf_dict.py
  :lines: 222-224
  :language: toml

.. _config_file@heading@Example:

Example
=======

.. literalinclude:: ../../xrst.toml
  :lines: 27-32
  :language: toml

.. index:: input_files

.. _config_file@input_files:

input_files
***********
This table is used to list the files that should be include in the
documentation if they have a :ref:`begin command<begin_cmd-name>`
for a group in :ref:`run_xrst@group_list` .
The only value in this table is a list of program commands.

Each program command is a list of strings.
The list is the program to execute followed by
the program's command line arguments in order.
The standard output for the program should be a space separated
list of file names to be checked.
If a file name has spaces in it, it should be surrounded by single
or double quotes.
The single and double quotes are not part of the file name.
If this list of strings is empty, no files are checked.

Each program is execute, in order, with the *project_directory*
as the current working directory.
The first program to return without an error is used for the list of files.
The intention here is that different programs
may be intended for different systems.

If the list of program commands is empty,
no checking of input file list is done.
If the list of program commands is non-empty,
and none of the program commands succeed,
a warning is printed.

.. index:: default

.. _config_file@input_files@Default:

Default
=======

.. literalinclude:: ../../xrst/get_conf_dict.py
  :lines: 272-275
  :language: toml

.. _config_file@input_files@Example:

Example
=======

.. literalinclude:: ../../xrst.toml
  :lines: 42-45
  :language: toml

.. index:: input_files.sh

.. _config_file@input_files@input_files.sh:

input_files.sh
==============

.. literalinclude:: ../../bin/input_files.sh
  :language: sh

.. index:: html_theme_options

.. _config_file@html_theme_options:

html_theme_options
******************
This table maps the :ref:`run_xrst@html_theme` to
the corresponding html_theme_options.
This enable building documentation with different themes without
having to change the toml file between builds.
If *html_theme* does not appear in this mapping, no options are set.

For each theme, the corresponding options are in a dictionary.
The keys of this dictionary are strings, but the values do not
necessarily have the same type as he default case.
In the default below, these values are integers and booleans.

.. index:: default

.. _config_file@html_theme_options@Default:

Default
=======
The html_theme_options default value below my change in the future.

.. literalinclude:: ../../xrst/get_conf_dict.py
  :lines: 315-320
  :language: toml

.. _config_file@html_theme_options@Example:

Example
=======

.. literalinclude:: ../../xrst.toml
  :lines: 49-55
  :language: toml

.. index:: include_all

.. _config_file@include_all:

include_all
***********
This table is used to create input that is included
at the beginning or end of every page.
This table has the following keys:

.. index:: rst_epilog

.. _config_file@include_all@rst_epilog:

rst_epilog
==========
The value corresponding to this key is a set of rst commands
that get included at the end of every section.
This is the same as the rst_epilog variable in the sphinx conf.py file.

.. index:: rst_prolog

.. _config_file@include_all@rst_prolog:

rst_prolog
==========
The value corresponding to this key is a set of rst commands
that get included at the beginning of every section.
This is the same as the rst_epilog variable in the sphinx conf.py file
except that the latex macros are added at the end when
:ref:`run_xrst@target` is html.

.. index:: latex_macro

.. _config_file@include_all@latex_macro:

latex_macro
===========
The value corresponding to this key is a list of latex macros.
If :ref:`run_xrst@target` is ``html``, these macros get included at the
beginning of every page using the sphinx ``:math`` role in the
rst_epilog variable in the sphinx conf.py file.
Otherwise *target* is ``tex`` and these macros get included once
at the beginning of the corresponding latex document.
It either case they can be used by every page in the documentation.

.. index:: default

.. _config_file@include_all@Default:

Default
=======

.. literalinclude:: ../../xrst/get_conf_dict.py
  :lines: 376-379
  :language: toml

.. _config_file@include_all@Example:

Example
=======

.. literalinclude:: ../../xrst.toml
  :lines: 59-68
  :language: toml

.. index:: project_dictionary

.. _config_file@project_dictionary:

project_dictionary
******************
The only value in this table is a list of strings.
Each string contains a newline separated list of words.
Leading and trailing white space is not part of each word.
These special words are not considered spelling errors for the entire project.
Special words, for a particular page, are specified using the
:ref:`spell command<spell_cmd-name>`.

.. index:: default

.. _config_file@project_dictionary@Default:

Default
=======

.. literalinclude:: ../../xrst/get_conf_dict.py
  :lines: 411-412
  :language: toml

.. _config_file@project_dictionary@Example:

Example
=======

.. literalinclude:: ../../xrst.toml
  :lines: 72-112
  :language: toml

.. index:: not_in_index

.. _config_file@not_in_index:

not_in_index
************
The only value in this table is a list of strings.
Each string  contains a newline separated list of patterns.
Leading and trailing white space is not part of each pattern.
These are python regular expression patterns for heading tokens
that are not included in the index.
A heading token is any sequence of non white space characters
with upper case letters converted to lower case.
For example, a heading might contain the token ``The`` but you
might not want to include ``the`` as a entry in the :ref:`genindex`.
In this case you could have a line containing just ``the`` .
For another example, you might want to exclude all tokens that are
integer numbers.
In this case you could have a line containing just ``[0-9]*`` .

.. index:: default

.. _config_file@not_in_index@Default:

Default
=======

.. literalinclude:: ../../xrst/get_conf_dict.py
  :lines: 446-447
  :language: toml

.. _config_file@not_in_index@Example:

Example
=======

.. literalinclude:: ../../xrst.toml
  :lines: 116-145
  :language: toml
