chiark / gitweb /
documentation/python: rename brief to summary.
authorVladimír Vondruš <mosra@centrum.cz>
Sat, 4 May 2019 19:47:34 +0000 (21:47 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Sat, 4 May 2019 19:47:34 +0000 (21:47 +0200)
Another doxygen-ism. It made some sense for API docs, but having "brief"
and "description" for pages doesn't make any sense at all. Summary and
content makes much more sense for pages and since it doesn't make sense
to have two types of naming, let's rename it for everything else as
well. This is now also in-line with Pelican article metadata and XMLDoc
for C# docs, yay.

14 files changed:
doc/documentation/python.rst
documentation/python.py
documentation/templates/python/class.html
documentation/templates/python/classes.html
documentation/templates/python/details-enum.html
documentation/templates/python/entry-class.html
documentation/templates/python/entry-data.html
documentation/templates/python/entry-enum.html
documentation/templates/python/entry-function.html
documentation/templates/python/entry-module.html
documentation/templates/python/entry-property.html
documentation/templates/python/module.html
documentation/templates/python/modules.html
documentation/templates/python/pages.html

index 918f848e3c1fbf9aec3659dff982f2d8fac238fa..0c13aed92c7333960a62a1ddb827e0af661e8cae 100644 (file)
@@ -386,18 +386,18 @@ all found submodules in it are ignored.
 -------------
 
 The first paragraph of a module-level, class-level and function-level docstring
-is used as a brief documentation, copied as-is to the output without formatting
-it in any way.
+is used as a doc summary, copied as-is to the output without formatting it in
+any way.
 
 .. code:: py
 
-    """Module brief docs"""
+    """Module summary"""
 
     class Foo:
-        """Class brief docs"""
+        """Class summary"""
 
         def bar(self):
-            """Function brief docs"""
+            """Function summary"""
 
 .. block-warning:: Limitations
 
@@ -681,7 +681,7 @@ HTML markup without any additional escaping.
 ======================================= =======================================
 Property                                Description
 ======================================= =======================================
-:py:`page.brief`                        Brief docs
+:py:`page.summary`                      Doc summary
 :py:`page.url`                          File URL
 :py:`page.breadcrumb`                   List of :py:`(title, URL)` tuples for
                                         breadcrumb navigation.
@@ -754,7 +754,7 @@ Property                                Description
 ======================================= =======================================
 :py:`module.url`                        URL of detailed module documentation
 :py:`module.name`                       Module name
-:py:`module.brief`                      Brief docs
+:py:`module.summary`                    Doc summary
 ======================================= =======================================
 
 `Class properties`_
@@ -767,7 +767,7 @@ Property                                Description
 ======================================= =======================================
 :py:`class_.url`                        URL of detailed class documentation
 :py:`class_.name`                       Class name
-:py:`class_.brief`                      Brief docs
+:py:`class_.summary`                    Doc summary
 ======================================= =======================================
 
 `Enum properties`_
@@ -779,7 +779,7 @@ Property                                Description
 Property                                Description
 ======================================= =======================================
 :py:`enum.name`                         Enum name
-:py:`enum.brief`                        Brief docs
+:py:`enum.summary`                      Doc summary
 :py:`enum.base`                         Base class from which the enum is
                                         derived. Set to :py:`None` if no base
                                         class information is available.
@@ -800,7 +800,7 @@ Property                    Description
 :py:`value.name`            Value name
 :py:`value.value`           Value value. Set to :py:`None` if no value is
                             available.
-:py:`value.brief`           Value brief docs
+:py:`value.summary`         Value doc summary
 =========================== ===================================================
 
 `Function properties`_
@@ -812,7 +812,7 @@ Property                    Description
 Property                            Description
 =================================== ===========================================
 :py:`function.name`                 Function name
-:py:`function.brief`                Brief docs
+:py:`function.summary`              Doc summary
 :py:`function.type`                 Function return type annotation [1]_
 :py:`function.params`               List of function parameters. See below for
                                     details.
@@ -864,7 +864,7 @@ Property                            Description
 =================================== ===========================================
 :py:`property.name`                 Property name
 :py:`property.type`                 Property getter return type annotation [1]_
-:py:`property.brief`                Brief docs
+:py:`property.summary`              Doc summary
 :py:`property.is_writable`          If the property is writable
 :py:`property.is_deletable`         If the property is deletable with :py:`del`
 :py:`property.has_details`          If there is enough content for the full
@@ -882,7 +882,7 @@ Property                            Description
 =================================== ===========================================
 :py:`data.name`                     Data name
 :py:`data.type`                     Data type
-:py:`data.brief`                    Brief docs. Currently always empty.
+:py:`data.summary`                  Doc summary. Currently always empty.
 :py:`data.value`                    Data value representation
 :py:`data.has_details`              If there is enough content for the full
                                     description block. Currently always set to
@@ -929,7 +929,7 @@ Property                        Description
                                 :py:`'class'` or :py:`'page'`)
 :py:`i.name`                    Name
 :py:`i.url`                     URL of the file with detailed documentation
-:py:`i.brief`                   Brief documentation
+:py:`i.summary`                 Doc summary
 :py:`i.has_nestable_children`   If the list has nestable children (i.e., dirs
                                 or namespaces)
 :py:`i.children`                Recursive list of child entries
@@ -945,4 +945,4 @@ Module/class list is ordered in a way that all modules are before all classes.
     there is detailed description, function parameter documentation or
     *documented* enum value listing that makes it worth to render the full
     description block. If :py:`False`, the member should be included only in
-    the brief listing on top of the page to avoid unnecessary repetition.
+    the summary listing on top of the page to avoid unnecessary repetition.
index 032089d488fb6ae476a0356d2d7ddddee9efcb33..75157a56ac90c38ad13d5533fffc21879c256798 100755 (executable)
@@ -97,7 +97,7 @@ class IndexEntry:
         self.kind: str
         self.name: str
         self.url: str
-        self.brief: str
+        self.summary: str
         self.has_nestaable_children: bool = False
         self.children: List[IndexEntry] = []
 
@@ -227,10 +227,10 @@ def parse_pybind_signature(signature: str) -> Tuple[str, str, List[Tuple[str, st
             end = original_signature.find('\n')
             logging.warning("cannot parse pybind11 function signature %s", original_signature[:end])
             if end != -1 and len(original_signature) > end + 1 and original_signature[end + 1] == '\n':
-                brief = extract_brief(original_signature[end + 1:])
+                summary = extract_summary(original_signature[end + 1:])
             else:
-                brief = ''
-            return (name, brief, [('…', None, None)], None)
+                summary = ''
+            return (name, summary, [('…', None, None)], None)
 
         signature = signature[2:]
 
@@ -249,17 +249,17 @@ def parse_pybind_signature(signature: str) -> Tuple[str, str, List[Tuple[str, st
         end = original_signature.find('\n')
         logging.warning("cannot parse pybind11 function signature %s", original_signature[:end])
         if end != -1 and len(original_signature) > end + 1 and original_signature[end + 1] == '\n':
-            brief = extract_brief(original_signature[end + 1:])
+            summary = extract_summary(original_signature[end + 1:])
         else:
-            brief = ''
-        return (name, brief, [('…', None, None)], None)
+            summary = ''
+        return (name, summary, [('…', None, None)], None)
 
     if len(signature) > 1 and signature[1] == '\n':
-        brief = extract_brief(signature[2:])
+        summary = extract_summary(signature[2:])
     else:
-        brief = ''
+        summary = ''
 
-    return (name, brief, args, return_type)
+    return (name, summary, args, return_type)
 
 def parse_pybind_docstring(name: str, doc: str) -> List[Tuple[str, str, List[Tuple[str, str, str]], str]]:
     # Multiple overloads, parse each separately
@@ -290,7 +290,7 @@ def parse_pybind_docstring(name: str, doc: str) -> List[Tuple[str, str, List[Tup
     else:
         return [parse_pybind_signature(doc)]
 
-def extract_brief(doc: str) -> str:
+def extract_summary(doc: str) -> str:
     if not doc: return '' # some modules (xml.etree) have that :(
     doc = inspect.cleandoc(doc)
     end = doc.find('\n\n')
@@ -331,7 +331,7 @@ def extract_module_doc(path: List[str], module):
     out = Empty()
     out.url = make_url(path)
     out.name = path[-1]
-    out.brief = extract_brief(module.__doc__)
+    out.summary = extract_summary(module.__doc__)
     return out
 
 def extract_class_doc(path: List[str], class_):
@@ -340,7 +340,7 @@ def extract_class_doc(path: List[str], class_):
     out = Empty()
     out.url = make_url(path)
     out.name = path[-1]
-    out.brief = extract_brief(class_.__doc__)
+    out.summary = extract_summary(class_.__doc__)
     return out
 
 def extract_enum_doc(state: State, path: List[str], enum_):
@@ -354,9 +354,9 @@ def extract_enum_doc(state: State, path: List[str], enum_):
     if issubclass(enum_, enum.Enum):
         # Enum doc is by default set to a generic value. That's useless as well.
         if enum_.__doc__ == 'An enumeration.':
-            out.brief = ''
+            out.summary = ''
         else:
-            out.brief = extract_brief(enum_.__doc__)
+            out.summary = extract_summary(enum_.__doc__)
 
         out.base = extract_type(enum_.__base__)
 
@@ -367,11 +367,11 @@ def extract_enum_doc(state: State, path: List[str], enum_):
 
             # Value doc gets by default inherited from the enum, that's useless
             if i.__doc__ == enum_.__doc__:
-                value.brief = ''
+                value.summary = ''
             else:
-                value.brief = extract_brief(i.__doc__)
+                value.summary = extract_summary(i.__doc__)
 
-            if value.brief:
+            if value.summary:
                 out.has_details = True
                 out.has_value_details = True
             out.values += [value]
@@ -380,7 +380,7 @@ def extract_enum_doc(state: State, path: List[str], enum_):
     elif state.config['PYBIND11_COMPATIBILITY']:
         assert hasattr(enum_, '__members__')
 
-        out.brief = extract_brief(enum_.__doc__)
+        out.summary = extract_summary(enum_.__doc__)
         out.base = None
 
         for name, v in enum_.__members__.items():
@@ -390,7 +390,7 @@ def extract_enum_doc(state: State, path: List[str], enum_):
             # TODO: once https://github.com/pybind/pybind11/pull/1160 is
             #       released, extract from class docs (until then the class
             #       docstring is duplicated here, which is useless)
-            value.brief = ''
+            value.summary = ''
             out.values += [value]
 
     return out
@@ -406,13 +406,13 @@ def extract_function_doc(state: State, parent, path: List[str], function) -> Lis
     if state.config['PYBIND11_COMPATIBILITY'] and function.__doc__.startswith(path[-1]):
         funcs = parse_pybind_docstring(path[-1], function.__doc__)
         overloads = []
-        for name, brief, args, type in funcs:
+        for name, summary, args, type in funcs:
             out = Empty()
             out.name = path[-1]
             out.params = []
             out.has_complex_params = False
             out.has_details = False
-            out.brief = brief
+            out.summary = summary
 
             # Don't show None return type for void functions
             out.type = None if type == 'None' else type
@@ -489,7 +489,7 @@ def extract_function_doc(state: State, parent, path: List[str], function) -> Lis
         out.params = []
         out.has_complex_params = False
         out.has_details = False
-        out.brief = extract_brief(function.__doc__)
+        out.summary = extract_summary(function.__doc__)
 
         # Decide if classmethod or staticmethod in case this is a method
         if inspect.isclass(parent):
@@ -530,7 +530,7 @@ def extract_property_doc(state: State, path: List[str], property):
 
     out = Empty()
     out.name = path[-1]
-    out.brief = extract_brief(property.__doc__)
+    out.summary = extract_summary(property.__doc__)
     out.is_settable = property.fset is not None
     out.is_deletable = property.fdel is not None
     out.has_details = False
@@ -553,7 +553,7 @@ def extract_data_doc(parent, path: List[str], data):
     out = Empty()
     out.name = path[-1]
     # Welp. https://stackoverflow.com/questions/8820276/docstring-for-variable
-    out.brief = ''
+    out.summary = ''
     out.has_details = False
     if hasattr(parent, '__annotations__') and out.name in parent.__annotations__:
         out.type = extract_annotation(parent.__annotations__[out.name])
@@ -578,7 +578,7 @@ def render_module(state: State, path, module, env):
         breadcrumb += [(i, url_base + 'html')]
 
     page = Empty()
-    page.brief = extract_brief(module.__doc__)
+    page.summary = extract_summary(module.__doc__)
     page.url = breadcrumb[-1][1]
     page.breadcrumb = breadcrumb
     page.prefix_wbr = '.<wbr />'.join(path + [''])
@@ -594,7 +594,7 @@ def render_module(state: State, path, module, env):
     index_entry.kind = 'module'
     index_entry.name = breadcrumb[-1][0]
     index_entry.url = page.url
-    index_entry.brief = page.brief
+    index_entry.summary = page.summary
 
     # This is actually complicated -- if the module defines __all__, use that.
     # The __all__ is meant to expose the public API, so we don't filter out
@@ -744,7 +744,7 @@ def render_class(state: State, path, class_, env):
         breadcrumb += [(i, url_base + 'html')]
 
     page = Empty()
-    page.brief = extract_brief(class_.__doc__)
+    page.summary = extract_summary(class_.__doc__)
     page.url = breadcrumb[-1][1]
     page.breadcrumb = breadcrumb
     page.prefix_wbr = '.<wbr />'.join(path + [''])
@@ -763,7 +763,7 @@ def render_class(state: State, path, class_, env):
     index_entry.kind = 'class'
     index_entry.name = breadcrumb[-1][0]
     index_entry.url = page.url
-    index_entry.brief = page.brief
+    index_entry.summary = page.summary
 
     # Get inner classes
     for name, object in inspect.getmembers(class_, lambda o: inspect.isclass(o) and not is_enum(state, o)):
index 7bbcf1a72242b42ca0aff0ab8d7158b12cf71e7e..be622826a6305989aca22d3d892dc0fe6fbc8e66 100644 (file)
@@ -14,8 +14,8 @@
         <h1>
           {%+ for name, target in page.breadcrumb[:-1] %}<span class="m-breadcrumb"><a href="{{ target }}">{{ name }}</a>.<wbr/></span>{% endfor %}{{ page.breadcrumb[-1][0] }} <span class="m-thin">class</span>
         </h1>
-        {% if page.brief %}
-        <p>{{ page.brief }}</p>
+        {% if page.summary %}
+        <p>{{ page.summary }}</p>
         {% endif %}
         {% if page.classes or page.classmethods or page.staticmethods or page.methods or page.dunder_methods or page.properties or page.data %}
         <div class="m-block m-default">
index af1d68bd32e953b6243bb6d425180b239a1862b6..2f9404ddd5437ea259fe3ce3d0136b86f8274b82 100644 (file)
@@ -7,13 +7,13 @@
           {% for i in index.classes recursive %}
           {% if i.children %}
           <li class="m-doc-collapsible{% if loop.depth > CLASS_INDEX_EXPAND_LEVELS or (i.kind != 'module' and not CLASS_INDEX_EXPAND_INNER) %} collapsed{% endif %}">
-            <a href="#" onclick="return toggle(this)">{{ i.kind }}</a> <a href="{{ i.url }}" class="m-doc">{{ i.name }}</a> <span class="m-doc">{{ i.brief }}</span>
+            <a href="#" onclick="return toggle(this)">{{ i.kind }}</a> <a href="{{ i.url }}" class="m-doc">{{ i.name }}</a> <span class="m-doc">{{ i.summary }}</span>
             <ul class="m-doc">
 {{ loop(i.children)|indent(4, true) }}
             </ul>
           </li>
           {% else %}
-          <li>{{ i.kind }} <a href="{{ i.url }}" class="m-doc">{{ i.name }}</a>{% if i.is_final %} <span class="m-label m-flat m-warning">final</span>{% endif %} <span class="m-doc">{{ i.brief }}</span></li>
+          <li>{{ i.kind }} <a href="{{ i.url }}" class="m-doc">{{ i.name }}</a>{% if i.is_final %} <span class="m-label m-flat m-warning">final</span>{% endif %} <span class="m-doc">{{ i.summary }}</span></li>
           {% endif %}
           {% endfor %}
         </ul>
index 50fb94d74ecce8941edcfa1a632d74b653fbebaf..aac8f6c9192541237879560a4dc36a1b6b574c2b 100644 (file)
@@ -2,8 +2,8 @@
             <h3>
               class {{ prefix }}<a href="" class="m-doc-self">{{ enum.name }}</a>({{ enum.base }})
             </h3>
-            {% if enum.brief %}
-            <p>{{ enum.brief }}</p>
+            {% if enum.summary %}
+            <p>{{ enum.summary }}</p>
             {% endif %}
             {% if enum.has_value_details %}
             <table class="m-table m-fullwidth m-flat m-doc">
@@ -13,8 +13,8 @@
                 <tr>
                   <td><a href="" class="m-doc-self">{{ value.name }}</a></td>
                   <td>
-                  {% if value.brief %}
-                  <p>{{ value.brief }}</p>
+                  {% if value.summary %}
+                  <p>{{ value.summary }}</p>
                   {% endif %}
                   </td>
                 </tr>
index a294f4898117df082fc882822cccc37b6b3924fc..8eb07ec1c46b63a671fa1c72c276328208cc4529 100644 (file)
@@ -1,2 +1,2 @@
             <dt>class <a href="{{ class.url }}" class="m-doc">{{ class.name }}</a>{% if class.is_deprecated %} <span class="m-label m-danger">deprecated</span>{% endif %}</dt>
-            <dd>{{ class.brief }}</dd>
+            <dd>{{ class.summary }}</dd>
index d4e4d8818c685b5f7c940506b9abb01be6fb738b..3e351daa12d7b1c732171714ef180d4e17a6119f 100644 (file)
@@ -3,4 +3,4 @@
               {# This has to be here to avoid the newline being eaten #}
 
             </dt>
-            <dd>{{ data.brief }}</dd>
+            <dd>{{ data.summary }}</dd>
index 1dc1c712c4212c940d57e63444c65904a8a12a2e..773a0aa6c6becc185bfc32dda55a98776bedf826 100644 (file)
@@ -2,4 +2,4 @@
               {% set j = joiner('\n              ') %}
               <span class="m-doc-wrap-bumper">class <a href="" class="m-doc{% if not enum.has_details %}-self{% endif %}">{{ enum.name }}</a>{% if enum.base %}({{ enum.base }}){% endif %}: </span><span class="m-doc-wrap">{% for value in enum.values %}{{ j() }}<a href="" class="m-doc{% if not enum.has_details %}-self{% endif %}">{{ value.name }}</a>{% if value.value is not none %} = {{ value.value }}{% endif %}{% endfor %}</span>
             </dt>
-            <dd>{{ enum.brief }}</dd>
+            <dd>{{ enum.summary }}</dd>
index c5f43ab3b2b300c3a506d4348f9427a3e0f99fd6..245f3c19cd8f5b0c34a5ca17aa6c5700b194d499 100644 (file)
@@ -2,4 +2,4 @@
               {% set j = joiner('\n              ' if function.has_complex_params else ' ') %}
               <span class="m-doc-wrap-bumper">def <a href="" class="m-doc{% if not function.has_details %}-self{% endif %}">{{ function.name }}</a>(</span><span class="m-doc-wrap">{% for param in function.params %}{% if loop.index0 %}{% if function.params[loop.index0 - 1].kind == 'POSITIONAL_OR_KEYWORD' and param.kind == 'KEYWORD_ONLY' %},<span class="m-text m-dim"> *,</span>{% else %},{% endif %}{% endif %}{{ j() }}{% if param.kind == 'VAR_POSITIONAL' %}*{% elif param.kind == 'VAR_KEYWORD' %}**{% endif %}{{ param.name }}{% if param.type %}: {{ param.type }}{% endif %}{% if param.default %} = {{ param.default }}{% endif %}{% if param.kind == 'POSITIONAL_ONLY' and (loop.last or function.params[loop.index0 + 1].kind != 'POSITIONAL_ONLY') %}<span class="m-text m-dim">, /</span>{% endif %}{% endfor %}){% if function.type %} -&gt; {{ function.type }}{% endif %}</span>
             </dt>
-            <dd>{{ function.brief }}</dd>
+            <dd>{{ function.summary }}</dd>
index 504066dea70e6a61a9b7eebf241427547bbc3bc6..6b810001bd7334b9e0e1d36dace1d3ed2434cc72 100644 (file)
@@ -1,2 +1,2 @@
             <dt>module <a href="{{ module.url }}" class="m-doc">{{ module.name }}</a>{% if module.is_deprecated %} <span class="m-label m-danger">deprecated</span>{% endif %}</dt>
-            <dd>{{ module.brief }}</dd>
+            <dd>{{ module.summary }}</dd>
index 8abe1146d06971e7f8dc9067c3b04481efcfbb0a..78852ee84803dcd140256b3d079cb6fba7baa46a 100644 (file)
@@ -1,4 +1,4 @@
             <dt>
               <a href="" class="m-doc{% if not property.has_details %}-self{% endif %}">{{ property.name }}</a>{% if property.type %}: {{ property.type }}{% endif %} <span class="m-label m-flat {% if property.is_settable %}m-success{% else %}m-warning{% endif %}">get{% if property.is_settable %} set{% endif %}{% if property.is_deletable %} del{% endif %}</span>
             </dt>
-            <dd>{{ property.brief }}</dd>
+            <dd>{{ property.summary }}</dd>
index 0721ba7a59332f3353fb6042757012c559ca2039..440b8f36b78b9a5425219837e9102bf5d0efe693 100644 (file)
@@ -14,8 +14,8 @@
         <h1>
           {%+ for name, target in page.breadcrumb[:-1] %}<span class="m-breadcrumb"><a href="{{ target }}">{{ name }}</a>.<wbr/></span>{% endfor %}{{ page.breadcrumb[-1][0] }} <span class="m-thin">module</span>
         </h1>
-        {% if page.brief %}
-        <p>{{ page.brief }}</p>
+        {% if page.summary %}
+        <p>{{ page.summary }}</p>
         {% endif %}
         {% if page.modules or page.classes or page.functions or page.data %}
         <div class="m-block m-default">
index 2a8334716a18259c30f43d4affe7b10cd96260a5..0e8f614fe1a2413be3756ca1b35065156a370471 100644 (file)
@@ -7,13 +7,13 @@
           {% for i in index.classes|selectattr('kind', 'equalto', 'module') recursive %}
           {% if i.children %}
           <li class="m-doc-collapsible">
-            <a href="#" onclick="return toggle(this)">{{ i.kind }}</a> <a href="{{ i.url }}" class="m-doc">{{ i.name }}</a> <span class="m-doc">{{ i.brief }}</span>
+            <a href="#" onclick="return toggle(this)">{{ i.kind }}</a> <a href="{{ i.url }}" class="m-doc">{{ i.name }}</a> <span class="m-doc">{{ i.summary }}</span>
             <ul class="m-doc">
 {{ loop(i.children|selectattr('kind', 'equalto', 'module'))|indent(4, true) }}
             </ul>
           </li>
           {% else %}
-          <li>{{ i.kind }} <a href="{{ i.url }}" class="m-doc">{{ i.name }}</a> <span class="m-doc">{{ i.brief }}</span></li>
+          <li>{{ i.kind }} <a href="{{ i.url }}" class="m-doc">{{ i.name }}</a> <span class="m-doc">{{ i.summary }}</span></li>
           {% endif %}
           {% endfor %}
         </ul>
index e109dfd422d12058753c76d8e77e64019a810a57..25c40990510d93d35faf85048082542642d66dc2 100644 (file)
@@ -7,13 +7,13 @@
           {% for i in index.pages recursive %}
           {% if i.children %}
           <li class="m-doc-collapsible">
-            <a href="#" onclick="return toggle(this)"></a><a href="{{ i.url }}" class="m-doc">{{ i.name }}</a> <span class="m-doc">{{ i.brief }}</span>
+            <a href="#" onclick="return toggle(this)"></a><a href="{{ i.url }}" class="m-doc">{{ i.name }}</a> <span class="m-doc">{{ i.summary }}</span>
             <ul class="m-doc">
 {{ loop(i.children)|indent(4, true) }}
             </ul>
           </li>
           {% else %}
-          <li><a href="{{ i.url }}" class="m-doc">{{ i.name }}</a> <span class="m-doc">{{ i.brief }}</span></li>
+          <li><a href="{{ i.url }}" class="m-doc">{{ i.name }}</a> <span class="m-doc">{{ i.summary }}</span></li>
           {% endif %}
           {% endfor %}
         </ul>