|
Meta tags:
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 📚: htt????/cpython-previews--129689.org.readthedocs.build/;
Headings (most frequently used words):
gh, navigation, uh, oh, 13, 127833, docs, add, grammar, snippet, directive, replace, productionlist, 127835, 129689, footer, diff, view, menu, repository, there, are, no, files, selected, for, viewing, filter, by, extension,
Text of the page (most frequently used words):
the (34), file (28), line (25), #grammar (22), this (20), from (20), for (20), self (18), github (16), and (16), content (15), sphinx (14), import (14), that (13), snippet (12), text (12), nodes (12), applied (11), productionlist (11), name (11), literal (11), all (10), group (10), show (10), python (10), hidden (9), characters (9), unicode (9), you (8), name_node (8), diff (8), reload (8), suggestion (7), cannot (7), suggestions (7), while (7), code (7), add (7), changes (7), options (7), rule_name (7), directive (7), match (7), open (7), doc (7), sign (7), docs (6), lines (6), true (6), return (6), def (6), group_name (6), node (6), str (6), number (6), bidirectional (6), security (5), comments (5), change (5), commit (5), there (5), rest (5), class (5), with (5), what (5), last_pos (5), string (5), rawsource (5), docutils (5), rst (5), support (5), learn (5), about (5), view (5), expand (5), files (5), loading (5), your (5), can (4), not (4), please (4), pull (4), must (4), paragraph (4), syntax (4), like (4), newline (4), statement (4), case (4), original (4), 219 (4), review (4), more (4), grammar_snippet (4), input (4), 127833 (4), replace (4), copilot (4), community (3), navigation (3), request (3), existing (3), create (3), batch (3), only (3), closed (3), std (3), compatproductionlist (3), app (3), grammarsnippetdirective (3), make_grammar_snippet (3), append (3), name_part (3), colon (3), list (3), use (3), grammarsnippetbase (3), directives (3), which (3), token (3), node_id (3), addnodes (3), matches (3), start (3), classes (3), set (3), apply (3), following (3), any (3), util (3), typing (3), contains (3), may (3), interpreted (3), compiled (3), differently (3), than (3), appears (3), below (3), editor (3), reveals (3), desktop (3), delete (3), edit (3), tools (3), extensions (3), deletions (3), interactive (3), reference (3), toplevel_components (3), conf (3), hide (3), whitespace (3), was (3), error (3), page (3), filter (3), commits (3), 129689 (3), 127835 (3), miss (3), islington (3), account (3), quality (3), another (3), tab (3), window (3), refresh (3), session (3), developers (3), changelog (3), customer (3), enterprise (3), grade (3), features (3), build (3), contact (2), status (2), privacy (2), terms (2), footer (2), merge (2), has (2), single (2), one (2), viewing (2), toggle (2), annotations (2), extensionmetadata (2), align_column (2), strip (2), arguments (2), argument (2), first (2), run (2), option_spec (2), final_argument_whitespace (2), optional_arguments (2), required_arguments (2), has_content (2), used (2), blank (2), given (2), option (2), our (2), needs (2), into (2), something (2), similar (2), literal_block (2), text_node (2), domain (2), obj_name (2), state (2), document (2), make_id (2), env (2), prefix (2), domains (2), same (2), does (2), link (2), target (2), literal_strong (2), make_link_target_for_token (2), snippet_string_node (2), single_quoted (2), double_quoted (2), token_xrefs (2), ref_text (2), rule_ref (2), group_dict (2), none (2), items (2), handle (2), grammar_re (2), quotes (2), identifier (2), followed (2), highlight (2), see (2), non (2), empty (2), astext (2), source (2), have (2), sequence (2), sphinxdirective (2), __init__ (2), children (2), attributes (2), type_checking (2), additions (2), down (2), selected (2), split (2), unified (2), failed (2), load (2), retry (2), jump (2), nbsp (2), extension (2), tree (2), issue (2), insights (2), projects (2), actions (2), repository (2), cpython (2), signed (2), universe (2), training (2), integrations (2), stories (2), center (2), documentation (2), business (2), fixes (2), products (2), secret (2), perform, action, time, share, personal, information, manage, cookies, 2026, inc, right, now, check, back, later, queued, multi, pending, reviews, been, marked, resolved, outdated, order, valid, applying, deleted, supported, per, subset, invalid, because, were, made, notes, parallel_write_safe, parallel_read_safe, version, override, add_directive_to_domain, add_directive, setup, else, _colon, partition, max, index, assume, each, align, splitlines, actually, false, much, possible, makes, look, intended, transitional, switch, snippets, currently, ignore, unchanged_required, preceded, most, named, unlike, supports, special, character, backtick, marks, tokens, listing, almost, auto, aligment, instead, gram, but, better, suited, turn, transform, note_object, location, note_implicit_target, ids, avoid, breaking, links, production, cargo, culted, magic, make, raise, valueerror, unhandled, groupdict, end, between, finditer, verbose, backquotes, compile, should, get, around, thus, discards, internal, formatting, references, highlighting, based, plain, when, generating, output, elements, attribute, supposed, block, dict, handling, left, individual, common, functionality, pygments, other, super, inline, noqa, n801, snake_case, fine, application, collections, abc, parsers, __future__, documenting, note, top, level, compound, interactive_input, stmt_list, compound_stmt, mode, parsed, using, situations, file_input, read, form, pyspecific, misc_news, lexers, glossary_search, c_annotations, addition, are, conversations, clear, filters, viewed, types, encukou, feb, 2025, product, 0f80ab2, select, changed, checks, conversation, wants, backport, 58a4357, already, clicking, agree, occasionally, send, related, emails, service, free, its, maintainers, question, project, new, requests, issues, message, dismiss, alert, switched, accounts, out, appearance, settings, search, pricing, event, talks, workshops, next, partners, company, forum, events, webinars, blog, resource, connect, resources, premium, advanced, ons, trust, why, evaluate, industries, government, manufacturing, financial, services, healthcare, industry, nonprofits, startups, team, enterprises, stage, businesses, latest, improvements, across, place, developer, articles, sponsors, trending, repos, explore, customize, certifications, scanning, leak, prevention, protection, vulnerability, detection, remediation, secure, cloud, development, environments, codespaces, analysis, enforcement, automation, ship, coding, agent, tasks, automated, work, hosting, collaboration, platform, menu, skip,
|