Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
publication_list: rename "PDF" to "fulltext"
  • Loading branch information
xuhdev committed Feb 11, 2016
1 parent b9326f8 commit f5eea0b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions tests/data/publication_list/test.bib
Expand Up @@ -5,7 +5,7 @@ @article{a2015
journal = {Great Journal},
volume = 1,
page = {1--10},
pdf = {/pdf/a2015.pdf}
fulltext = {/pdf/a2015.pdf}
}

@book{b2010,
Expand All @@ -14,7 +14,7 @@ @book{b2010
year = 2010,
isbn = {000-0000000000},
publisher = {Nikola Tesla Publishing Group},
pdf = {http://example.org/b2010.pdf}
fulltext = {http://example.org/b2010.pdf}
}

@inproceedings{p2015,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_publication_list.py
Expand Up @@ -31,10 +31,10 @@ def test_default(self):
expected = (
'<div class = "publication-list">'
'<h3>2015</h3><ul>'
'<li class = "publication">.*One article in 2015.*<a href="https://example.com/bibtex/a2015.bib">BibTeX</a>.*<a href="/pdf/a2015.pdf">PDF</a>.*<a href="https://example.com/papers/a2015.html">abstract and details</a>.*</li>'
'<li class = "publication">.*One article in 2015.*<a href="https://example.com/bibtex/a2015.bib">BibTeX</a>.*<a href="/pdf/a2015.pdf">full text</a>.*<a href="https://example.com/papers/a2015.html">abstract and details</a>.*</li>'
'<li class = "publication">.*One conference in 2015.*<a href="https://example.com/bibtex/p2015.bib">BibTeX</a>.*<a href="https://example.com/papers/p2015.html">abstract and details</a>.*</li>'
'</ul><h3>2010</h3><ul>'
'<li class = "publication">.*One Book in 2010.*<a href="https://example.com/bibtex/b2010.bib">BibTeX</a>.*<a href="http://example.org/b2010.pdf">PDF</a>.*<a href="https://example.com/papers/b2010.html">abstract and details</a>.*</li>'
'<li class = "publication">.*One Book in 2010.*<a href="https://example.com/bibtex/b2010.bib">BibTeX</a>.*<a href="http://example.org/b2010.pdf">full text</a>.*<a href="https://example.com/papers/b2010.html">abstract and details</a>.*</li>'
'</ul></div>'
)
self.sample = '.. publication_list:: tests/data/publication_list/test.bib\n\t:highlight_author: Nikola Tesla'
Expand Down
9 changes: 6 additions & 3 deletions v7/publication_list/publication_list.py
Expand Up @@ -113,8 +113,8 @@ def run(self):
extra_links += '[<a href="{}">BibTeX</a>] '.format(
self.site.config['BASE_URL'] + bib_link)

if 'pdf' in entry.fields: # the link to the pdf file
extra_links += '[<a href="{}">PDF</a>] '.format(entry.fields['pdf'])
if 'fulltext' in entry.fields: # the link to the full text, usually a link to the pdf file
extra_links += '[<a href="{}">full text</a>] '.format(entry.fields['fulltext'])

if extra_links or detail_page_dir:
html += '<br/>'
Expand All @@ -131,11 +131,14 @@ def run(self):
'default_lang': self.site.config['DEFAULT_LANG'],
'label': label,
'lang': self.site.config['DEFAULT_LANG'],
'pdf': entry.fields['pdf'] if 'pdf' in entry.fields else '',
'permalink': self.site.config['SITE_URL'] + page_url,
'reference': pub_html,
'extra_links': extra_links
}

if 'fulltext' in entry.fields and entry.fields['fulltext'].endswith('.pdf'):
context['pdf'] = entry.fields['fulltext']

self.site.render_template(
'publication.tmpl',
os.path.sep.join((self.output_folder, detail_page_dir, label + '.html')),
Expand Down

0 comments on commit f5eea0b

Please sign in to comment.