-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add whitespace sensitive tag support
- Loading branch information
1 parent
8a23a05
commit 9356b7c
Showing
9 changed files
with
129 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
class {name}({base}): | ||
""" | ||
{description} | ||
{attr_docs_outer} | ||
[View full documentation]({link}) | ||
""" | ||
def __init__( | ||
self, | ||
*children: ChildrenType, | ||
{attr_args} | ||
**attributes: AttributeType, | ||
) -> None: | ||
""" | ||
{description} | ||
{attr_docs_inner} | ||
[View full documentation]({link}) | ||
""" | ||
attributes |= { | ||
{attr_unions} | ||
} | ||
super().__init__(*children, **attributes) | ||
|
||
def __call__( # type: ignore | ||
self, | ||
*children: ChildrenType, | ||
{attr_args} | ||
**attributes: AttributeType, | ||
): | ||
""" | ||
{description} | ||
{attr_docs_inner} | ||
[View full documentation]({link}) | ||
""" | ||
attributes |= { | ||
{attr_unions} | ||
} | ||
return super().__call__(*children, **attributes) | ||
|
||
def _get_default_attributes(self, given: dict[str, AttributeType]) -> dict[str, AttributeType]: | ||
return {default_attrs} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
""" | ||
# Test / Whitespace Sensitive Test | ||
Tests for rendering whitespace sensitive tags. | ||
""" | ||
import pyhtml as p | ||
|
||
|
||
def test_pre(): | ||
assert str(p.pre("hello\nworld")) == '\n'.join([ | ||
"<pre>hello", | ||
"world</pre>", | ||
]) | ||
|
||
|
||
def test_textarea(): | ||
assert str(p.textarea("hello\nworld")) == '\n'.join([ | ||
"<textarea>hello", | ||
"world</textarea>", | ||
]) | ||
|
||
|
||
def test_indentation_ignored(): | ||
assert str(p.body(p.pre("hello\nworld"))) == '\n'.join([ | ||
"<body>", | ||
" <pre>hello", | ||
"world</pre>", | ||
"</body>", | ||
]) |