summaryrefslogtreecommitdiff
path: root/bs4/element.py
diff options
context:
space:
mode:
Diffstat (limited to 'bs4/element.py')
-rw-r--r--bs4/element.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/bs4/element.py b/bs4/element.py
index 3eed924..57a24d0 100644
--- a/bs4/element.py
+++ b/bs4/element.py
@@ -1012,6 +1012,11 @@ class NavigableString(str, PageElement):
# Do nothing if the caller is looking for specific types of
# string, and we're of a different type.
+ #
+ # We check specific types instead of using isinstance(self,
+ # types) because all of these classes subclass
+ # NavigableString. Anyone who's using this feature probably
+ # wants generic NavigableStrings but not other stuff.
my_type = type(self)
if types is not None:
if isinstance(types, type):
@@ -1140,6 +1145,27 @@ class TemplateString(NavigableString):
pass
+class RubyTextString(NavigableString):
+ """A NavigableString representing the contents of the <rt> HTML
+ element.
+
+ https://dev.w3.org/html5/spec-LC/text-level-semantics.html#the-rt-element
+
+ Can be used to distinguish such strings from the strings they're
+ annotating.
+ """
+ pass
+
+
+class RubyParenthesisString(NavigableString):
+ """A NavigableString representing the contents of the <rp> HTML
+ element.
+
+ https://dev.w3.org/html5/spec-LC/text-level-semantics.html#the-rp-element
+ """
+ pass
+
+
class Tag(PageElement):
"""Represents an HTML or XML tag that is part of a parse tree, along
with its attributes and contents.