a bit of refactoring and implemented some more scraping

This commit is contained in:
Hellow
2023-02-06 23:47:13 +01:00
parent 8362e2d5eb
commit ec9bb69069
2 changed files with 40 additions and 9 deletions

View File

@@ -8,15 +8,16 @@ https://pandoc.org/installing.html
!!!!!!!!!!!!!!!!!!IMPORTANT!!!!!!!!!!!!!!!!!!
"""
class FormattedText:
doc = None
def __init__(
self,
plaintext: str = None,
markdown: str = None,
html: str = None
) -> None:
self,
plaintext: str = None,
markdown: str = None,
html: str = None
) -> None:
self.set_plaintext(plaintext)
self.set_markdown(markdown)
self.set_html(html)
@@ -46,7 +47,7 @@ class FormattedText:
return None
return pandoc.write(self.doc, format="html").strip()
def get_plaintext(self)-> str:
def get_plaintext(self) -> str:
if self.doc is None:
return None
return pandoc.write(self.doc, format="plain").strip()
@@ -60,6 +61,7 @@ class NotesAttributes:
def __init__(self) -> None:
pass
if __name__ == "__main__":
_plaintext = """
World of Work
@@ -118,4 +120,4 @@ According to the band, "Ghost Bath" refers to "the act of committing suicide by
# print("-"*30)
# print(notes.get_markdown())
print(notes.get_markdown())
print(notes.get_markdown())