Merge "Enhanced error handling for rest_parameters parser"
This commit is contained in:
commit
18169d572a
@ -122,14 +122,20 @@ class RestParametersDirective(Table):
|
|||||||
new_content = list()
|
new_content = list()
|
||||||
for paramlist in parsed:
|
for paramlist in parsed:
|
||||||
for name, ref in paramlist.items():
|
for name, ref in paramlist.items():
|
||||||
|
if ref in lookup:
|
||||||
new_content.append((name, lookup[ref]))
|
new_content.append((name, lookup[ref]))
|
||||||
|
else:
|
||||||
|
self.env.warn(
|
||||||
|
self.env.docname,
|
||||||
|
"No field definition for %s found in %s. Skipping." %
|
||||||
|
(ref, fpath))
|
||||||
|
|
||||||
# self.app.info("New content %s" % new_content)
|
# self.app.info("New content %s" % new_content)
|
||||||
self.yaml = new_content
|
self.yaml = new_content
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
env = self.state.document.settings.env
|
self.env = self.state.document.settings.env
|
||||||
self.app = env.app
|
self.app = self.env.app
|
||||||
|
|
||||||
# Make sure we have some content, which should be yaml that
|
# Make sure we have some content, which should be yaml that
|
||||||
# defines some parameters.
|
# defines some parameters.
|
||||||
@ -149,7 +155,7 @@ class RestParametersDirective(Table):
|
|||||||
|
|
||||||
# NOTE(sdague): it's important that we pop the arg otherwise
|
# NOTE(sdague): it's important that we pop the arg otherwise
|
||||||
# we end up putting the filename as the table caption.
|
# we end up putting the filename as the table caption.
|
||||||
rel_fpath, fpath = env.relfn2path(self.arguments.pop())
|
rel_fpath, fpath = self.env.relfn2path(self.arguments.pop())
|
||||||
self.yaml_from_file(fpath)
|
self.yaml_from_file(fpath)
|
||||||
|
|
||||||
self.max_cols = len(self.headers)
|
self.max_cols = len(self.headers)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user