Skip to content

Commit

Permalink
Fix: chapters and people inline processing
Browse files Browse the repository at this point in the history
  • Loading branch information
vahidzee committed Aug 21, 2021
1 parent 51d164f commit eadff8a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
uses: actions/checkout@v2

- name: Webify
uses: webifier/build@v0.0.6
uses: webifier/build@v0.0.7
#with:
# baseurl: '' # if you are webifying a `<name>.github.io` repository or don't wish to have the content of this
# # repository to be referred to with a "<repository-name>/" slug
Expand Down
28 changes: 15 additions & 13 deletions build/src/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,23 @@ def build_object(self, obj, image_key=None, assets_src_dir=None, assets_target_d
if isinstance(obj, list):
# if object is a list of other objects
for idx, item in enumerate(obj):
if 'kind' in obj and obj['kind'] == 'people':
item['kind'] = 'person'
if 'kind' in obj and obj['kind'] == 'chapters':
obj[idx] = self.build_link(item, assets_src_dir=assets_src_dir,
assets_target_dir=assets_target_dir)
elif isinstance(obj, dict):
if 'kind' in obj and obj['kind'] == 'chapters':
for idx, item in enumerate(obj['content']):
obj[idx] = self.build_index(item, assets_src_dir=assets_src_dir,
assets_target_dir=assets_target_dir)
else:
obj[idx] = self.build_link(item, assets_src_dir=assets_src_dir,
assets_target_dir=assets_target_dir)
elif isinstance(obj, dict):
for key, value in obj.items():
if key in ['label', 'kind'] + [image_key] if image_key is not None else []:
continue

obj[key] = self.build_object(
value, image_key, assets_src_dir=assets_src_dir, assets_target_dir=assets_target_dir)
else:
if 'kind' in obj and obj['kind'] == 'people':
for item in obj['content']:
item['kind'] = 'person'
for key, value in obj.items():
if key in ['label', 'kind'] + [image_key] if image_key is not None else []:
continue

obj[key] = self.build_object(
value, image_key, assets_src_dir=assets_src_dir, assets_target_dir=assets_target_dir)
elif isinstance(obj, str):
return build_markdown(builder=self, raw=obj, extensions=self.markdown_extensions)
else:
Expand Down

0 comments on commit eadff8a

Please sign in to comment.