Repository: html5lib/html5lib-python

Issue:
1.1: sphinx warnings about `reference target not found`
On building my packages I'm using `sphinx-build` command with `-n` switch which shows warmings about missing references. These are not critical issues.
Here is the output with warnings:
```console
+ /usr/bin/sphinx-build -n -T -b man doc build/sphinx/man
Running Sphinx v4.5.0
making output directory... done
building [mo]: targets for 0 po files that are out of date
building [man]: all manpages
updating environment: [new config] 10 added, 0 changed, 0 removed
reading sources... [100%] movingparts
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
writing... python-html5lib.3 { movingparts modules html5lib html5lib.filters html5lib.treebuilders html5lib.treewalkers html5lib.treeadapters changes license } /home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/movingparts.rst:7: WARNING: py:class reference target not found: html5lib.serializer.HTMLSerializer
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/movingparts.rst:18: WARNING: py:mod reference target not found: xml.etree
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/movingparts.rst:23: WARNING: py:mod reference target not found: xml.dom.minidom
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/movingparts.rst:25: WARNING: py:mod reference target not found: lxml.etree
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/movingparts.rst:61: WARNING: py:class reference target not found: html5lib.serializer.HTMLSerializer
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/movingparts.rst:86: WARNING: py:class reference target not found: html5lib.serializer.HTMLSerializer
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/movingparts.rst:160: WARNING: py:mod reference target not found: chardet
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/html5lib.rst:7: WARNING: py:mod reference target not found: constants
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/html5lib.rst:14: WARNING: py:mod reference target not found: html5parser
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/html5lib.rst:22: WARNING: py:mod reference target not found: serializer
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/html5lib/serializer.py:docstring of html5lib.serializer.serialize:9: WARNING: py:class reference target not found: html5lib.serializer.HTMLSerializer
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/html5lib.filters.rst:4: WARNING: py:mod reference target not found: base
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/html5lib.filters.rst:12: WARNING: py:mod reference target not found: alphabeticalattributes
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/html5lib/filters/alphabeticalattributes.py:docstring of html5lib.filters.alphabeticalattributes.Filter:1: WARNING: py:class reference target not found: html5lib.filters.base.Filter
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/html5lib.filters.rst:20: WARNING: py:mod reference target not found: inject_meta_charset
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/html5lib/filters/inject_meta_charset.py:docstring of html5lib.filters.inject_meta_charset.Filter:1: WARNING: py:class reference target not found: html5lib.filters.base.Filter
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/html5lib.filters.rst:28: WARNING: py:mod reference target not found: lint
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/html5lib/filters/lint.py:docstring of html5lib.filters.lint.Filter:1: WARNING: py:class reference target not found: html5lib.filters.base.Filter
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/html5lib.filters.rst:36: WARNING: py:mod reference target not found: optionaltags
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/html5lib/filters/optionaltags.py:docstring of html5lib.filters.optionaltags.Filter:1: WARNING: py:class reference target not found: html5lib.filters.base.Filter
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/html5lib.filters.rst:44: WARNING: py:mod reference target not found: sanitizer
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/html5lib/filters/sanitizer.py:docstring of html5lib.filters.sanitizer.Filter:1: WARNING: py:class reference target not found: html5lib.filters.base.Filter
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/html5lib.filters.rst:52: WARNING: py:mod reference target not found: whitespace
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/html5lib/filters/whitespace.py:docstring of html5lib.filters.whitespace.Filter:1: WARNING: py:class reference target not found: html5lib.filters.base.Filter
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/html5lib.treebuilders.rst:4: WARNING: py:mod reference target not found: treebuilders
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/html5lib.treebuilders.rst:12: WARNING: py:mod reference target not found: base
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/html5lib.treebuilders.rst:20: WARNING: py:mod reference target not found: dom
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/html5lib.treebuilders.rst:28: WARNING: py:mod reference target not found: etree
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/html5lib.treebuilders.rst:36: WARNING: py:mod reference target not found: etree_lxml
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/html5lib.treewalkers.rst:4: WARNING: py:mod reference target not found: treewalkers
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/html5lib.treewalkers.rst:12: WARNING: py:mod reference target not found: base
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/html5lib.treewalkers.rst:20: WARNING: py:mod reference target not found: dom
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/html5lib.treewalkers.rst:28: WARNING: py:mod reference target not found: etree
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/html5lib.treewalkers.rst:36: WARNING: py:mod reference target not found: etree_lxml
/home/tkloczko/rpmbuild/BUILD/html5lib-python-1.1/doc/html5lib.treewalkers.rst:44: WARNING: py:mod reference target not found: genshi
done
build succeeded, 35 warnings.
```



Discussion:

Patch:
diff --git a/CHANGES.rst b/CHANGES.rst
index 3ed63a9..f28caa8 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,6 +1,13 @@
 Change Log
 ----------
 
+1.2
+~~~
+
+Bug fixes:
+
+* The sanitizer now permits ``<summary>`` tags.
+
 1.1
 ~~~
 
@@ -22,7 +29,6 @@ Other changes:
   ``html5lib`` keeps working in future Python versions. (#403)
 * Drop optional ``datrie`` dependency. (#442)
 
-
 1.0.1
 ~~~~~
 
diff --git a/doc/conf.py b/doc/conf.py
index 22ebab4..d5a1e86 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -19,7 +19,8 @@ import os
 
 # Add any Sphinx extension module names here, as strings. They can be extensions
 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.viewcode']
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.viewcode',
+              'sphinx.ext.intersphinx']
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
@@ -92,6 +93,13 @@ texinfo_documents = [
 ]
 
 
+intersphinx_mapping = {
+    'python': ('https://docs.python.org/3/', None),
+    'lxml': ('https://lxml.de/apidoc/', None),
+    'chardet': ('https://chardet.readthedocs.io/en/latest/', None),
+}
+
+
 class CExtMock(object):
     """Required for autodoc on readthedocs.org where you cannot build C extensions."""
     def __init__(self, *args, **kwargs):
diff --git a/doc/html5lib.filters.rst b/doc/html5lib.filters.rst
index d70e455..89a5bc7 100644
--- a/doc/html5lib.filters.rst
+++ b/doc/html5lib.filters.rst
@@ -1,56 +1,61 @@
 filters Package
 ===============
 
-:mod:`base` Module
--------------------
+``base`` Module
+----------------
 
 .. automodule:: html5lib.filters.base
     :members:
     :show-inheritance:
     :special-members: __init__
 
-:mod:`alphabeticalattributes` Module
-------------------------------------
+.. autoclass:: html5lib.filters.base.Filter
+    :members:
+    :show-inheritance:
+    :special-members: __init__
+
+``alphabeticalattributes`` Module
+---------------------------------
 
 .. automodule:: html5lib.filters.alphabeticalattributes
     :members:
     :show-inheritance:
     :special-members: __init__
 
-:mod:`inject_meta_charset` Module
----------------------------------
+``inject_meta_charset`` Module
+------------------------------
 
 .. automodule:: html5lib.filters.inject_meta_charset
     :members:
     :show-inheritance:
     :special-members: __init__
 
-:mod:`lint` Module
-------------------
+``lint`` Module
+---------------
 
 .. automodule:: html5lib.filters.lint
     :members:
     :show-inheritance:
     :special-members: __init__
 
-:mod:`optionaltags` Module
---------------------------
+``optionaltags`` Module
+-----------------------
 
 .. automodule:: html5lib.filters.optionaltags
     :members:
     :show-inheritance:
     :special-members: __init__
 
-:mod:`sanitizer` Module
------------------------
+``sanitizer`` Module
+--------------------
 
 .. automodule:: html5lib.filters.sanitizer
     :members:
     :show-inheritance:
     :special-members: __init__
 
-:mod:`whitespace` Module
-------------------------
+``whitespace`` Module
+---------------------
 
 .. automodule:: html5lib.filters.whitespace
     :members:
diff --git a/doc/html5lib.rst b/doc/html5lib.rst
index d7c75c5..57d1db5 100644
--- a/doc/html5lib.rst
+++ b/doc/html5lib.rst
@@ -4,29 +4,34 @@ html5lib Package
 .. automodule:: html5lib
     :members: __version__
 
-:mod:`constants` Module
------------------------
+``constants`` Module
+--------------------
 
 .. automodule:: html5lib.constants
     :members:
     :show-inheritance:
 
-:mod:`html5parser` Module
--------------------------
+``html5parser`` Module
+----------------------
 
 .. automodule:: html5lib.html5parser
     :members:
     :show-inheritance:
     :special-members: __init__
 
-:mod:`serializer` Module
-------------------------
+``serializer`` Module
+---------------------
 
 .. automodule:: html5lib.serializer
     :members:
     :show-inheritance:
     :special-members: __init__
 
+.. autoclass:: html5lib.serializer.HTMLSerializer
+    :members:
+    :show-inheritance:
+    :special-members: __init__
+
 Subpackages
 -----------
 
diff --git a/doc/html5lib.treeadapters.rst b/doc/html5lib.treeadapters.rst
index 1d3a9fb..d20c1e9 100644
--- a/doc/html5lib.treeadapters.rst
+++ b/doc/html5lib.treeadapters.rst
@@ -1,9 +1,6 @@
 treeadapters Package
 ====================
 
-:mod:`~html5lib.treeadapters` Package
--------------------------------------
-
 .. automodule:: html5lib.treeadapters
     :members:
     :show-inheritance:
diff --git a/doc/html5lib.treebuilders.rst b/doc/html5lib.treebuilders.rst
index 1a051e5..507d319 100644
--- a/doc/html5lib.treebuilders.rst
+++ b/doc/html5lib.treebuilders.rst
@@ -1,40 +1,37 @@
 treebuilders Package
 ====================
 
-:mod:`treebuilders` Package
----------------------------
-
 .. automodule:: html5lib.treebuilders
     :members:
     :show-inheritance:
     :special-members: __init__
 
-:mod:`base` Module
--------------------
+``base`` Module
+---------------
 
 .. automodule:: html5lib.treebuilders.base
     :members:
     :show-inheritance:
     :special-members: __init__
 
-:mod:`dom` Module
------------------
+``dom`` Module
+--------------
 
 .. automodule:: html5lib.treebuilders.dom
     :members:
     :show-inheritance:
     :special-members: __init__
 
-:mod:`etree` Module
--------------------
+``etree`` Module
+----------------
 
 .. automodule:: html5lib.treebuilders.etree
     :members:
     :show-inheritance:
     :special-members: __init__
 
-:mod:`etree_lxml` Module
-------------------------
+``etree_lxml`` Module
+---------------------
 
 .. automodule:: html5lib.treebuilders.etree_lxml
     :members:
diff --git a/doc/html5lib.treewalkers.rst b/doc/html5lib.treewalkers.rst
index 4afef47..53bd5c3 100644
--- a/doc/html5lib.treewalkers.rst
+++ b/doc/html5lib.treewalkers.rst
@@ -1,48 +1,45 @@
 treewalkers Package
 ===================
 
-:mod:`treewalkers` Package
---------------------------
-
 .. automodule:: html5lib.treewalkers
     :members:
     :show-inheritance:
     :special-members: __init__
 
-:mod:`base` Module
-------------------
+``base`` Module
+---------------
 
 .. automodule:: html5lib.treewalkers.base
     :members:
     :show-inheritance:
     :special-members: __init__
 
-:mod:`dom` Module
------------------
+``dom`` Module
+--------------
 
 .. automodule:: html5lib.treewalkers.dom
     :members:
     :show-inheritance:
     :special-members: __init__
 
-:mod:`etree` Module
--------------------
+``etree`` Module
+----------------
 
 .. automodule:: html5lib.treewalkers.etree
     :members:
     :show-inheritance:
     :special-members: __init__
 
-:mod:`etree_lxml` Module
-------------------------
+``etree_lxml`` Module
+---------------------
 
 .. automodule:: html5lib.treewalkers.etree_lxml
     :members:
     :show-inheritance:
     :special-members: __init__
 
-:mod:`genshi` Module
---------------------
+``genshi`` Module
+-----------------
 
 .. automodule:: html5lib.treewalkers.genshi
     :members:
diff --git a/doc/movingparts.rst b/doc/movingparts.rst
index 6ba367a..c7fe024 100644
--- a/doc/movingparts.rst
+++ b/doc/movingparts.rst
@@ -15,9 +15,9 @@ Tree builders
 The parser reads HTML by tokenizing the content and building a tree that
 the user can later access. html5lib can build three types of trees:
 
-* ``etree`` - this is the default; builds a tree based on :mod:`xml.etree`,
-  which can be found in the standard library. Whenever possible, the
-  accelerated ``ElementTree`` implementation (i.e.
+* ``etree`` - this is the default; builds a tree based on
+  :mod:`xml.etree.ElementTree`, which can be found in the standard library.
+  Whenever possible, the accelerated ``ElementTree`` implementation (i.e.
   ``xml.etree.cElementTree`` on Python 2.x) is used.
 
 * ``dom`` - builds a tree based on :mod:`xml.dom.minidom`.
diff --git a/html5lib/filters/sanitizer.py b/html5lib/filters/sanitizer.py
index 70ef906..684f217 100644
--- a/html5lib/filters/sanitizer.py
+++ b/html5lib/filters/sanitizer.py
@@ -113,6 +113,7 @@ allowed_elements = frozenset((
     (namespaces['html'], 'strike'),
     (namespaces['html'], 'strong'),
     (namespaces['html'], 'sub'),
+    (namespaces['html'], 'summary'),
     (namespaces['html'], 'sup'),
     (namespaces['html'], 'table'),
     (namespaces['html'], 'tbody'),
diff --git a/html5lib/treebuilders/base.py b/html5lib/treebuilders/base.py
index e4a3d71..020d7e1 100644
--- a/html5lib/treebuilders/base.py
+++ b/html5lib/treebuilders/base.py
@@ -121,6 +121,7 @@ class Node(object):
 
 class ActiveFormattingElements(list):
     def append(self, node):
+        """Append node to the end of the list."""
         equalCount = 0
         if node != Marker:
             for element in self[::-1]:


Test patch:
diff --git a/html5lib/tests/test_sanitizer.py b/html5lib/tests/test_sanitizer.py
index 6ad43a3..9deed6f 100644
--- a/html5lib/tests/test_sanitizer.py
+++ b/html5lib/tests/test_sanitizer.py
@@ -111,6 +111,18 @@ def param_sanitizer():
                """<img src="%s:%s">foo</a>""" % (protocol, rest_of_uri))
 
 
+def test_details_open_allowed():
+    sanitized = sanitize_html("<details open>.</details>")
+    expected = '<details open>.</details>'
+    assert expected == sanitized
+
+
+def test_details_summary_allowed():
+    sanitized = sanitize_html("<details><summary>.</summary><p>...</p></details>")
+    expected = '<details><summary>.</summary><p>...</p></details>'
+    assert expected == sanitized
+
+
 @pytest.mark.parametrize("expected, input",
                          (pytest.param(expected, input, id=id)
                           for id, expected, input in param_sanitizer()))