Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added MDString and MDReport classes as well as version increase.
- Loading branch information
Showing
4 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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>' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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>' |
This file contains 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