Skip to content

Commit 4acec08

Browse files
committed
chore: Still use the 'any' prefix
1 parent 829658f commit 4acec08

15 files changed

Lines changed: 81 additions & 90 deletions

File tree

docs/_schemas/dog2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
},
1010
'templates': {
1111
'obj': dedent("""
12-
:Breed: :obj:dog.breed:`{{ breed }}`
13-
:Colors: {% for c in color %}:obj:dog.color:`{{ c }}` {% endfor %}"""),
12+
:Breed: :any:dog.breed:`{{ breed }}`
13+
:Colors: {% for c in color %}:any:dog.color:`{{ c }}` {% endfor %}"""),
1414
'ref': '🐕{{ title }}',
1515
},
1616
}

docs/_schemas/dogs.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@ Dogs
66

77
This pages describe some Town Dogs [#]_ in Terraria [#]_:
88

9-
.. obj:dog:: Arthur
9+
.. any:dog:: Arthur
1010
:breed: Labrador
1111
:color: Golden
1212

13-
.. obj:dog:: Bitsy
13+
.. any:dog:: Bitsy
1414
:breed: Labrador
1515
:color: Golden
1616

17-
.. obj:dog:: Doug
17+
.. any:dog:: Doug
1818
:breed: Pit Bull
1919
:color: Brown White
2020

21-
.. obj:dog:: Ginger
21+
.. any:dog:: Ginger
2222
:breed: Pit Bull
2323
:color: Brown White
2424

25-
.. obj:dog:: Hachiko
25+
.. any:dog:: Hachiko
2626
:breed: Husky
2727
:color: Black White
2828

docs/_schemas/indiana-dog.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
.. obj:dog:: Indiana
1+
.. any:dog:: Indiana
22
:breed: Husky
33
:color: Black White

docs/_schemas/mimi.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.. rubric:: mimi
22

3-
.. obj:cat:: _
3+
.. any:cat:: _
44
:id: 2

docs/_schemas/nyan-cat.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
.. obj:cat:: Nyan Cat
1+
.. any:cat:: Nyan Cat
22
Nyan_Cat
33
:id: 1
44
:color: pink gray
55
:picture: _images/nyan-cat.gif
66

7-
:obj:cat:`Nyan Cat` is the name of a YouTube video uploaded in April 2011,
7+
:any:cat:`Nyan Cat` is the name of a YouTube video uploaded in April 2011,
88
which became an internet meme. The video merged a Japanese pop song with
99
an animated cartoon cat with a Pop-Tart for a torso, flying through space,
1010
and leaving a rainbow trail behind it. The video ranked at number 5 on

docs/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@
122122
# For locating packages under _schemas/.
123123
sys.path.insert(0, os.path.abspath('.'))
124124

125-
obj_domain_name = 'obj'
126-
obj_type_defines = {
125+
any_domain_name = 'obj'
126+
any_object_types = {
127127
'version': {
128128
'schema': {
129129
'attrs': {
@@ -172,4 +172,4 @@
172172
'dog': __import__("_schemas.dog2").dog2.dog,
173173
}
174174

175-
primary_domain = obj_domain_name
175+
primary_domain = any_domain_name

docs/conf.rst

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,22 @@ Configuration
44

55
The extension provides the following configuration:
66

7-
.. autoconfval:: obj_domain_name
7+
.. autoconfval:: any_domain_name
88

9-
.. autoconfval:: obj_type_defines
9+
The name of the domain.
1010

11-
.. autoconfval:: obj_domain_dump
11+
.. autoconfval:: any_object_types
1212

13-
.. autoconfval:: obj_auto_obj
13+
A dictionary ``dict[str, objdef]`` of object type definitions.
14+
15+
The ``str`` key is the object type;
16+
The ``objdef`` vaule is a ``dict``,
17+
please refer to :ref:`writing-objdef` for more details.
18+
19+
.. autoconfval:: any_domain_dump
20+
21+
Whether dump domain data to :file:`$DOCTREE_DIR/$OBJ_DOMAIN_NAME-objects.json`.
22+
23+
The ``$DOCTREE_DIR`` is usually :file:`_build/doctrees/`.
24+
The ``$OBJ_DOMAIN_NAME`` refers value of :confval:`any_domain_name`.
25+
(By default, the path is :file:`_build/doctrees/obj-objects.json`)'.

docs/index.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,28 +71,28 @@ Add the such a "cat" dict in your ``conf.py``:
7171

7272
.. literalinclude:: /_schemas/cat.py
7373

74-
And add it to the :confval:`obj_type_defines` confval:
74+
And add it to the :confval:`any_object_types` confval:
7575

7676
.. code:: python
7777
78-
obj_type_defines = {
78+
any_object_types = {
7979
'cat': cat,
8080
}
8181
82-
Then you can document a cat using the :rst:dir:`obj:cat` directive:
82+
Then you can document a cat using the :rst:dir:`any:cat` directive:
8383

8484
.. example::
8585
:style: grid
8686

87-
.. obj:cat:: mimi
87+
.. any:cat:: mimi
8888
:color: black
8989

90-
And reference a the cat with :rst:role:`obj:cat`:
90+
And reference a the cat with :rst:role:`any:cat`:
9191

9292
.. example::
9393
:style: grid
9494

95-
Hi :obj:cat:`mimi`! I am here!
95+
Hi :any:cat:`mimi`! I am here!
9696

9797
Please refer to :doc:`usage` for more details.
9898

docs/tips.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Tips
55
Omit Domain Name
66
================
77

8-
You can omit the prefixed domain name in directives and roles by setting the ``primary_domain`` to your :confval:`obj_domain_name` in :file:`conf.py`. For example, you can use ``.. cat::`` rather than ``.. obj:cat::``.
8+
You can omit the prefixed domain name in directives and roles by setting the ``primary_domain`` to your :confval:`any_domain_name` in :file:`conf.py`. For example, you can use ``.. cat::`` rather than ``.. any:cat::``.
99

1010
Documenting Section and Documentation
1111
=====================================
@@ -52,16 +52,16 @@ When we see the breed of Indiana is "Husky", we may want to see what other huski
5252
.. literalinclude:: /_schemas/dog2.py
5353
:language: python
5454

55-
For field breed, its value is a string, so we simpily wrap value in to a ``obj:dog.breed`` role, In this case it create a reference to all Husky dog.
55+
For field breed, its value is a string, so we simpily wrap value in to a ``any:dog.breed`` role, In this case it create a reference to all Husky dog.
5656

57-
For field color, its value is a string list, we have to iterate it and wrap element to to a ``obj:dog.color`` role, In this case it create a reference to all Black dog and White dog.
57+
For field color, its value is a string list, we have to iterate it and wrap element to to a ``any:dog.color`` role, In this case it create a reference to all Black dog and White dog.
5858

5959
The rendered reStructuredText looks like this:
6060

6161
.. code-block:: rst
6262
63-
:Breed: :obj:dog.breed:`Husky`
64-
:Colors: :obj:dog.color:`Blac.. obj:dog.color:`White`
63+
:Breed: :any:dog.breed:`Husky`
64+
:Colors: :any:dog.color:`Blac.. any:dog.color:`White`
6565
6666
The rendered object description:
6767

docs/usage.rst

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Documenting Object
2323

2424
Once a schema created, the corresponding :ref:`directives`, :ref:`roles` and :ref:`indices` will be generated. You can use them to descibe, reference and index object in your documentation.
2525

26-
For the convenience, we use default domain name "any", and we assume that we have the following schema with in :obj:confval:`any_schemas`:
26+
For the convenience, we use default domain name "any", and we assume that we have the following schema with in :any:confval:`any_schemas`:
2727

2828
.. _directives:
2929

@@ -35,10 +35,10 @@ Directives
3535
Object Description
3636
~~~~~~~~~~~~~~~~~~
3737

38-
The aboved schema created a Directive_ named with "``domain``:\ ``objtype``" (In this case, it is ``obj:cat``) for descibing object(INC, it is cat🐈).
38+
The aboved schema created a Directive_ named with "``domain``:\ ``objtype``" (In this case, it is ``any:cat``) for descibing object(INC, it is cat🐈).
3939

4040
Arguments
41-
Arguments are used to specify the :obj:tmplvar:`name` of the object. The number argument is depends on the name :py:class:`any.Field` of Schema.
41+
Arguments are used to specify the :any:tmplvar:`name` of the object. The number argument is depends on the name :py:class:`any.Field` of Schema.
4242

4343
- A ``None`` field means no argument is required
4444
- For a non-``None`` Field, see :py:attr:`any.Field` for more details
@@ -47,7 +47,7 @@ Arguments
4747

4848
Specially, If first argument is ``_`` (underscore), the directive must be located after a `Section Title`_, the text of section title is the real first argument.
4949

50-
In this case, the ``obj:cat`` directive accepts multiple argument split by newline.
50+
In this case, the ``any:cat`` directive accepts multiple argument split by newline.
5151

5252
Options
5353
All attributes defined in schema are converted to options of directive. Further, they will available in various :ref:`Templates <writing-template>`.
@@ -61,7 +61,7 @@ Options
6161
In this case, the directive has three options: ``id``, ``color`` and ``picture``.
6262

6363
Content
64-
Content is used to specify the :obj:tmplvar:`content` of the object.
64+
Content is used to specify the :any:tmplvar:`content` of the object.
6565

6666
- A ``None`` field means no content is required
6767
- For a non-``None`` Field, see :py:attr:`any.Field` for more details
@@ -94,26 +94,26 @@ Same to :ref:`sphinx:xref-syntax`, explicit title ``:role:`title <target>``` is
9494
General Reference
9595
~~~~~~~~~~~~~~~~~
9696

97-
The aboved schema created a role named with "``domain``-\ ``objtype``" (In this case, it is ``obj:cat``) for creating a reference to :ref:`object-description`. The interpreted text can be value of *any referenceable field*.
97+
The aboved schema created a role named with "``domain``-\ ``objtype``" (In this case, it is ``any:cat``) for creating a reference to :ref:`object-description`. The interpreted text can be value of *any referenceable field*.
9898

9999
=================== =================================== ========================
100-
Reference by name ``:obj:cat:`Nyan Cat``` :obj:cat:`Nyan Cat`
101-
By another name ``:obj:cat:`Nyan_Cat``` :obj:cat:`Nyan_Cat`
102-
By ID ``:obj:cat:`1``` :obj:cat:`1`
103-
Explicit title ``:obj:cat:`This cat <Nyan Cat>``` :obj:cat:`This cat <Nyan Cat>`
104-
A nonexistent cat ``:obj:cat:`mimi``` :obj:cat:`mimi`
100+
Reference by name ``:any:cat:`Nyan Cat``` :any:cat:`Nyan Cat`
101+
By another name ``:any:cat:`Nyan_Cat``` :any:cat:`Nyan_Cat`
102+
By ID ``:any:cat:`1``` :any:cat:`1`
103+
Explicit title ``:any:cat:`This cat <Nyan Cat>``` :any:cat:`This cat <Nyan Cat>`
104+
A nonexistent cat ``:any:cat:`mimi``` :any:cat:`mimi`
105105
=================== =================================== ========================
106106

107107
Field-Specific Reference
108108
~~~~~~~~~~~~~~~~~~~~~~~~
109109

110-
Role "``domain``-\ ``objtype``.\ ``field``" will be created for all referenceable Fields (In this case, it is ``obj:cat.name``, ``any:cat.id`` and ``any:cat.color``).
110+
Role "``domain``-\ ``objtype``.\ ``field``" will be created for all referenceable Fields (In this case, it is ``any:cat.name``, ``any:cat.id`` and ``any:cat.color``).
111111

112112
These roles also create reference to :ref:`object-description`. But the interpreted text must be value of field in role's name.
113113

114114
=================== =============================== ============================
115-
Reference by name ``:obj:cat.name:`Nyan Cat``` :obj:cat.name:`Nyan Cat`
116-
By ID ``:obj:cat.id:`1``` :obj:cat.id:`1`
115+
Reference by name ``:any:cat.name:`Nyan Cat``` :any:cat.name:`Nyan Cat`
116+
By ID ``:any:cat.id:`1``` :any:cat.id:`1`
117117
=================== =============================== ============================
118118

119119
.. _indices:
@@ -174,12 +174,12 @@ Reference Template has two various variants:
174174
Missing Reference Template
175175
Applied when the reference is missing.
176176

177-
.. hint:: In this template, only variables :obj:tmplvar:`objtype` and :obj:tmplvar:`title` are available.
177+
.. hint:: In this template, only variables :any:tmplvar:`objtype` and :any:tmplvar:`title` are available.
178178

179179
Ambiguous Reference Template
180180
Applied when the reference is ambiguous.
181181

182-
.. hint:: In this template, only variables :obj:tmplvar:`objtype` and :obj:tmplvar:`title` are available.
182+
.. hint:: In this template, only variables :any:tmplvar:`objtype` and :any:tmplvar:`title` are available.
183183

184184
Variables
185185
---------
@@ -192,25 +192,25 @@ All attributes defined in schema are available as variables in template. Note th
192192

193193
Beside, there are some special variable:
194194

195-
.. obj:tmplvar:: objtype
195+
.. any:tmplvar:: objtype
196196
:type: str
197197
:conf: TYPE_KEY
198198

199199
Type of object.
200200

201-
.. obj:tmplvar:: name
201+
.. any:tmplvar:: name
202202
:type: Union[None,str,List[str]]
203203
:conf: NAME_KEY
204204

205205
Name of object.
206206

207-
.. obj:tmplvar:: content
207+
.. any:tmplvar:: content
208208
:type: Union[None,str,List[str]]
209209
:conf: CONTENT_KEY
210210

211211
Content of object.
212212

213-
.. obj:tmplvar:: title
213+
.. any:tmplvar:: title
214214
:type: str
215215
:conf: TITLE_KEY
216216

0 commit comments

Comments
 (0)