summaryrefslogtreecommitdiff
path: root/docs/users_guide/editing-guide.rst
diff options
context:
space:
mode:
authorPatrick Dougherty <patrick.doc@ameritech.net>2017-08-18 09:20:07 -0400
committerBen Gamari <ben@smart-cactus.org>2017-08-18 23:28:16 -0400
commitcf8ab1ced6f15dad03dd7bcc454ef759cf4d3b3d (patch)
treeeeb48abdaa020f02a3787d6225f2138b5c82b0ed /docs/users_guide/editing-guide.rst
parent6267d8c9e54663a23f0ac13556522a53580d0910 (diff)
downloadhaskell-cf8ab1ced6f15dad03dd7bcc454ef759cf4d3b3d.tar.gz
users_guide: Convert mkUserGuidePart generation to a Sphinx extension
This removes all dependencies the users guide had on `mkUserGuidePart`. The generation of the flag reference table and the various pieces of the man page is now entirely contained within the Spinx extension `flags.py`. You can see the man page generation on the orphan page https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghc.html The extension works by collecting all of the meta-data attached to the `ghc-flag` directives and then formatting and displaying it at `flag-print` directives. There is a single printing directive that can be customized with two options, what format to display (table, list, or block of flags) and an optional category to limit the output to (verbosity, warnings, codegen, etc.). New display formats can be added by creating a function `generate_flag_xxx` (where `xxx` is a description of the format) which takes a list of flags and a category and returns a new `xxx`. Then just add a reference in the dispatch table `handlers`. That display can now be run by passing `:type: xxx` to the `flag-print` directive. `flags.py` contains two maps of settings that can be adjusted. The first is a canonical list of flag categories, and the second sets default categories for files. The only functionality that Sphinx could not replace was the `what_glasgow_exts_does.gen.rst` file. `mkUserGuidePart` actually just reads the list of flags from `compiler/main/DynFlags.hs` which Sphinx cannot do. As the flag is deprecated, I added the list as a static file which can be updated manually. Additionally, this patch updates every single documented flag with the data from `mkUserGuidePart` to generate the reference table. Fixes #11654 and, incidentally, #12155. Reviewers: austin, bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #11654, #12155 Differential Revision: https://phabricator.haskell.org/D3839
Diffstat (limited to 'docs/users_guide/editing-guide.rst')
-rw-r--r--docs/users_guide/editing-guide.rst28
1 files changed, 23 insertions, 5 deletions
diff --git a/docs/users_guide/editing-guide.rst b/docs/users_guide/editing-guide.rst
index b57a5d12b9..ad49c8938c 100644
--- a/docs/users_guide/editing-guide.rst
+++ b/docs/users_guide/editing-guide.rst
@@ -347,11 +347,29 @@ Will be rendered as,
Sets the context switch interval to ⟨s⟩ seconds.
-and will have an associated index entry generated automatically. Note that, as
-in Style Conventions below, we use ``⟨⟩`` instead of less-than/greater-than
-signs. To reference a ``ghc-flag`` or ``rts-flag``, you must match the
-definition exactly, including the arguments. A quick way to find the exact
-names and special characters is,
+and will have an associated index entry generated automatically.
+
+The ``ghc-flag`` directive requires a few extra parameters to be passed.
+This extra information is used to generate the :ref:`flag-reference` and the
+man page. A ``ghc-flag`` directive looks like this,
+
+.. code-block:: rest
+
+ .. ghc-flag:: -fasm
+ :shortdesc: Use the native code generator
+ :type: dynamic
+ :reverse: -fllvm
+ :category: codegen
+
+ Regular description...
+
+When rendered, the extra parameters will be hidden, and the data stored for
+later use. For more details, see the Sphinx extension ``flags.py``.
+
+Note that, as in Style Conventions below, we use ``⟨⟩`` instead of
+less-than/greater-than signs. To reference a ``ghc-flag`` or ``rts-flag``, you
+must match the definition exactly, including the arguments. A quick way to find
+the exact names and special characters is,
.. code-block:: sh