Skip to content

Commit 7d8d94f

Browse files
Properly quote default values in docs
1 parent a26e43e commit 7d8d94f

File tree

2 files changed

+54
-53
lines changed

2 files changed

+54
-53
lines changed

meta/generate_tag_defs.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ def generate_tag_class(output: TextIO, tag: TagInfo):
5353
# Also mention default value if applicable
5454
if attr.default is not None:
5555
attr_docs_gen.append(
56-
f"* {attr.name}: {attr.doc} (defaults to {attr.default})")
56+
f"* `{attr.name}`: {attr.doc} (defaults to `{attr.default!r}`)"
57+
)
5758
else:
58-
attr_docs_gen.append(f"* {attr.name}: {attr.doc}")
59+
attr_docs_gen.append(f"* `{attr.name}`: {attr.doc}")
5960

6061
attr_args = '\n'.join(attr_args_gen).strip()
6162
attr_unions = '\n'.join(attr_unions_gen).strip()

pyhtml/__tags/generated.py

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ class base(SelfClosingTag):
6464
"""
6565
Specifies the base URL to use for all relative URLs in a document. There can be only one such element in a document.
6666
67-
* href: Base URL to use in the document
68-
* target: Default target to use in the document
67+
* `href`: Base URL to use in the document
68+
* `target`: Default target to use in the document
6969
7070
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base)
7171
"""
@@ -79,8 +79,8 @@ def __init__(
7979
"""
8080
Specifies the base URL to use for all relative URLs in a document. There can be only one such element in a document.
8181
82-
* href: Base URL to use in the document
83-
* target: Default target to use in the document
82+
* `href`: Base URL to use in the document
83+
* `target`: Default target to use in the document
8484
8585
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base)
8686
"""
@@ -100,8 +100,8 @@ def __call__(
100100
"""
101101
Specifies the base URL to use for all relative URLs in a document. There can be only one such element in a document.
102102
103-
* href: Base URL to use in the document
104-
* target: Default target to use in the document
103+
* `href`: Base URL to use in the document
104+
* `target`: Default target to use in the document
105105
106106
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base)
107107
"""
@@ -167,8 +167,8 @@ class link(SelfClosingTag):
167167
"""
168168
Specifies relationships between the current document and an external resource. This element is most commonly used to link to CSS but is also used to establish site icons (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things.
169169
170-
* href: Location of the file being linked to
171-
* rel: Kind of file being loaded (eg stylesheet)
170+
* `href`: Location of the file being linked to
171+
* `rel`: Kind of file being loaded (eg stylesheet)
172172
173173
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)
174174
"""
@@ -182,8 +182,8 @@ def __init__(
182182
"""
183183
Specifies relationships between the current document and an external resource. This element is most commonly used to link to CSS but is also used to establish site icons (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things.
184184
185-
* href: Location of the file being linked to
186-
* rel: Kind of file being loaded (eg stylesheet)
185+
* `href`: Location of the file being linked to
186+
* `rel`: Kind of file being loaded (eg stylesheet)
187187
188188
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)
189189
"""
@@ -203,8 +203,8 @@ def __call__(
203203
"""
204204
Specifies relationships between the current document and an external resource. This element is most commonly used to link to CSS but is also used to establish site icons (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things.
205205
206-
* href: Location of the file being linked to
207-
* rel: Kind of file being loaded (eg stylesheet)
206+
* `href`: Location of the file being linked to
207+
* `rel`: Kind of file being loaded (eg stylesheet)
208208
209209
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)
210210
"""
@@ -270,7 +270,7 @@ class style(Tag):
270270
"""
271271
Contains style information for a document or part of a document. It contains CSS, which is applied to the contents of the document containing this element.
272272
273-
* type: Type of style to use (defaults to text/css)
273+
* `type`: Type of style to use (defaults to `'text/css'`)
274274
275275
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style)
276276
"""
@@ -283,7 +283,7 @@ def __init__(
283283
"""
284284
Contains style information for a document or part of a document. It contains CSS, which is applied to the contents of the document containing this element.
285285
286-
* type: Type of style to use (defaults to text/css)
286+
* `type`: Type of style to use (defaults to `'text/css'`)
287287
288288
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style)
289289
"""
@@ -301,7 +301,7 @@ def __call__(
301301
"""
302302
Contains style information for a document or part of a document. It contains CSS, which is applied to the contents of the document containing this element.
303303
304-
* type: Type of style to use (defaults to text/css)
304+
* `type`: Type of style to use (defaults to `'text/css'`)
305305
306306
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style)
307307
"""
@@ -1938,8 +1938,8 @@ class a(StylableTag):
19381938
"""
19391939
Together with its `href` attribute, creates a hyperlink to web pages, files, email addresses, locations within the current page, or anything else a URL can address.
19401940
1941-
* href: URL of page to link to
1942-
* target: Use "_blank" to open in a new tab
1941+
* `href`: URL of page to link to
1942+
* `target`: Use "_blank" to open in a new tab
19431943
19441944
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a)
19451945
"""
@@ -1956,8 +1956,8 @@ def __init__(
19561956
"""
19571957
Together with its `href` attribute, creates a hyperlink to web pages, files, email addresses, locations within the current page, or anything else a URL can address.
19581958
1959-
* href: URL of page to link to
1960-
* target: Use "_blank" to open in a new tab
1959+
* `href`: URL of page to link to
1960+
* `target`: Use "_blank" to open in a new tab
19611961
19621962
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a)
19631963
"""
@@ -1983,8 +1983,8 @@ def __call__(
19831983
"""
19841984
Together with its `href` attribute, creates a hyperlink to web pages, files, email addresses, locations within the current page, or anything else a URL can address.
19851985
1986-
* href: URL of page to link to
1987-
* target: Use "_blank" to open in a new tab
1986+
* `href`: URL of page to link to
1987+
* `target`: Use "_blank" to open in a new tab
19881988
19891989
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a)
19901990
"""
@@ -3493,8 +3493,8 @@ class img(Tag):
34933493
"""
34943494
Embeds an image into the document.
34953495
3496-
* src: Source of the image
3497-
* alt: Alt text of the image
3496+
* `src`: Source of the image
3497+
* `alt`: Alt text of the image
34983498
34993499
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img)
35003500
"""
@@ -3508,8 +3508,8 @@ def __init__(
35083508
"""
35093509
Embeds an image into the document.
35103510
3511-
* src: Source of the image
3512-
* alt: Alt text of the image
3511+
* `src`: Source of the image
3512+
* `alt`: Alt text of the image
35133513
35143514
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img)
35153515
"""
@@ -3529,8 +3529,8 @@ def __call__(
35293529
"""
35303530
Embeds an image into the document.
35313531
3532-
* src: Source of the image
3533-
* alt: Alt text of the image
3532+
* `src`: Source of the image
3533+
* `alt`: Alt text of the image
35343534
35353535
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img)
35363536
"""
@@ -4076,7 +4076,7 @@ class script(Tag):
40764076
"""
40774077
Used to embed executable code or data; this is typically used to embed or refer to JavaScript code. The `<script>` element can also be used with other languages, such as [WebGL](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API)'s GLSL shader programming language and [JSON](/en-US/docs/Glossary/JSON).
40784078
4079-
* type: Type of script to use (defaults to text/javascript)
4079+
* `type`: Type of script to use (defaults to `'text/javascript'`)
40804080
40814081
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)
40824082
"""
@@ -4089,7 +4089,7 @@ def __init__(
40894089
"""
40904090
Used to embed executable code or data; this is typically used to embed or refer to JavaScript code. The `<script>` element can also be used with other languages, such as [WebGL](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API)'s GLSL shader programming language and [JSON](/en-US/docs/Glossary/JSON).
40914091
4092-
* type: Type of script to use (defaults to text/javascript)
4092+
* `type`: Type of script to use (defaults to `'text/javascript'`)
40934093
40944094
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)
40954095
"""
@@ -4107,7 +4107,7 @@ def __call__(
41074107
"""
41084108
Used to embed executable code or data; this is typically used to embed or refer to JavaScript code. The `<script>` element can also be used with other languages, such as [WebGL](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API)'s GLSL shader programming language and [JSON](/en-US/docs/Glossary/JSON).
41094109
4110-
* type: Type of script to use (defaults to text/javascript)
4110+
* `type`: Type of script to use (defaults to `'text/javascript'`)
41114111
41124112
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)
41134113
"""
@@ -4844,7 +4844,7 @@ class form(Tag):
48444844
"""
48454845
Represents a document section containing interactive controls for submitting information.
48464846
4847-
* method: HTTP request method to use (defaults to POST)
4847+
* `method`: HTTP request method to use (defaults to `'POST'`)
48484848
48494849
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form)
48504850
"""
@@ -4857,7 +4857,7 @@ def __init__(
48574857
"""
48584858
Represents a document section containing interactive controls for submitting information.
48594859
4860-
* method: HTTP request method to use (defaults to POST)
4860+
* `method`: HTTP request method to use (defaults to `'POST'`)
48614861
48624862
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form)
48634863
"""
@@ -4875,7 +4875,7 @@ def __call__(
48754875
"""
48764876
Represents a document section containing interactive controls for submitting information.
48774877
4878-
* method: HTTP request method to use (defaults to POST)
4878+
* `method`: HTTP request method to use (defaults to `'POST'`)
48794879
48804880
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form)
48814881
"""
@@ -4892,11 +4892,11 @@ class input(SelfClosingTag):
48924892
"""
48934893
Used to create interactive controls for web-based forms to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent. The `<input>` element is one of the most powerful and complex in all of HTML due to the sheer number of combinations of input types and attributes.
48944894
4895-
* type: Kind of input control to use (checkbox, radio, date, password, text, etc)
4896-
* name: Name of the field. Submitted with the form as part of a name/value pair
4897-
* value: Initial value of the control
4898-
* readonly: Include if field is read-only (defaults to False)
4899-
* required: Include if field is required (defaults to False)
4895+
* `type`: Kind of input control to use (checkbox, radio, date, password, text, etc)
4896+
* `name`: Name of the field. Submitted with the form as part of a name/value pair
4897+
* `value`: Initial value of the control
4898+
* `readonly`: Include if field is read-only (defaults to `False`)
4899+
* `required`: Include if field is required (defaults to `False`)
49004900
49014901
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input)
49024902
"""
@@ -4913,11 +4913,11 @@ def __init__(
49134913
"""
49144914
Used to create interactive controls for web-based forms to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent. The `<input>` element is one of the most powerful and complex in all of HTML due to the sheer number of combinations of input types and attributes.
49154915
4916-
* type: Kind of input control to use (checkbox, radio, date, password, text, etc)
4917-
* name: Name of the field. Submitted with the form as part of a name/value pair
4918-
* value: Initial value of the control
4919-
* readonly: Include if field is read-only (defaults to False)
4920-
* required: Include if field is required (defaults to False)
4916+
* `type`: Kind of input control to use (checkbox, radio, date, password, text, etc)
4917+
* `name`: Name of the field. Submitted with the form as part of a name/value pair
4918+
* `value`: Initial value of the control
4919+
* `readonly`: Include if field is read-only (defaults to `False`)
4920+
* `required`: Include if field is required (defaults to `False`)
49214921
49224922
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input)
49234923
"""
@@ -4943,11 +4943,11 @@ def __call__(
49434943
"""
49444944
Used to create interactive controls for web-based forms to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent. The `<input>` element is one of the most powerful and complex in all of HTML due to the sheer number of combinations of input types and attributes.
49454945
4946-
* type: Kind of input control to use (checkbox, radio, date, password, text, etc)
4947-
* name: Name of the field. Submitted with the form as part of a name/value pair
4948-
* value: Initial value of the control
4949-
* readonly: Include if field is read-only (defaults to False)
4950-
* required: Include if field is required (defaults to False)
4946+
* `type`: Kind of input control to use (checkbox, radio, date, password, text, etc)
4947+
* `name`: Name of the field. Submitted with the form as part of a name/value pair
4948+
* `value`: Initial value of the control
4949+
* `readonly`: Include if field is read-only (defaults to `False`)
4950+
* `required`: Include if field is required (defaults to `False`)
49514951
49524952
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input)
49534953
"""
@@ -4968,7 +4968,7 @@ class label(Tag):
49684968
"""
49694969
Represents a caption for an item in a user interface.
49704970
4971-
* for_: ID of input field to associate this label with
4971+
* `for_`: ID of input field to associate this label with
49724972
49734973
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label)
49744974
"""
@@ -4981,7 +4981,7 @@ def __init__(
49814981
"""
49824982
Represents a caption for an item in a user interface.
49834983
4984-
* for_: ID of input field to associate this label with
4984+
* `for_`: ID of input field to associate this label with
49854985
49864986
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label)
49874987
"""
@@ -4999,7 +4999,7 @@ def __call__(
49994999
"""
50005000
Represents a caption for an item in a user interface.
50015001
5002-
* for_: ID of input field to associate this label with
5002+
* `for_`: ID of input field to associate this label with
50035003
50045004
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label)
50055005
"""

0 commit comments

Comments
 (0)