Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 78e2bbb

Browse files
committed
updates conf.py.js templates to add sphinx warnings
1 parent b75b8f4 commit 78e2bbb

2 files changed

Lines changed: 38 additions & 2 deletions

File tree

gapic/ads-templates/docs/conf.py.j2

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
# All configuration values have a default; values that are commented out
1515
# serve to show the default.
1616

17-
import sys
17+
import logging
1818
import os
1919
import shlex
20+
import sys
2021

2122
# If extensions (or modules to document with autodoc) are in another directory,
2223
# add these directories to sys.path here. If the directory is relative to the
@@ -361,4 +362,21 @@ napoleon_use_admonition_for_references = False
361362
napoleon_use_ivar = False
362363
napoleon_use_param = True
363364
napoleon_use_rtype = True
365+
366+
# --- Specific warning filters not covered by suppress_warnings ---
367+
368+
class UnexpectedUnindentFilter(logging.Filter):
369+
"""Filter out warnings about unexpected unindentation following bullet lists."""
370+
def filter(self, record):
371+
# Return False to suppress the warning, True to allow it
372+
msg = record.getMessage()
373+
if "Bullet list ends without a blank line" in msg:
374+
return False
375+
return True
376+
377+
def setup(app):
378+
# Sphinx's logger is hierarchical. Adding a filter to the
379+
# root 'sphinx' logger will catch warnings from all sub-loggers.
380+
logger = logging.getLogger('sphinx')
381+
logger.addFilter(UnexpectedUnindentFilter())
364382
{% endblock %}

gapic/templates/docs/conf.py.j2

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
# All configuration values have a default; values that are commented out
1515
# serve to show the default.
1616

17-
import sys
17+
import logging
1818
import os
1919
import shlex
20+
import sys
2021

2122
# If extensions (or modules to document with autodoc) are in another directory,
2223
# add these directories to sys.path here. If the directory is relative to the
@@ -372,4 +373,21 @@ napoleon_use_admonition_for_references = False
372373
napoleon_use_ivar = False
373374
napoleon_use_param = True
374375
napoleon_use_rtype = True
376+
377+
# --- Specific warning filters not covered by suppress_warnings ---
378+
379+
class UnexpectedUnindentFilter(logging.Filter):
380+
"""Filter out warnings about unexpected unindentation following bullet lists."""
381+
def filter(self, record):
382+
# Return False to suppress the warning, True to allow it
383+
msg = record.getMessage()
384+
if "Bullet list ends without a blank line" in msg:
385+
return False
386+
return True
387+
388+
def setup(app):
389+
# Sphinx's logger is hierarchical. Adding a filter to the
390+
# root 'sphinx' logger will catch warnings from all sub-loggers.
391+
logger = logging.getLogger('sphinx')
392+
logger.addFilter(UnexpectedUnindentFilter())
375393
{% endblock %}

0 commit comments

Comments
 (0)