publist

managing my list of publications, talks, reviews
git clone https://a3nm.net/git/publist/
Log | Files | Refs | README | LICENSE

commit 2a9f117622f21b27415d616d6bc6fd8b3ec76ff6
parent 048a9d8caee58d0e0409bbd27ab683b376916088
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Wed,  6 Jan 2021 21:56:30 +0100

support to hide non-oa venues

Diffstat:
make_talks_html.py | 25+++++++++++++++++++------
makereviews.py | 8++++----
maketex.py | 11+++++++----
parserec.py | 46++++++++++++++++++++++++++++++++++++++++------
4 files changed, 70 insertions(+), 20 deletions(-)

diff --git a/make_talks_html.py b/make_talks_html.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 import os -from parserec import parse, stz, getvenue, isurlrel, getyear, endswithpunct, authorname +from parserec import parse, stz, getvenue, isurlrel, getyear, endswithpunct, authorname, talk_types import datetime import sys @@ -48,21 +48,33 @@ def maketitle(publi, prefix): return ('<a class="papertitle"%s>%s</a>%s<br/>' % (urltext, publi['title'], "" if endswithpunct(publi) else ".")) -def makevenue2(venue, typ, url, issue, links=True): +def makevenue2(venue, lang, typ, url, issue, links=True, hidden=False): + global stz urltext = '' if url: urltext = ' href="%s"' % url issuetext = '' if len(issue) > 0: issuetext = ', %s' % issue + if hidden and venue not in stz['submitted'].values() and typ != None: + year = None + try: + year = venue[-4:] + except IndexError: + pass + return (stz['published at non oa'][lang] % stz[typ][lang] + + (", " + year if year and year.isdigit() else "") + + '<a href="/work/research/openaccess/#PublishNonOA">' + + stz['oaexplain'][lang] + '</a>' + ) if len(urltext) > 0 and links: return ('<a%s>%s</a>%s' % (urltext, venue, issuetext)) return (venue + issuetext) -def makevenue(publi, lang, links=True): +def makevenue(publi, lang, links=True, hidenonoa=False): global venuesz - venue, typ, url, issue, keywords = getvenue(publi, lang, venuesz) - return makevenue2(venue, typ, url, issue, links=links) + venue, typ, url, issue, oa, keywords = getvenue(publi, lang, venuesz) + return makevenue2(venue, lang, typ, url, issue, links=links, hidden=(not oa and hidenonoa)) def makesuppl(publi, lang, ismain=False): global stz @@ -188,7 +200,7 @@ if __name__ == '__main__': print(',\n'.join(makeauthor(a) for a in authors) + '.<br/>', file=fout) print(maketitle(publi, prefix), file=fout) - print(makevenue(publi, lang) + '.', file=fout, end="") + print(makevenue(publi, lang, hidenonoa=(fout == fmain)) + '.', file=fout, end="") hadbr = False if 'type' in publi.keys() and publi['type'] in ['demo', 'spotlight', 'shortpaper', 'posterpaper']: @@ -338,6 +350,7 @@ if __name__ == '__main__': items = [] if 'type' in talk.keys(): + assert(talk['type'] in talk_types) items.append(stz[talk['type']][lang]) if 'venue' in talk.keys() or ('venue' + lang) in talk.keys(): diff --git a/makereviews.py b/makereviews.py @@ -65,9 +65,9 @@ def reviewtotex(x): ans = venuetotex(tex_emifjournal(mkvenuename(venue, short=True), venue), venue['url'], None) return ans + getmisc(review) -def reviewtohtml(x): +def reviewtohtml(lang, x): review, venue = x - ans = makevenue2(mkvenuename(venue), venue['type'] if 'type' in venue.keys() + ans = makevenue2(mkvenuename(venue), lang, venue['type'] if 'type' in venue.keys() else '', venue['url'], "") return ans + getmisc(review) @@ -118,7 +118,7 @@ if fmt == 'tex': else: assert(fmt == 'html') print("<dt>%s</dt><dd>%s</dd>" % (term[lang]['pc'], - ",\n".join(reviewtohtml(x) for x in pc))) + ",\n".join(reviewtohtml(lang, x) for x in pc))) print("<dt>%s</dt><dd>%s</dd>" % (term[lang]['misc'], - ",\n".join(reviewtohtml(x) for x in journal_misc + other_misc))) + ",\n".join(reviewtohtml(lang, x) for x in journal_misc + other_misc))) diff --git a/maketex.py b/maketex.py @@ -80,7 +80,7 @@ def venuetotex(venue, url, issue, dropyear=False): return l def publitotex(publi, lang, venuesz, authorsz): - name, typ, url, issue, keywords = getvenue(publi, lang, venuesz, True) + name, typ, url, issue, oa, keywords = getvenue(publi, lang, venuesz, True) authors = ', '.join(authortotex(authorsz[author], withurl=True) for author in publi['authors'].split(' ')) return("\\cvitem{\\bfseries %s}{%s.\\newline\\emph{%s}%s%s}" % (venuetotex(name, url, @@ -90,6 +90,7 @@ def publitotex(publi, lang, venuesz, authorsz): typetobibtype = { 'journal': 'article', + 'newsletter': 'article', 'conference': 'inproceedings', 'patent': 'misc', 'draft': 'unpublished', @@ -104,6 +105,7 @@ typetobibtype = { } typetoobjtype = { 'journal': 'journal', + 'newsletter': 'journal', 'conference': 'booktitle', 'demo': 'booktitle', 'spotlight': 'booktitle', @@ -115,14 +117,15 @@ typetoobjtype = { 'submitted': 'note', } legaltypes = ['phdthesis', 'patent', 'mscthesis', 'journal', 'conference', - 'note', 'demo', 'posterpaper', 'shortpaper', 'spotlight'] -informaltypes = ['phdthesis', 'mscthesis', 'note'] + 'note', 'demo', 'posterpaper', 'shortpaper', 'spotlight', 'book', + 'newsletter'] +informaltypes = ['phdthesis', 'mscthesis', 'note', 'book', 'newsletter'] def publitobib(publi, lang, venuesz, authorsz): global typetobibtype, typetoobjtype, legaltypes, SITEURL, LOCALURL global informaltypes global stz - name, typ2, url, issue, keywords = getvenue(publi, lang, venuesz) + name, typ2, url, issue, oa, keywords = getvenue(publi, lang, venuesz) s = "" typ = publi.get('type', None) if typ == None or len(typ) == 0: diff --git a/parserec.py b/parserec.py @@ -1,5 +1,7 @@ #!/usr/bin/python3 +import sys + stz = { 'submitted': { 'en': "Under review", @@ -25,6 +27,26 @@ stz = { 'en': "longer slides", 'fr': "exposé plus détaillé", }, + 'conference': { + 'en': "conference", + 'fr': "une conférence", + }, + 'workshop': { + 'en': "workshop", + 'fr': "un workshop", + }, + 'journal': { + 'en': "journal", + 'fr': "une revue", + }, + 'published at non oa': { + 'en': "published at a closed-access %s", + 'fr': "publié dans %s non accessible en libre accès", + }, + 'oaexplain': { + 'en': "[why?]", + 'fr': "[explications (en anglais)]", + }, 'poster': { 'en': "poster", 'fr': "poster", @@ -99,6 +121,8 @@ stz = { }, } +talk_types = ['poster', 'short', 'phddefenserehearsal'] + def authorname(author, sepnames=False): if 'name' in author.keys(): return author['name'] @@ -159,18 +183,24 @@ def mkvenuename(venueo, short=False): # return name, type, venue URL, issue: for publi in lang given venuesz def getvenue(publi, lang, venuesz, short=False): global stz + global talk_types if 'venue' not in publi.keys(): if 'status' in publi.keys(): - return (stz[publi['status']][lang], '', '', '', set()) - return ('', '', '', '', set()) # phdthesis or mscthesis + return (stz[publi['status']][lang], '', '', '', '', set()) + return ('', '', '', '', '', set()) # phdthesis or mscthesis venue = publi['venue'] if short and 'venueshort' in publi.keys(): venue = publi['venueshort'] url = None typ = None keywords = set() + oa = None if venue in venuesz.keys(): venueo = venuesz[venue] + if 'oa' not in venueo.keys(): + print("missing OA info for %s" % venue, file=sys.stderr) + assert(False) + oa = venueo['oa'] if 'audience' in venueo.keys(): assert (venueo['audience'] in ['national', 'international']) keywords.add(venueo['audience']) @@ -181,21 +211,25 @@ def getvenue(publi, lang, venuesz, short=False): keywords.add("formal") if 'type' in venueo.keys(): assert (venueo['type'] in ['school', 'conference', 'workshop', - 'journal']) + 'journal', 'book']) if venueo['type'] in ['conference', 'journal']: typ = venueo['type'] - keywords.add('TYPE' + venueo['type']) + # the book I have isn't really a book + keywords.add('TYPE' + (venueo['type'] if venueo['type'] != 'book' + else 'conference')) if 'url' in venueo.keys(): url = venueo['url'] venue = mkvenuename(venueo, short) else: - # the venue is given directly if 'venueurl' in publi.keys(): url = publi['venueurl'] + # the venue is given directly (deprecated, used for talks and some special types) + assert('type' not in publi.keys() or publi['type'] in ['patent', 'mscthesis', 'phdthesis', 'note'] + talk_types) + oa = True lvenue = 'venue' + lang if lvenue in publi.keys(): venue = publi[lvenue] - return (venue, typ, url, publi.get('issue', ''), keywords) + return (venue, typ, url, publi.get('issue', ''), oa, keywords) def parse(fname): with open(fname, 'r') as f: