Skip to content

Commit

Permalink
Added the: say 'thm' or 'defn', etc instead of 'description' for the …
Browse files Browse the repository at this point in the history
…description attribute. feature to the printable_html feature (issue #48)
  • Loading branch information
MareoRaft committed Jul 29, 2017
1 parent 0421a3a commit 52001f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion server/lib/attr.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def as_dict(self):
def __str__(self):
return 'Attr{}'.format(self.as_dict())

def as_printable_html(self, display_large_name=False):
def as_printable_html(self, display_large_name=True):
string = ''

# check for stupid blank stuff
Expand Down
9 changes: 7 additions & 2 deletions server/lib/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def __eq__(self, other):
def __ne__(self, other):
return not self.__eq__(other)

def as_printable_html(self):
def as_printable_html(self, display_node_type_in_description=True):
# keys to display
# 'type', 'number', 'name', 'description', 'synonyms', 'plurals', 'notes', 'intuitions', 'examples', 'counterexamples', 'negation', 'proofs', 'importance'
keys = ['type', 'name', 'description', 'notes', 'intuitions', 'examples', 'counterexamples', 'proofs']
Expand All @@ -166,7 +166,12 @@ def as_printable_html(self):
pass
else:
attr = self.attrs[key]
attr_as_html = attr.as_printable_html(display_large_name=True)
attr_as_html = attr.as_printable_html()
# make the 'description' say the node type
if display_node_type_in_description:
if key == 'description':
node_type = self.type
attr_as_html = re.sub(r'description', node_type, attr_as_html, count=1)
string = string + attr_as_html
string += '$\\endgroup$' # end scope
# string = render_content_func(string)
Expand Down

0 comments on commit 52001f1

Please sign in to comment.