Title: [3.12] gh-127833: Docs: Add a `grammar-snippet` directive & replace `productionlist` (GH-127835) by miss-islington · Pull Request #129690 · python/cpython · GitHub
Open Graph Title: [3.12] gh-127833: Docs: Add a `grammar-snippet` directive & replace `productionlist` (GH-127835) by miss-islington · Pull Request #129690 · python/cpython
X Title: [3.12] gh-127833: Docs: Add a `grammar-snippet` directive & replace `productionlist` (GH-127835) by miss-islington · Pull Request #129690 · python/cpython
Description: As a first step toward aligning the grammar documentation with Python's actual grammar, this overrides the ReST productionlist directive to: use : instead of the ::= symbol add syntax highlighting for strings (using a Pygments highlighting class) All links and link targets should be preserved. (Unfortunately, this reaches into some Sphinx internals; I don't see a better way to do exactly what Sphinx does.) This also adds a new directive, grammar-snippet, which formats the snippet almost exactly like what's in the source, modulo syntax highlighting and keeping the backtick character to mark links to other rules. This will allow formatting the snippets as in the grammar file (file:///home/encukou/dev/cpython/Doc/build/html/reference/grammar.html). The new directive is applied to two simple rules in toplevel_components.rst (cherry picked from commit 58a4357) Co-authored-by: Petr Viktorin encukou@gmail.com Co-authored-by: Blaise Pabon blaise@gmail.com Co-authored-by: William Ferreira wqferr@gmail.com Co-authored-by: bswck bartoszpiotrslawecki@gmail.com Co-authored-by: Adam Turner 9087854+aa-turner@users.noreply.github.com Issue: gh-127833 📚 Documentation preview 📚: https://cpython-previews--129690.org.readthedocs.build/
Open Graph Description: As a first step toward aligning the grammar documentation with Python's actual grammar, this overrides the ReST productionlist directive to: use : instead of the ::= symbol add syntax highligh...
X Description: As a first step toward aligning the grammar documentation with Python's actual grammar, this overrides the ReST productionlist directive to: use : instead of the ::= symbol add syntax high...
Opengraph URL: https://github.com/python/cpython/pull/129690
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:dfc2d3b0-0367-ccba-6654-58a521e525ad |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | A3B4:327857:168E579:1F04AD5:696A9B89 |
| html-safe-nonce | c09a35640450a0a22d5138976ddb3bd27b8b292449a738d9b1c324f12840d388 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBM0I0OjMyNzg1NzoxNjhFNTc5OjFGMDRBRDU6Njk2QTlCODkiLCJ2aXNpdG9yX2lkIjoiODY1NTQyNzI0MDEwMDI3MzAzMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f79b021a1e1e4a7c7b753c6cc4f119a599854a601c1686c2b1644b82ebe10ce4 |
| hovercard-subject-tag | pull_request:2317873402 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/129690/checks |
| twitter:image | https://avatars.githubusercontent.com/u/31488909?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/31488909?s=400&v=4 |
| og:image:alt | As a first step toward aligning the grammar documentation with Python's actual grammar, this overrides the ReST productionlist directive to: use : instead of the ::= symbol add syntax highligh... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | c0d8175e41e0e55b9e984c935b24b808cabab919dd3174aa45dac3ef503ed1af |
| turbo-cache-control | no-cache |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 99aab454e5ddc8df30805fb76c114c3008a15842 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width