Simplify passthrough to microformats
Committed 5a4eab
--- a/webagt.py
+++ b/webagt.py
@property
def mf2json(self):
- return Semantics(mf.parse(Document(self.text, self.url).html, self.url))
+ # return Semantics(mf.parse(Document(self.text, self.url).html, self.url))
+ return mf.parse(url=self.url)
@property
def card(self):
- return Semantics(mf.representative_card(self.mf2json.data, str(self.url)))
+ # return Semantics(mf.representative_card(self.mf2json.data, str(self.url)))
+ return mf.representative_card(self.mf2json, str(self.url))
@property
def feed(self):
# for entry in feed["entries"]:
# entry["post-type"] = mf.discover_post_type(entry)
# return Semantics(feed)
- return Semantics(
- mf.representative_feed(self.mf2json.data, str(self.url), self.dom)
- )
+ # return Semantics(
+ # mf.representative_feed(self.mf2json.data, str(self.url), self.dom)
+ # )
+ return mf.representative_feed(self.mf2json, str(self.url), self.dom)
@property
def entry(self):
- return Semantics(mf.interpret_entry(self.mf2json.data, str(self.url)))
+ # return Semantics(mf.interpret_entry(self.mf2json.data, str(self.url)))
+ return mf.interpret_entry(self.mf2json, str(self.url))
@property
def event(self):
- return Semantics(
- mf.interpret_event(self.mf2json.data, source_url=str(self.url))
- )
+ # return Semantics(
+ # mf.interpret_event(self.mf2json.data, source_url=str(self.url))
+ # )
+ return mf.interpret_event(self.mf2json, source_url=str(self.url))
def mention(self, *target_urls):
- return Semantics(
- mf.interpret_comment(self.mf2json.data, str(self.url), target_urls)
- )
+ # return Semantics(
+ # mf.interpret_comment(self.mf2json.data, str(self.url), target_urls)
+ # )
+ return mf.interpret_comment(self.mf2json, str(self.url), target_urls)
# @property
# def jf2(self):
# source_url=self.url))
-class Semantics:
- def __init__(self, data):
- self.data = data
-
- def __getitem__(self, item):
- return self.data[item]
-
- def __repr__(self):
- return dump(self.data, indent=2)
- # XXX return json.dumps(self.data, indent=2)
-
- def _repr_html_(self):
- return solarized.highlight(dump(self.data, indent=2), ".json")
- # XXX return solarized.highlight(json.dumps(self.data, indent=2),
- # ".json")
-
- def __bool__(self):
- return bool(self.data)
+# class Semantics:
+# def __init__(self, data):
+# self.data = data
+#
+# def __getitem__(self, item):
+# return self.data[item]
+#
+# def __repr__(self):
+# return dump(self.data, indent=2)
+# # XXX return json.dumps(self.data, indent=2)
+#
+# def _repr_html_(self):
+# return solarized.highlight(dump(self.data, indent=2), ".json")
+# # XXX return solarized.highlight(json.dumps(self.data, indent=2),
+# # ".json")
+#
+# def __bool__(self):
+# return bool(self.data)
def _get_header_link(link_header: str, search_rel: str):