Last active
August 29, 2015 14:27
-
-
Save JAChapmanII/e5aa41c3fb4c4df733d0 to your computer and use it in GitHub Desktop.
text.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Property: | |
def __init__(self): | |
pass | |
class Fragment: | |
def __init__(self, text, property): | |
this.text = text | |
this.property = property | |
class ParsedText: | |
def __init__(self, fragments, property): | |
this.fragments = fragments | |
this.property = property | |
def renderToHtml(parsedText): # text is alerady parsed | |
if len(parsedText.fragments) < 1: return "" | |
result = "" | |
for fragment in parsedText.fragments: | |
result += renderText(fragment, parsedText.property) | |
def renderHtml(frag, globalProperty): | |
pass | |
def renderText(frag, globalProperty): | |
return frag.text | |
def parse(string): | |
pass | |
text = "<em>html example</em> stuff" | |
parsedText = parse(text) | |
renderedText = renderToHtml(parsedText) | |
print(renderedText) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment