Skip to content

Commit

Permalink
Properly quote default values in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
MaddyGuthridge committed Oct 3, 2023
1 parent a26e43e commit 7d8d94f
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 53 deletions.
5 changes: 3 additions & 2 deletions meta/generate_tag_defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ def generate_tag_class(output: TextIO, tag: TagInfo):
# Also mention default value if applicable
if attr.default is not None:
attr_docs_gen.append(
f"* {attr.name}: {attr.doc} (defaults to {attr.default})")
f"* `{attr.name}`: {attr.doc} (defaults to `{attr.default!r}`)"
)
else:
attr_docs_gen.append(f"* {attr.name}: {attr.doc}")
attr_docs_gen.append(f"* `{attr.name}`: {attr.doc}")

attr_args = '\n'.join(attr_args_gen).strip()
attr_unions = '\n'.join(attr_unions_gen).strip()
Expand Down
102 changes: 51 additions & 51 deletions pyhtml/__tags/generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class base(SelfClosingTag):
"""
Specifies the base URL to use for all relative URLs in a document. There can be only one such element in a document.
* href: Base URL to use in the document
* target: Default target to use in the document
* `href`: Base URL to use in the document
* `target`: Default target to use in the document
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base)
"""
Expand All @@ -79,8 +79,8 @@ def __init__(
"""
Specifies the base URL to use for all relative URLs in a document. There can be only one such element in a document.
* href: Base URL to use in the document
* target: Default target to use in the document
* `href`: Base URL to use in the document
* `target`: Default target to use in the document
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base)
"""
Expand All @@ -100,8 +100,8 @@ def __call__(
"""
Specifies the base URL to use for all relative URLs in a document. There can be only one such element in a document.
* href: Base URL to use in the document
* target: Default target to use in the document
* `href`: Base URL to use in the document
* `target`: Default target to use in the document
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base)
"""
Expand Down Expand Up @@ -167,8 +167,8 @@ class link(SelfClosingTag):
"""
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.
* href: Location of the file being linked to
* rel: Kind of file being loaded (eg stylesheet)
* `href`: Location of the file being linked to
* `rel`: Kind of file being loaded (eg stylesheet)
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)
"""
Expand All @@ -182,8 +182,8 @@ def __init__(
"""
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.
* href: Location of the file being linked to
* rel: Kind of file being loaded (eg stylesheet)
* `href`: Location of the file being linked to
* `rel`: Kind of file being loaded (eg stylesheet)
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)
"""
Expand All @@ -203,8 +203,8 @@ def __call__(
"""
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.
* href: Location of the file being linked to
* rel: Kind of file being loaded (eg stylesheet)
* `href`: Location of the file being linked to
* `rel`: Kind of file being loaded (eg stylesheet)
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)
"""
Expand Down Expand Up @@ -270,7 +270,7 @@ class style(Tag):
"""
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.
* type: Type of style to use (defaults to text/css)
* `type`: Type of style to use (defaults to `'text/css'`)
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style)
"""
Expand All @@ -283,7 +283,7 @@ def __init__(
"""
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.
* type: Type of style to use (defaults to text/css)
* `type`: Type of style to use (defaults to `'text/css'`)
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style)
"""
Expand All @@ -301,7 +301,7 @@ def __call__(
"""
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.
* type: Type of style to use (defaults to text/css)
* `type`: Type of style to use (defaults to `'text/css'`)
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style)
"""
Expand Down Expand Up @@ -1938,8 +1938,8 @@ class a(StylableTag):
"""
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.
* href: URL of page to link to
* target: Use "_blank" to open in a new tab
* `href`: URL of page to link to
* `target`: Use "_blank" to open in a new tab
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a)
"""
Expand All @@ -1956,8 +1956,8 @@ def __init__(
"""
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.
* href: URL of page to link to
* target: Use "_blank" to open in a new tab
* `href`: URL of page to link to
* `target`: Use "_blank" to open in a new tab
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a)
"""
Expand All @@ -1983,8 +1983,8 @@ def __call__(
"""
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.
* href: URL of page to link to
* target: Use "_blank" to open in a new tab
* `href`: URL of page to link to
* `target`: Use "_blank" to open in a new tab
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a)
"""
Expand Down Expand Up @@ -3493,8 +3493,8 @@ class img(Tag):
"""
Embeds an image into the document.
* src: Source of the image
* alt: Alt text of the image
* `src`: Source of the image
* `alt`: Alt text of the image
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img)
"""
Expand All @@ -3508,8 +3508,8 @@ def __init__(
"""
Embeds an image into the document.
* src: Source of the image
* alt: Alt text of the image
* `src`: Source of the image
* `alt`: Alt text of the image
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img)
"""
Expand All @@ -3529,8 +3529,8 @@ def __call__(
"""
Embeds an image into the document.
* src: Source of the image
* alt: Alt text of the image
* `src`: Source of the image
* `alt`: Alt text of the image
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img)
"""
Expand Down Expand Up @@ -4076,7 +4076,7 @@ class script(Tag):
"""
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).
* type: Type of script to use (defaults to text/javascript)
* `type`: Type of script to use (defaults to `'text/javascript'`)
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)
"""
Expand All @@ -4089,7 +4089,7 @@ def __init__(
"""
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).
* type: Type of script to use (defaults to text/javascript)
* `type`: Type of script to use (defaults to `'text/javascript'`)
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)
"""
Expand All @@ -4107,7 +4107,7 @@ def __call__(
"""
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).
* type: Type of script to use (defaults to text/javascript)
* `type`: Type of script to use (defaults to `'text/javascript'`)
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)
"""
Expand Down Expand Up @@ -4844,7 +4844,7 @@ class form(Tag):
"""
Represents a document section containing interactive controls for submitting information.
* method: HTTP request method to use (defaults to POST)
* `method`: HTTP request method to use (defaults to `'POST'`)
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form)
"""
Expand All @@ -4857,7 +4857,7 @@ def __init__(
"""
Represents a document section containing interactive controls for submitting information.
* method: HTTP request method to use (defaults to POST)
* `method`: HTTP request method to use (defaults to `'POST'`)
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form)
"""
Expand All @@ -4875,7 +4875,7 @@ def __call__(
"""
Represents a document section containing interactive controls for submitting information.
* method: HTTP request method to use (defaults to POST)
* `method`: HTTP request method to use (defaults to `'POST'`)
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form)
"""
Expand All @@ -4892,11 +4892,11 @@ class input(SelfClosingTag):
"""
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.
* type: Kind of input control to use (checkbox, radio, date, password, text, etc)
* name: Name of the field. Submitted with the form as part of a name/value pair
* value: Initial value of the control
* readonly: Include if field is read-only (defaults to False)
* required: Include if field is required (defaults to False)
* `type`: Kind of input control to use (checkbox, radio, date, password, text, etc)
* `name`: Name of the field. Submitted with the form as part of a name/value pair
* `value`: Initial value of the control
* `readonly`: Include if field is read-only (defaults to `False`)
* `required`: Include if field is required (defaults to `False`)
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input)
"""
Expand All @@ -4913,11 +4913,11 @@ def __init__(
"""
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.
* type: Kind of input control to use (checkbox, radio, date, password, text, etc)
* name: Name of the field. Submitted with the form as part of a name/value pair
* value: Initial value of the control
* readonly: Include if field is read-only (defaults to False)
* required: Include if field is required (defaults to False)
* `type`: Kind of input control to use (checkbox, radio, date, password, text, etc)
* `name`: Name of the field. Submitted with the form as part of a name/value pair
* `value`: Initial value of the control
* `readonly`: Include if field is read-only (defaults to `False`)
* `required`: Include if field is required (defaults to `False`)
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input)
"""
Expand All @@ -4943,11 +4943,11 @@ def __call__(
"""
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.
* type: Kind of input control to use (checkbox, radio, date, password, text, etc)
* name: Name of the field. Submitted with the form as part of a name/value pair
* value: Initial value of the control
* readonly: Include if field is read-only (defaults to False)
* required: Include if field is required (defaults to False)
* `type`: Kind of input control to use (checkbox, radio, date, password, text, etc)
* `name`: Name of the field. Submitted with the form as part of a name/value pair
* `value`: Initial value of the control
* `readonly`: Include if field is read-only (defaults to `False`)
* `required`: Include if field is required (defaults to `False`)
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input)
"""
Expand All @@ -4968,7 +4968,7 @@ class label(Tag):
"""
Represents a caption for an item in a user interface.
* for_: ID of input field to associate this label with
* `for_`: ID of input field to associate this label with
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label)
"""
Expand All @@ -4981,7 +4981,7 @@ def __init__(
"""
Represents a caption for an item in a user interface.
* for_: ID of input field to associate this label with
* `for_`: ID of input field to associate this label with
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label)
"""
Expand All @@ -4999,7 +4999,7 @@ def __call__(
"""
Represents a caption for an item in a user interface.
* for_: ID of input field to associate this label with
* `for_`: ID of input field to associate this label with
[View full documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label)
"""
Expand Down

0 comments on commit 7d8d94f

Please sign in to comment.