Skip to content

Instantly share code, notes, and snippets.

@jordanhudgens
Created March 16, 2018 01:10
Show Gist options
  • Save jordanhudgens/20661afccb22e5bb66538198e5f72236 to your computer and use it in GitHub Desktop.
Save jordanhudgens/20661afccb22e5bb66538198e5f72236 to your computer and use it in GitHub Desktop.
class Heading:
def __init__(self, content):
self.content = content
def render(self):
return f'<h1>{self.content}</h1>'
class Div:
def __init__(self, content):
self.content = content
def render(self):
return f'<div>{self.content}</div>'
div_one = Div('Some content')
heading = Heading('My Amazing Heading')
div_two = Div('Another div')
def html_render(tag_object):
print(tag_object.render())
html_render(div_one)
html_render(div_two)
html_render(heading)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment