diff --git a/pyhtml/__init__.py b/pyhtml/__init__.py
index 82112cf..cdf925b 100644
--- a/pyhtml/__init__.py
+++ b/pyhtml/__init__.py
@@ -249,13 +249,13 @@
"""
# Disable Flake8, since it really doesn't like our docstring above
# flake8: noqa
-from .__tag_base import Tag, Comment
+from .__tag_base import Tag
from .__tags import input_, object_
__all__ = [
- 'DangerousRawHtml',
'Tag',
+ 'DangerousRawHtml',
'Comment',
'input_',
'object_',
@@ -377,6 +377,7 @@
from .__tags import (
DangerousRawHtml,
+ Comment,
html,
base,
head,
diff --git a/pyhtml/__tag_base.py b/pyhtml/__tag_base.py
index 3811b6c..0cc9e7b 100644
--- a/pyhtml/__tag_base.py
+++ b/pyhtml/__tag_base.py
@@ -116,57 +116,6 @@ def __repr__(self) -> str:
return self.render()
-class Comment(Tag):
- """
- An HTML comment.
-
- Renders as:
-
- ```html
-
- ```
-
- Note that this does not render as a `` tag
- """
- def __init__(self, text: str) -> None:
- """
- An HTML comment.
-
- Renders as:
-
- ```html
-
- ```
-
- Note that this does not render as a `` tag
- """
- self.comment_data = text
- super().__init__()
-
- def __call__(self):
- raise TypeError('Comment tags are not callable')
-
- def _get_tag_name(self) -> str:
- # Ignore coverage since this is only implemented to satisfy inheritance
- # and is never used since we override _render
- return '!--' # pragma: no cover
-
- def _render(self) -> list[str]:
- """
- Override of render, to render comments
- """
-
- return [
- ''
- ]
-
-
class SelfClosingTag(Tag):
"""
Self-closing tags don't contain child elements
diff --git a/pyhtml/__tags/__init__.py b/pyhtml/__tags/__init__.py
index e3ba89a..81f305b 100644
--- a/pyhtml/__tags/__init__.py
+++ b/pyhtml/__tags/__init__.py
@@ -7,6 +7,7 @@
from .renames import input_, object_
from .input import input
from .dangerous_raw_html import DangerousRawHtml
+from .comment import Comment
# Copy this into pyhtml/__tags/__init__.py
__all__ = [
@@ -14,6 +15,7 @@
'input',
# These are extra features of PyHTML enhanced
'DangerousRawHtml',
+ 'Comment',
# These two are renamed
'input_',
'object_',
diff --git a/pyhtml/__tags/comment.py b/pyhtml/__tags/comment.py
new file mode 100644
index 0000000..f13ddbd
--- /dev/null
+++ b/pyhtml/__tags/comment.py
@@ -0,0 +1,58 @@
+"""
+# PyHTML Enhanced / Tags / Comment
+
+Definition for the comment tag.
+"""
+from ..__tag_base import Tag
+from .. import __util as util
+
+
+class Comment(Tag):
+ """
+ An HTML comment.
+
+ Renders as:
+
+ ```html
+
+ ```
+
+ Note that this does not render as a `` tag
+ """
+ def __init__(self, text: str) -> None:
+ """
+ An HTML comment.
+
+ Renders as:
+
+ ```html
+
+ ```
+
+ Note that this does not render as a `` tag
+ """
+ self.comment_data = text
+ super().__init__()
+
+ def __call__(self):
+ raise TypeError('Comment tags are not callable')
+
+ def _get_tag_name(self) -> str:
+ # Ignore coverage since this is only implemented to satisfy inheritance
+ # and is never used since we override _render
+ return '!--' # pragma: no cover
+
+ def _render(self) -> list[str]:
+ """
+ Override of render, to render comments
+ """
+
+ return [
+ ''
+ ]
diff --git a/tests/code_gen_test.py b/tests/code_gen_test.py
index 59286c3..bf2ccd1 100644
--- a/tests/code_gen_test.py
+++ b/tests/code_gen_test.py
@@ -7,7 +7,7 @@
"""
import pytest
import pyhtml
-from pyhtml import Tag, Comment
+from pyhtml import Tag, Comment, DangerousRawHtml
all_tags = [
@@ -20,8 +20,8 @@
and type(getattr(pyhtml, i)) == type
# That are a kind of Tag
and issubclass(getattr(pyhtml, i), Tag)
- # And aren't a comment (since comments require named args)
- and not issubclass(getattr(pyhtml, i), Comment)
+ # And aren't a PyHTML feature (since comments require named args)
+ and not issubclass(getattr(pyhtml, i), (Comment, DangerousRawHtml))
)
]