Skip to content

Commit f1f6922

Browse files
author
Matthew Harrigan
committed
Link local pdfs
1 parent 5be11e9 commit f1f6922

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

gitbib/gitbib.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,13 @@ def _internal_rep_none(my_meta, their_meta, *, ulog):
344344
return my_meta
345345

346346

347+
def _generic_internal_rep(ident, my_meta, *, ulog):
348+
pdf_path = f'pdfs/{ident}.pdf'
349+
if os.path.exists(pdf_path):
350+
my_meta['pdf'] = pdf_path
351+
return my_meta
352+
353+
347354
def _internal_representation(ident, my_meta, *, session, ulog):
348355
funcs = {
349356
'doi': _internal_rep_doi,
@@ -363,7 +370,9 @@ def _internal_representation(ident, my_meta, *, session, ulog):
363370
k = 'biorxiv'
364371
else:
365372
k = 'none'
366-
return funcs[k](my_meta, their_meta[k], ulog=ulog)
373+
my_meta = funcs[k](my_meta, their_meta[k], ulog=ulog)
374+
my_meta = _generic_internal_rep(ident, my_meta, ulog=ulog)
375+
return my_meta
367376

368377

369378
def internal_representation(all_my_meta, *, session, ulog):

gitbib/templates/template.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ <h6 class="card-subtitle text-muted"><strong>{{ident}}</strong></h6>
120120
{% if entry['issue'] %}{{entry['issue']}}, {% endif %}
121121
{% if entry['page'] %}{{entry['page']}}. {% endif %}
122122
{% if entry['doi'] %}<a href="https://dx.doi.org/{{entry['doi']}}">doi:{{entry['doi']}}</a>{% endif %}
123-
{% if entry['arxiv']%}<a href="https://arxiv.org/abs/{{entry['arxiv']}}">arxiv:{{entry['arxiv']}}</a>{% endif %}
123+
{% if entry['arxiv'] %}<a href="https://arxiv.org/abs/{{entry['arxiv']}}">arxiv:{{entry['arxiv']}}</a>{% endif %}
124+
{% if entry['pdf'] %}<a href="{{entry['pdf']}}">[pdf]</a>{% endif %}
124125
</p>
125126
{% if entry['description'] %}
126127
<h6 class="m-b-0"><strong style="color: #444">Description</strong></h6>

0 commit comments

Comments
 (0)