Skip to content
This repository has been archived by the owner on Feb 28, 2022. It is now read-only.

Commit

Permalink
Merge pull request #24 from ericholscher/jinhwa/raise_up_example
Browse files Browse the repository at this point in the history
raise up example
  • Loading branch information
bianliu1013 committed May 26, 2017
2 parents 7dd876a + 07c30cf commit 9708559
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions docfx_yaml/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,15 @@ def find_node_in_toc_tree(toc_yaml, to_add_node):
# Raise up summary
if 'summary' in obj['syntax'] and obj['syntax']['summary']:
obj['summary'] = obj['syntax'].pop('summary')

# Raise up seealso
if 'seealso' in obj['syntax'] and obj['syntax']['seealso']:
obj['seealsoContent'] = obj['syntax'].pop('seealso')

# Raise up example
if 'example' in obj['syntax'] and obj['syntax']['example']:
obj['example'] = obj['syntax'].pop('example')

if 'references' in obj:
references.extend(obj.pop('references'))

Expand Down
4 changes: 2 additions & 2 deletions tests/test_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,11 @@ def test_examples(self):
for item in data['items']:
if item['uid'] == 'example.nap.Base.ref':
self.assertEqual(
item['syntax']['example'].split('\n')[2],
item['example'].split('\n')[2],
""">>> print('docblock 1')"""
)
self.assertEqual(
item['syntax']['example'].split('\n')[7],
item['example'].split('\n')[7],
""">>> print('docblock 2')"""
)

0 comments on commit 9708559

Please sign in to comment.