Skip to content

Commit

Permalink
Link local pdfs
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Harrigan committed Feb 16, 2018
1 parent 5be11e9 commit f1f6922
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
11 changes: 10 additions & 1 deletion gitbib/gitbib.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,13 @@ def _internal_rep_none(my_meta, their_meta, *, ulog):
return my_meta


def _generic_internal_rep(ident, my_meta, *, ulog):
pdf_path = f'pdfs/{ident}.pdf'
if os.path.exists(pdf_path):
my_meta['pdf'] = pdf_path
return my_meta


def _internal_representation(ident, my_meta, *, session, ulog):
funcs = {
'doi': _internal_rep_doi,
Expand All @@ -363,7 +370,9 @@ def _internal_representation(ident, my_meta, *, session, ulog):
k = 'biorxiv'
else:
k = 'none'
return funcs[k](my_meta, their_meta[k], ulog=ulog)
my_meta = funcs[k](my_meta, their_meta[k], ulog=ulog)
my_meta = _generic_internal_rep(ident, my_meta, ulog=ulog)
return my_meta


def internal_representation(all_my_meta, *, session, ulog):
Expand Down
3 changes: 2 additions & 1 deletion gitbib/templates/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ <h6 class="card-subtitle text-muted"><strong>{{ident}}</strong></h6>
{% if entry['issue'] %}{{entry['issue']}}, {% endif %}
{% if entry['page'] %}{{entry['page']}}. {% endif %}
{% if entry['doi'] %}<a href="https://dx.doi.org/{{entry['doi']}}">doi:{{entry['doi']}}</a>{% endif %}
{% if entry['arxiv']%}<a href="https://arxiv.org/abs/{{entry['arxiv']}}">arxiv:{{entry['arxiv']}}</a>{% endif %}
{% if entry['arxiv'] %}<a href="https://arxiv.org/abs/{{entry['arxiv']}}">arxiv:{{entry['arxiv']}}</a>{% endif %}
{% if entry['pdf'] %}<a href="{{entry['pdf']}}">[pdf]</a>{% endif %}
</p>
{% if entry['description'] %}
<h6 class="m-b-0"><strong style="color: #444">Description</strong></h6>
Expand Down

0 comments on commit f1f6922

Please sign in to comment.