From dae96f7c1f256e44b17aded2cfb153b2e76aac9b Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Mon, 17 Apr 2023 21:18:52 +0200 Subject: [PATCH] Add abstract of papers to the publications' webpage --- query.py | 4 +++- templates/pubs.html | 15 +++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/query.py b/query.py index 94085f3..8e7ea86 100644 --- a/query.py +++ b/query.py @@ -4,13 +4,15 @@ import sys # Query papers citing the two SWIFT ADS entries query = ADSQueryWrapper(sys.argv[1]) -query_data = query.get("citations(2016pasc.conf....2S) or citations(2018ascl.soft05020S)", fl="title,bibcode,first_author_norm,date,year,doi,author_count,pub_raw,bibstem", rows=1000) +query_data = query.get("citations(2016pasc.conf....2S) or citations(2018ascl.soft05020S)", fl="title,bibcode,first_author_norm,date,year,author_count,bibstem,abstract", rows=1000) paper_list = query_data.papers # Process the data to make the title a string and not an array of strings for paper in paper_list: paper.title = paper.title[0] paper.bibstem = paper.bibstem[0] + if hasattr(paper, "abstract"): + paper.abstract = paper.abstract.replace("<P />", "") # Create a dictionary of cards my_list = dict({"num_papers": query_data.num_found, diff --git a/templates/pubs.html b/templates/pubs.html index 5f517dc..2a2972e 100644 --- a/templates/pubs.html +++ b/templates/pubs.html @@ -14,18 +14,25 @@ <h2>Publications using SWIFT</h2> </div> - <div> The following {{ num_papers }} have made use of SWIFT for their results:</div> + <div> The following {{ num_papers }} publications have made use of SWIFT obtain their results:</div> {% set count = num_papers %} {% for card in cards|sort_cards %} <div class="card-text"> <h4>{{ count + 1 - loop.index }}) <a href="https://ui.adsabs.harvard.edu/abs/{{ card.bibcode }}/abstract">{{ card.title }}</h4></a> + <p> {% if card.author_count > 1 %} - <p>{{ card.first_author_norm }} et al., {{ card.bibstem }}, {{ card.year }}</p> + {{ card.first_author_norm }} et al., {% else %} - <p>{{ card.first_author_norm }}, {{ card.bibstem }}, {{ card.year }}</p> - {% endif %} + {{ card.first_author_norm }}, + {% endif %} + <i>{{ card.bibstem }}</i>, {{ card.year }} + {% if card.abstract %} + <p class="hideshow">Abstract <i class="fa fa-chevron-right" aria-hidden="true"></i></p> + <p class="abstract card">{{ card.abstract }}</p> + {% endif %} + </p> </div> {% endfor %} </div> -- GitLab