Skip to content

Commit fc99b7b

Browse files
SilverRainZcodex
andcommitted
docs: Fix typos and grammar
Co-authored-by: Codex <codex@openai.com>
1 parent 2460e5e commit fc99b7b

12 files changed

Lines changed: 85 additions & 85 deletions

File tree

docs/api.rst

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ The Render Pipeline
66
===================
77

88
The pipeline defines how nodes carrying data are generated and when they are
9-
rendered to part of the document.
9+
rendered as part of the document.
1010

1111
1. Generation: :py:class:`~sphinxnotes.render.BaseContextRole`,
1212
:py:class:`~sphinxnotes.render.BaseContextDirective` and their subclasses
1313
create :py:class:`~sphinxnotes.render.pending_node` on document parsing,
1414
and the node will be inserted to the document tree. The node contains:
1515

16-
- :ref:`context`, the dynamic content of Jinja template
16+
- :ref:`context`, the dynamic content of a Jinja template
1717

1818
- :py:class:`~sphinxnotes.render.Template`,
1919
the Jinja template for rendering context to markup text
2020
(reStructuredText or Markdown)
2121

22-
2. Render: ``pending_node`` node will be rendered at appropriate
22+
2. Render: the ``pending_node`` node will be rendered at the appropriate
2323
:py:class:`~sphinxnotes.render.Phase`, depending on
2424
:py:attr:`~sphinxnotes.render.pending_node.template.phase`.
2525

@@ -33,27 +33,28 @@ Node
3333
Context
3434
-------
3535

36-
Context refers dynamic content of Jinja template. It can be:
36+
Context refers to the dynamic content of a Jinja template. It can be:
3737

3838
:py:class:`~sphinxnotes.render.ResolvedContext`:
39-
Our dedicated data types (:py:class:`sphinxnotes.render.ParsedData`) , or any
39+
Our dedicated data type (:py:class:`sphinxnotes.render.ParsedData`), or any
4040
Python ``dict``.
4141

4242
:py:class:`~sphinxnotes.render.PendingContext`:
43-
Context no yet available. e.g. Context contains
44-
:py:class:`un-parsed data <sphinxnotes.render.RawData>`),
45-
remote data, and etc.
43+
Context that is not yet available. For example, it may contain
44+
:py:class:`unparsed data <sphinxnotes.render.RawData>`,
45+
remote data, and more.
4646

47-
PendingContext can be resolved to :py:class:`~sphinxnotes.render.ResolvedContext`.
48-
by calling the :py:class:`~sphinxnotes.render.PendingContext.resolve` method.
47+
:py:class:`PendingContext` can be resolved to
48+
:py:class:`~sphinxnotes.render.ResolvedContext` by calling
49+
:py:meth:`~sphinxnotes.render.PendingContext.resolve`.
4950

5051
.. autotype:: sphinxnotes.render.ResolvedContext
5152

5253
.. autoclass:: sphinxnotes.render.PendingContext
5354
:members: resolve
5455

55-
``PendingContext`` Implementions
56-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
56+
``PendingContext`` Implementations
57+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5758

5859
.. autoclass:: sphinxnotes.render.UnparsedData
5960
:show-inheritance:
@@ -141,8 +142,8 @@ Data, Field and Schema
141142
Registry
142143
========
143144

144-
Developer can extending the function of this extentison (For example, support
145-
more data types, add new extra context) by adding new item to
145+
Developers can extend this extension (for example, to support more data types
146+
or add new extra context) by adding new items to
146147
:py:class:`sphinxnotes.render.REGISTRY`.
147148

148149
.. autodata:: sphinxnotes.render.REGISTRY

docs/dsl.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ Field Description Language
88
:language: Python
99

1010

11-
The Field Description Language is a Domain Specific Language (DSL) that used to
11+
The Field Description Language is a Domain Specific Language (DSL) that is used to
1212
define the type and structure of field values. An FDL declaration consists of
13-
one or more :term:`modifier`\ s separated by commas (``,``).
13+
one or more :term:`modifier` entries separated by commas (``,``).
1414

1515
Syntax
1616
======
@@ -39,8 +39,8 @@ Syntax
3939
Python API
4040
==========
4141

42-
User can create a :class:`sphinxnotes.render.Field` from FDL and use it to parse
43-
string to :type:`sphinxnotes.render.Value`:
42+
Users can create a :class:`sphinxnotes.render.Field` from FDL and use it to parse
43+
strings into :type:`sphinxnotes.render.Value`:
4444

4545
>>> from sphinxnotes.render import Field
4646
>>> Field.from_dsl('list of int').parse('1,2,3')
@@ -74,7 +74,7 @@ A type modifier specifies the data type of a single (scalar) value.
7474
* - ``str``
7575
- :py:class:`str`
7676
- ``string``
77-
- String. If looks like a Python literal (e.g., ``"hello"``), it's parsed accordingly.
77+
- String. If it looks like a Python literal (e.g., ``"hello"``), it is parsed accordingly.
7878

7979
Examples:
8080

@@ -130,8 +130,8 @@ Flag
130130

131131
A flag is a boolean modifier that can be either on or off.
132132

133-
Every flag is available as a attribute of the :class:`Field`.
134-
For example, we have a "required" flag registed, we can access ``Field.required``
133+
Every flag is available as an attribute of the :class:`Field`.
134+
For example, we have a "required" flag registered, and we can access ``Field.required``
135135
attribute.
136136

137137
.. list-table::
@@ -155,8 +155,8 @@ By-Option
155155

156156
A by-option is a key-value modifier with the syntax ``<name> by <value>``.
157157

158-
Every by-option is available as a attribute of the :class:`Field`.
159-
For example, we have a "sep" flag registed, we can get the value of separator
158+
Every by-option is available as an attribute of the :class:`Field`.
159+
For example, we have a "sep" by-option registered, and we can get the separator
160160
from ``Field.sep`` attribute.
161161

162162
Built-in by-options:
@@ -213,7 +213,7 @@ Adding Custom Flags
213213
-------------------
214214

215215
Use :meth:`~sphinxnotes.render.data.Registry.add_flag` method of
216-
:data:`sphinxnotes.render.REGISTRY` to add a new type:
216+
:data:`sphinxnotes.render.REGISTRY` to add a new flag:
217217

218218
>>> from sphinxnotes.render import REGISTRY
219219
>>> REGISTRY.data.add_flag('unique', default=False)

docs/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ Getting Started
3939
4040
.. note::
4141

42-
This extension is not intended to be used directly by Sphinx user.
43-
It is for Sphinx extension developer.
42+
This extension is not intended to be used directly by Sphinx users.
43+
It is for Sphinx extension developers.
4444

4545
.. ADDITIONAL CONTENT END
4646

docs/usage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Usage
66

77
Before reading this documentation, please refer to
88
:external+sphinx:doc:`development/tutorials/extending_syntax`.
9-
see how to extends :py:class:`SphinxDirective` and :py:class:`SphinxRole`.
9+
See how to extend :py:class:`SphinxDirective` and :py:class:`SphinxRole`.
1010

1111
Create a Sphinx documentation with the following ``conf.py``:
1212

src/sphinxnotes/render/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
from sphinx.application import Sphinx
4848

4949

50-
"""Python API for other Sphinx extesions."""
50+
"""Python API for other Sphinx extensions."""
5151
__all__ = [
5252
'Registry',
5353
'PlainValue',
@@ -76,7 +76,7 @@
7676

7777

7878
class Registry:
79-
"""The global, all-in-one registry for user."""
79+
"""The global, all-in-one registry for users."""
8080

8181
@property
8282
def data(self) -> DataRegistry:

src/sphinxnotes/render/ctx.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
This module wraps the :py:mod:`sphinxnote.render.data` module into context
2+
This module wraps the :py:mod:`sphinxnotes.render.data` module into context
33
suitable for use with Jinja templates.
44
"""
55

@@ -12,12 +12,12 @@
1212
from .utils import Unpicklable
1313

1414
type ResolvedContext = ParsedData | dict[str, Any]
15-
"""The context is """
15+
"""Resolved context types used by template rendering."""
1616

1717

1818
@dataclass
1919
class PendingContextRef:
20-
"""A abstract class that references to :class:`PendingCtx`."""
20+
"""An abstract reference to :class:`PendingContext`."""
2121

2222
ref: int
2323
chksum: int
@@ -27,7 +27,7 @@ def __hash__(self) -> int:
2727

2828

2929
class PendingContext(ABC, Unpicklable, Hashable):
30-
"""A abstract representation of context that is not currently available."""
30+
"""An abstract representation of context that is not currently available."""
3131

3232
@abstractmethod
3333
def resolve(self) -> ResolvedContext:
@@ -39,13 +39,13 @@ def resolve(self) -> ResolvedContext:
3939
class PendingContextStorage:
4040
"""Area for temporarily storing :py:class:`PendingContext`.
4141
42-
This class is indented to resolve the problem that:
42+
This class is intended to solve the problem that:
4343
44-
Some of the PendingContext are :class:Unpicklable` and they can not be hold
44+
Some :class:`PendingContext` objects are :class:`Unpicklable`, so they cannot be held
4545
by :class:`pending_node` (as ``pending_node`` will be pickled along with
4646
the docutils doctree)
4747
48-
This class maintains a mapping from :class:`PendingContextRef` -> :cls:`PendingContext`.
48+
This class maintains a mapping from :class:`PendingContextRef` -> :class:`PendingContext`.
4949
``pending_node`` owns the ``PendingContextRef``, and can retrieve the context
5050
by calling :py:meth:`retrieve`.
5151
"""

src/sphinxnotes/render/ctxnodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def unwrap_and_replace_self_inline(self, inliner: Report.Inliner) -> None:
217217
# Replace self with inline nodes.
218218
self.replace_self(ns)
219219

220-
"""Hooks for procssing render intermediate products. """
220+
"""Hooks for processing render intermediate products."""
221221

222222
type PendingContextHook = Callable[[pending_node, PendingContext], None]
223223
type ResolvedContextHook = Callable[[pending_node, ResolvedContext], None]

src/sphinxnotes/render/data.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def add_type(
178178
def add_form(
179179
self, name: str, ctype: type, sep: str, aliases: list[str] = []
180180
) -> None:
181-
"""Register an value form with its container type and separator for
181+
"""Register a value form with its container type and separator for
182182
:py:class:`Value`.
183183
184184
:param name: The name for this form, available as a :term:`Form modifier`
@@ -270,8 +270,8 @@ def asdict(self) -> dict[str, Any]:
270270
"""
271271
Convert Data to a dict for usage of Jinja2 context.
272272
273-
``self.attrs`` will be automaticlly lifted to top-level context when
274-
there is no key conflicts. For example:
273+
``self.attrs`` will be automatically lifted to top-level context when
274+
there are no key conflicts. For example:
275275
276276
- You can access ``Data.attrs['color']`` by "{{ color }}" instead
277277
of "{{ attrs.color }}".
@@ -293,7 +293,7 @@ class Field(Unpicklable):
293293
ctype: type | None = None
294294
#: Flags of field.
295295
flags: dict[str, Value] = dataclass_field(default_factory=dict)
296-
#: The orginal DSL.
296+
#: The original DSL.
297297
dsl: str | None = None
298298

299299
# Type hints for builtin flags.

src/sphinxnotes/render/extractx.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@
1717

1818

1919
class GlobalExtraContxt(ABC):
20-
"""Extra context availabled on any phase."""
20+
"""Extra context available in any phase."""
2121

2222
@abstractmethod
2323
def generate(self) -> Any: ...
2424

2525

2626
class ParsePhaseExtraContext(ABC):
27-
"""Extra context generated during the :py:class:`~Phase.Parsing` or
28-
:py:class:`~Phase.Parsing` phase."""
27+
"""Extra context generated during the :py:class:`~Phase.Parsing` phase."""
2928

3029
@abstractmethod
3130
def generate(self, host: ParseHost) -> Any: ...
@@ -39,7 +38,7 @@ def generate(self, host: ResolveHost) -> Any: ...
3938

4039

4140
# =======================
42-
# Extra context registion
41+
# Extra context registration
4342
# =======================
4443

4544

@@ -72,32 +71,32 @@ def _name_dedup(self, name: str) -> None:
7271
def add_parsing_phase_context(
7372
self, name: str, ctxgen: ParsePhaseExtraContext
7473
) -> None:
75-
"""Register a extra context for :py:class:`~Phase.Parsing` phase."""
74+
"""Register an extra context for the :py:class:`~Phase.Parsing` phase."""
7675
self._name_dedup(name)
7776
self.parsing['_' + name] = ctxgen
7877

7978
def add_parsed_phase_context(
8079
self, name: str, ctxgen: ResolvePhaseExtraContext
8180
) -> None:
82-
"""Register a extra context for :py:class:`~Phase.Parsed` phase."""
81+
"""Register an extra context for the :py:class:`~Phase.Parsed` phase."""
8382
self._name_dedup(name)
8483
self.parsed['_' + name] = ctxgen
8584

8685
def add_post_transform_phase_context(
8786
self, name: str, ctxgen: ResolvePhaseExtraContext
8887
) -> None:
89-
"""Register a extra context for :py:class:`~Phase.Resolving` phase."""
88+
"""Register an extra context for the :py:class:`~Phase.Resolving` phase."""
9089
self._name_dedup(name)
9190
self.post_transform['_' + name] = ctxgen
9291

9392
def add_global_context(self, name: str, ctxgen: GlobalExtraContxt):
94-
"""Register a extra context for :py:class:`~Phase.Resolving` phase."""
93+
"""Register a global extra context available across phases."""
9594
self._name_dedup(name)
9695
self.global_['_' + name] = ctxgen
9796

9897

9998
# ===================================
100-
# Bulitin extra context implementions
99+
# Builtin extra context implementations
101100
# ===================================
102101

103102

0 commit comments

Comments
 (0)