mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
docs: add sphinx warnings in format_idf_target
format_idf_target will now log sphinx warnings for any {IDF_TARGET_X} that were not replaced.
This commit is contained in:
parent
ba55320e1e
commit
c8cd68fbe6
@ -5,6 +5,7 @@ from docutils import io, nodes, statemachine, utils
|
||||
from docutils.utils.error_reporting import SafeString, ErrorString
|
||||
from docutils.parsers.rst import directives
|
||||
from sphinx.directives.other import Include as BaseInclude
|
||||
from sphinx.util import logging
|
||||
|
||||
|
||||
def setup(app):
|
||||
@ -21,6 +22,16 @@ def setup(app):
|
||||
return {'parallel_read_safe': True, 'parallel_write_safe': True, 'version': '0.2'}
|
||||
|
||||
|
||||
def check_content(content, docname):
|
||||
# Log warnings for any {IDF_TARGET} expressions that haven't been replaced
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
errors = re.findall(r'{IDF_TARGET.*?}', content)
|
||||
|
||||
for err in errors:
|
||||
logger.warning('Badly formated string substitution: {}'.format(err), location=docname)
|
||||
|
||||
|
||||
class StringSubstituter:
|
||||
""" Allows for string substitution of target related strings
|
||||
before any markup is parsed
|
||||
@ -113,6 +124,8 @@ class StringSubstituter:
|
||||
def substitute_source_read_cb(self, app, docname, source):
|
||||
source[0] = self.substitute(source[0])
|
||||
|
||||
check_content(source[0], docname)
|
||||
|
||||
|
||||
class FormatedInclude(BaseInclude):
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user