Skip to content

Commit

Permalink
v0.1.10: debug footer, html links
Browse files Browse the repository at this point in the history
  • Loading branch information
vahidzee committed Oct 21, 2021
1 parent 0fbb0e9 commit 75e6e68
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions webifier/build/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,10 @@ def build_link(self, link, assets_src_dir=None, assets_target_dir=None, search_s
else:
link['image'] = image_src
# pdf links
if 'kind' not in link and link['link'].endswith('.pdf'):
if 'kind' not in link and ('link' in link and link['link'].endswith('.pdf')):
link['kind'] = 'PDF'
if add_search_item and ('kind' not in link or link['kind'] != 'person') and not link['link'].startswith('#'):
if add_search_item and ('kind' not in link or link['kind'] != 'person') and (
'link' in link and not link['link'].startswith('#')):
self.add_search_item(
slug=link['link'], url=link['link'], title=link.get('text', link.get('kind', 'External link')),
description=link.get('description', None), kind=link.get('kind', 'External')) # todo: add full search
Expand Down
3 changes: 2 additions & 1 deletion webifier/build/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ def process_html_anchor(builder, soup, anchor, assets_src_dir=None, assets_targe
link = {key: anchor[key] for key in anchor.attrs if key not in ['href', 'class']}
if anchor.text:
link['text'] = anchor.text
if 'href' in anchor.attrs:
if 'href' in anchor.attrs and anchor['href']:

match_dict = re.match(HREF_REGEX, anchor['href']).groupdict()
link[match_dict['type'] or 'link'] = match_dict['url']
link = builder.build_link(link, assets_src_dir=assets_src_dir, add_search_item=add_search_item)
Expand Down
2 changes: 1 addition & 1 deletion webifier/jekyll/_includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class="bg-light p-3 m-auto text-center"
{% endif %}
>
{{ include.footer.text | default: include.footer | default: site.data.index.footer.text | default: site.data.index.footer }}
{{ include.footer.text | default: site.data.index.footer.text | default: site.data.index.footer }}
© Powered by <a class="link-primary" href="https://github.com/webifier/build">Webifier</a>
</div>
</footer>

0 comments on commit 75e6e68

Please sign in to comment.