1616SITE_SECOND_TITLE = " Publications"
1717
1818
19+ ############################################################
20+ # Sort an input list of papers by the sort parameter
21+ ############################################################
22+ def sort_hashes_by (papers , hashes , sort_by ):
23+ temp_papers = {}
24+ for this_paper in papers :
25+ if this_paper ['IDs' ]['hash' ] in hashes :
26+ if sort_by == 'year' :
27+ temp_papers [this_paper ['IDs' ]['hash' ]] = (this_paper ['clean' ]['clean_date' ]['year' ])
28+ sorted_hashes = [k for k , v in sorted (temp_papers .items (), key = lambda item : item [1 ], reverse = True )]
29+ return sorted_hashes
30+
1931############################################################
2032# Build common head for all pages
2133############################################################
@@ -295,7 +307,11 @@ def draw_paper(this_paper, nav_path="./"):
295307 html += escape ('; ' .join (authors ))
296308 html += '<br/>'
297309
298- html += this_paper ['clean' ]['journal' ]['journal_name' ]
310+ try :
311+ if this_paper ['clean' ]['journal' ]['journal_name' ] != "" :
312+ html += this_paper ['clean' ]['journal' ]['journal_name' ]
313+ except :
314+ pass
299315
300316 try :
301317 if this_paper ['clean' ]['journal' ]['volume' ] != "" :
@@ -308,6 +324,12 @@ def draw_paper(this_paper, nav_path="./"):
308324 html += ', Issue ' + this_paper ['clean' ]['journal' ]['issue' ]
309325 except :
310326 pass
327+
328+ try :
329+ if this_paper ['clean' ]['clean_date' ]['year' ] != "" :
330+ html += " (" + str (this_paper ['clean' ]['clean_date' ]['year' ]) + ")"
331+ except :
332+ pass
311333
312334 html += '<br/>'
313335
@@ -348,8 +370,10 @@ def draw_paper(this_paper, nav_path="./"):
348370 try :
349371 if len (this_paper ['clean' ]['zotero_tags' ]) > 0 :
350372 html += '<br/>Tags: '
373+ html_tags = []
351374 for this_tag in this_paper ['clean' ]['zotero_tags' ]:
352- html += '<a href="' + nav_path + 'tags/' + this_tag ['tag' ] + '/index.html">' + this_tag ['tag' ] + '</a> '
375+ html_tags .append ('<a href="' + nav_path + 'tags/' + this_tag ['tag' ] + '/index.html">' + this_tag ['tag' ] + '</a>' )
376+ html += ' | ' .join (html_tags )
353377 except :
354378 pass
355379
@@ -744,9 +768,9 @@ def build_zotero_tags(papers):
744768
745769 zotero_tags = {}
746770 zotero_tags_counts = {}
747- html_file = open (config .html_dir + '/tags/index.html' , 'w' )
771+ html_file = open (config .html_dir + '/tags/index.html' , 'w' , encoding = 'utf-8' )
748772
749- # Build a dict of ALL zotero tags with a list of each hash (paper) that has this tag, also count the citations while we are here .
773+ # Build a dict of ALL zotero tags with a list of each hash (paper) that has this tag.
750774 for this_paper in papers :
751775 try :
752776 # Look at all the zotero tags for this paper
@@ -873,8 +897,10 @@ def build_zotero_tags(papers):
873897
874898 fo .write (html )
875899
900+
876901 # Build the text needed for each paper
877- for this_paper in zotero_tags [this_tag ]:
902+ #for this_paper in zotero_tags[this_tag]:
903+ for this_paper in sort_hashes_by (papers , zotero_tags [this_tag ], 'year' ):
878904
879905 try :
880906 # Get paper object
0 commit comments