Update formatted_text.py

This commit is contained in:
Hellow2 2023-03-13 14:28:28 +01:00
parent 73e90e467e
commit a11a4ca4c2

View File

@ -10,6 +10,10 @@ https://pandoc.org/installing.html
class FormattedText: class FormattedText:
"""
the self.html value should be saved to the database
"""
doc = None doc = None
def __init__( def __init__(
@ -51,23 +55,13 @@ class FormattedText:
if self.doc is None: if self.doc is None:
return None return None
return pandoc.write(self.doc, format="plain").strip() return pandoc.write(self.doc, format="plain").strip()
@property
def json(self) -> str:
if self.doc is None:
return None
return pandoc.write(self.doc, format="json")
plaintext = property(fget=get_plaintext, fset=set_plaintext) plaintext = property(fget=get_plaintext, fset=set_plaintext)
markdown = property(fget=get_markdown, fset=set_markdown) markdown = property(fget=get_markdown, fset=set_markdown)
html = property(fget=get_html, fset=set_html) html = property(fget=get_html, fset=set_html)
class NotesAttributes:
def __init__(self) -> None:
pass
if __name__ == "__main__": if __name__ == "__main__":
_plaintext = """ _plaintext = """
World of Work World of Work