mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-09-03 20:52:55 -05:00
productionlist: Put the full production in production.rawsource
This makes it possible to iterate over the productions and see exactly the text that was entered by the author, which is useful to e.g. extract information from the grammar (like syntax-highlighting patterns).
This commit is contained in:
@@ -12,6 +12,8 @@ Incompatible changes
|
||||
* #6230: The anchor of term in glossary directive is changed if it is consisted
|
||||
by non-ASCII characters
|
||||
* #4550: html: Centering tables by default using CSS
|
||||
* The ``rawsource`` property of ``production`` nodes now contains the full
|
||||
production rule.
|
||||
|
||||
Deprecated
|
||||
----------
|
||||
|
||||
@@ -443,7 +443,7 @@ class ProductionList(SphinxDirective):
|
||||
name, tokens = rule.split(':', 1)
|
||||
except ValueError:
|
||||
break
|
||||
subnode = addnodes.production()
|
||||
subnode = addnodes.production(rule)
|
||||
subnode['tokenname'] = name.strip()
|
||||
if subnode['tokenname']:
|
||||
idname = nodes.make_id('grammar-token-%s' % subnode['tokenname'])
|
||||
|
||||
Reference in New Issue
Block a user