Skip to content

Commit

Permalink
Added MDString and MDReport classes as well as version increase.
Browse files Browse the repository at this point in the history
  • Loading branch information
Xero64 committed Dec 16, 2019
1 parent 7983895 commit 117439b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
2 changes: 2 additions & 0 deletions py2md/classes/__init__.py
Expand Up @@ -2,3 +2,5 @@
from .mdtable import MDTable
from .mdheading import MDHeading
from .mdmatrix import MDMatrix
from .mdstring import MDString
from .mdreport import MDReport
16 changes: 16 additions & 0 deletions py2md/classes/mdreport.py
@@ -0,0 +1,16 @@
class MDReport(object):
objs = None
def __init__(self):
self.objs = []
def add_object(self, obj):
if hasattr(obj, '_repr_markdown_'):
self.objs.append(obj)
def __str__(self):
mdstr = ''
for obj in self.objs:
mdstr += obj._repr_markdown_()
return mdstr
def _repr_markdown_(self):
return self.__str__()
def __repr__(self):
return '<MDReport>'
10 changes: 10 additions & 0 deletions py2md/classes/mdstring.py
@@ -0,0 +1,10 @@
class MDString(object):
string = None
def __init__(self, string: str):
self.string = string
def __str__(self):
return self.string
def _repr_markdown_(self):
return self.__str__()
def __repr__(self):
return '<MDString>'
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -5,7 +5,7 @@

setup(
name="py2md",
version="0.0.6",
version="0.0.7",
author="Xero64",
author_email="xero64@gmail.com",
description="Run python code in jupyter to generate markdown reports.",
Expand Down

0 comments on commit 117439b

Please sign in to comment.