forked from SCOAP3/scoap3-legacy
/
generate_scoap3_repo_page.py
35 lines (31 loc) · 1.39 KB
/
generate_scoap3_repo_page.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from cgi import escape
from invenio.htmlutils import remove_html_markup
from invenio.search_engine import get_collection_reclist, get_coll_i18nname, get_record
from invenio.bibrecord import record_get_field_value
CFG_JOURNALS = ['Acta',
'Advances in High Energy Physics',
'Chinese Physics C',
'European Physical Journal C',
'Journal of Cosmology and Astroparticle Physics',
'Journal of High Energy Physics',
'New Journal of Physics',
'Nuclear Physics B',
'Physics Letters B',
'Progress of Theoretical and Experimental Physics']
def main():
for journal in CFG_JOURNALS:
name = get_coll_i18nname(journal)
reclist = get_collection_reclist(journal)
print "<h2>%s</h2>" % escape(name)
if not reclist:
print "<p>None yet.</p>"
continue
print "<p><ul>"
for recid in reclist:
record = get_record(recid)
title = remove_html_markup(record_get_field_value(record, '245', code='a'), remove_escaped_chars_p=False).strip()
doi = record_get_field_value(record, '024', '7', code='a')
print '<li><a href="http://dx.doi.org/%s" target="_blank">%s</a>: %s</li>' % (escape(doi, True), escape(doi), title)
print "</ul></p>"
if __name__ == "__main__":
main()