XEP-0461: add get fallback body helper

This commit is contained in:
nicoco
2022-11-22 10:23:52 +01:00
parent 7300f1285e
commit 9b89401b36
2 changed files with 20 additions and 0 deletions
+10
View File
@@ -18,6 +18,16 @@ class FeatureFallBack(ElementBase):
plugin_attrib = "feature_fallback"
interfaces = {"for"}
def get_fallback_body(self):
# only works for a single fallback_body attrib
start = self["fallback_body"]["start"]
end = self["fallback_body"]["end"]
body = self.parent()["body"]
if start < end < len(body):
return body[start:end]
else:
return ""
def get_stripped_body(self):
# only works for a single fallback_body attrib
start = self["fallback_body"]["start"]