lines 6-335 of file: xrst/run_xrst.py {xrst_begin run_xrst user} {xrst_spell dev furo github jax pdf rtd thet toc toml txt wil } Extract RST Files And Run Sphinx ################################ Syntax ****** | ``xrst`` \\ | |tab| [ ``--version`` ] \\ | |tab| [ ``--local_toc`` ] \\ | |tab| [ ``--page_source`` ] \\ | |tab| [ ``--replace_spell_commands`` ] \\ | |tab| [ ``--suppress_spell_warnings`` ] \\ | |tab| [ ``--continue_with_warnings`` ] \\ | |tab| [ ``--rst_line_numbers`` ] \\ | |tab| [ ``--rst_only`` ] \\ | |tab| [ ``--index_page_name`` *index_page_name* ] \\ | |tab| [ ``--config_file`` *config_file* ] \\ | |tab| [ ``--html_theme`` *html_theme* ] \\ | |tab| [ ``--target`` *target* ] \\ | |tab| [ ``--number_jobs`` *number_jobs* ] \\ | |tab| [ ``--group_list`` *group_name_1* *group_name_2* ... ] \\ | |tab| [ ``--rename_group`` *old_group_name* *new_group_name* ] \\ #. The brackets around each of lines above indicate that the line is optional. #. The lines above can appear in any order. #. Text in code font; e.g. ``--target`` is explicit; i.e., must appear exactly as above. #. Text in italic font; .e.g, *target* is implicit; i.e., it gets replaced by the user's choice. #. It may be helpful to remove the :ref:`config_file@directory@html_directory` before running the command below. This will check for error messages that are not repeated due to caching the results of previous builds. {xrst_comment --------------------------------------------------------------- } version ******* If ``--version`` is present on the command line, the version of xrst is printed and none of the other arguments matter. {xrst_comment --------------------------------------------------------------- } local_toc ********* If this option is present on the command line, a table of contents for the Headings in the current page is included at the top of every page. The page name and page title are not in this table of contents. Some :ref:`html themes` include this information on a side bar; e.g., ``furo`` and ``sphinx_book_theme`` . {xrst_comment --------------------------------------------------------------- } page_source *********** If this option is present and *target* is ``html`` , a link to the xrst source code is included at the top of each page. Some :ref:`html themes` include this link; e.g., ``sphinx_rtd_theme`` . If this option is present and *target* is ``tex`` , the xrst source code file is reported at the beginning of each page. {xrst_comment --------------------------------------------------------------- } replace_spell_commands ********************** If this option is present on the command line, the source code :ref:`spell commands` are replaced in such a way that the there will be no spelling warnings during future processing by xrst. #. This is useful when there are no spelling warnings before a change to the :ref:`config_file@project_dictionary` or when there is an update to the :ref:`config_file@spell_package` . #. This is also useful when there are no spelling warnings and you want to sort the words in all the spelling commands. #. If this option is present, none of the output files are created; e.g., the \*.rst and \*.html files. See also :ref:`config_file@project_dictionary` . {xrst_comment --------------------------------------------------------------- } suppress_spell_warnings *********************** If this option is present on the command line, none of the spelling warnings will be generated. This is useful when there are no spelling warnings with one spelling package and you are temporarily using a different version of the package or a different package altogether. {xrst_comment --------------------------------------------------------------- } continue_with_warnings ********************** If this option is (is not) present on the command line, the program will not exit (will exit) with an error when warnings are generated. {xrst_comment --------------------------------------------------------------- } rst_line_numbers **************** Normally sphinx error and warning messages are reported using line numbers in the xrst source code files. If this option is present, these messages are reported using the line numbers in the RST files created by xrst. In addition the :ref:`run_xrst@page_source` links to the rst files, instead of the xrst source files. This may be helpful if you have an error or warning for a sphinx command and it does not make sense using xrst source code line numbers. It is also helpful for determining if an incorrect line number is due to sphinx or xrst. {xrst_comment --------------------------------------------------------------- } rst_only ******** Normally, after extraction the RST files, xrst automatically runs sphinx to produce the target output (html or tex). If this option is present, sphinx is not run. Only the rst files, and their corresponding sources, are generated; i.e., | |tab| :ref:`config_file@directory@rst_directory`/\*.rst | |tab| *rst_directory*\ /_sources/\*.txt This may be useful when creating rst files for uses else where; e.g., for use with `Read the Docs `_ (see :ref:`.readthedocs.yaml-name` for a better way to use Read the Docs.) The sphinx commands are printed after xrst finishes and can be executed by hand. This may be useful if there is a problem during these commands. {xrst_comment --------------------------------------------------------------- } index_page_name *************** This option has no effect when *target* is ``tex`` . If *target* is ``html``, the file ``index.html`` in the :ref:`config_file@directory@html_directory` will be a redirect to the page specified by *index_page_name* . If this option is not present, ``index.html`` wil be a redirect to the root of the documentation tree. {xrst_comment --------------------------------------------------------------- } config_file *********** The command line argument *config_file* specifies the location of the :ref:`config_file-name` for this project. This can be an absolute path or relative to the directory where :ref:`xrst` is run. xrst.toml ========= If *config_file* is not present on the command line, the default value ``xrst.toml`` is used for *config_file* . {xrst_comment --------------------------------------------------------------- } html_theme ********** This the html_theme_ that is used. The default value for *html_theme* is ``furo`` . .. _html_theme: https://sphinx-themes.org/ Theme Choices ============= The following is a list of some themes that work well with the default settings in :ref:`config_file@html_theme_options` . If you have a theme together with html_theme_options that work well with xrst, please post an issue on github so that it can be added to the list below. {xrst_spell_off} .. csv-table:: Sphinx Themes :header: name, local_toc sphinx_rtd_theme, yes furo, no sphinx_book_theme, no pydata_sphinx_theme, no piccolo_theme, no {xrst_spell_on} sphinx_rtd_theme ================ The sphinx_rtd theme builds faster than some of the other themes, so it is suggested to use it for testing (with the ``--local_toc`` option). A special modification is made to this theme when *target* is html, so that it displays wider than its normal limit. This modification may be removed in the future. {xrst_comment --------------------------------------------------------------- } target ****** The command line argument *target* must be ``html`` or ``tex``. It specifies the type of type output you plan to generate using sphinx. Note thet :ref:`config_file@directory@html_directory` and :ref:`config_file@directory@tex_directory` will determine the location of the corresponding output files. The default value for *target* is ``html`` . tex === If you choose this target, xrst will create the file *project_name*\ ``.tex`` in the :ref:`config_file@directory@tex_directory` . There are two reasons to build this file. One is to create the file *project_name*\ ``.pdf`` which is a pdf version of the documentation. The other is to test for errors in the latex sections of the documentation. (MathJax displays latex errors in red, but one has to check every page that has latex to find all the errors this way.) Once you have built *project_name*\ ``.tex``, the following command executed in :ref:`config_file@directory@project_directory` will accomplish both purposes: make -C *tex_directory* *project_name*\ ``.pdf`` #. The :ref:`config_file@project_name` is specified in the configuration file. #. The resulting output file will be *project*\ ``.pdf`` in the *tex_directory* . #. If a Latex error is encountered, the pdf build will stop with a message at the ``?`` prompt. If you enter ``q`` at this prompt, it will complete its processing in batch mode. You will be able to find the error messages in the file *project_name*\ ``.log`` in the *tex_directory* . #. Translating Latex errors to the corresponding xrst input file: #. Latex error messages are reported using line numbers in the file *project*\ ``.tex`` . #. You may be able to find the corresponding xrst input file using by using ``grep`` to find text that is near the error. #. The page numbers in the :ref:`xrst_table_of_contents-title` are present in the latex input (often near ``section*{`` above the error) and may help translate these line numbers to page names. #. Given a page name, the corresponding xrst input file can be found at the top of the html version of the page. {xrst_comment --------------------------------------------------------------- } number_jobs *********** This is a positive integer specifying the number of parallel jobs that xrst is allowed to use. The default value for *number_jobs* is ``1`` . {xrst_comment --------------------------------------------------------------- } group_list ********** It is possible to select one or more groups of pages to include in the output using this argument. #. The *group_list* is a list of one or more :ref:`group names`. #. The :ref:`begin_cmd@group_name@Default Group` is represented by the group name ``default`` . #. The order of the group names determines their order in the resulting output. #. The default value for *group_list* is ``default`` . For each group name in the *group_list* there must be an entry in :ref:`config_file@root_file` specifying the root file for that group name. The xrst examples are a subset of its user documentation and its user documentation is a subset of its developer documentation. For each command, the same source code file provides both the user and developer documentation. In addition, the developer documentation has links to the user documentation and the user documentation has links to the examples. Example ======= The examples commands below assume you have cloned the `xrst git repository `_ and it is your current working directory. #. The xrst examples use the default group and their documentation can be built using ``xrst --group_list default`` #. The xrst user documentation uses the default and user groups and its documentation can be built using ``xrst --group_list default user`` #. The xrst developer documentation uses the default, user, and dev groups and its documentation can be built using ``xrst --group_list default user dev`` {xrst_comment --------------------------------------------------------------- } rename_group ************ If this option is present on the command line, the :ref:`begin_cmd@group_name` in a subset of the source code, is changed. This option replaces the :ref:`run_xrst@group_list` by the list whose only entry is *new_group_name* . None of the output files are created when rename_group is present; e.g., the \*.rst and \*.html files. old_group_name ============== is the old group name for the pages that will have their group name replaced. Use ``default``, instead of the empty group name, for the :ref:`begin_cmd@group_name@Default Group` . new_group_name ============== Only the pages below the :ref:`config_file@root_file` for *new_group_name* are modified. You can rename a subset of the old group by making the root file for the new group different than the root file for the old group. Each page in the old group, and below the root file for the new group, will have its group name changed from *old_group_name* to *new_group_name*. Use ``default``, instead of the empty group name, for the :ref:`begin_cmd@group_name@Default Group` . {xrst_comment --------------------------------------------------------------- } {xrst_end run_xrst}