Skip to content

Commit

Permalink
Copy editing and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
carlinmack committed Sep 24, 2023
1 parent a7402f4 commit 848ab06
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
14 changes: 7 additions & 7 deletions scholia/app/templates/id-to-quickstatements.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ <h2>Input</h2>

<form action="" id="form" method="GET" class="form-horizontal mb-3">
<div class="input-group">
{% if arxiv %}
<input type="text" class="form-control" placeholder="Enter arXiv ID or list of IDs" value="{{ arxiv }}" id="searchterm" name="arxiv"/>
{% if query %}
<input type="text" class="form-control" placeholder="Enter a single or list of arXiv IDs or DOIs" value="{{ query }}" id="searchterm" name="query"/>
{% else %}
<input type="text" class="form-control" placeholder="Enter arXiv ID or list of IDs" id="searchterm" name="arxiv"/>
<input type="text" class="form-control" placeholder="Enter a single or list of arXiv IDs or DOIs" id="searchterm" name="query"/>
{% endif %}
<span class="input-group-append">
<button class="btn btn-primary" type="submit">
Expand All @@ -22,10 +22,10 @@ <h2>Input</h2>
</span>
</div>
</form>

<p>Enter a single or list of <a href="https://arxiv.org">arXiv</a> identifiers to retrieve their Wikidata items or QuickStatements to create items for them.</p>

<p>Bare IDs (such as "1703.06103") or URLs (such as "https://arxiv.org/abs/1703.06103") can be used and the list can be
<p>Enter a single or list of <a href="https://arxiv.org">arXiv</a> identifiers or <a href="https://doi.org">DOIs</a> to retrieve their Wikidata items or QuickStatements to create items for them.</p>

<p>Bare IDs (such as "1703.06103" or "10.1371/JOURNAL.PONE.0029797") or URLs (such as "https://arxiv.org/abs/1703.06103" or "https://doi.org/10.1371/JOURNAL.PONE.0029797") can be used and the list can be
comma, space, pipe or tab separated. Note that new items may not be immediately found because of caching.</p>

{% if error %}
Expand Down Expand Up @@ -66,7 +66,7 @@ <h2>Not found</h2>
<a href="https://quickstatements.toolforge.org/#/v1={{ quickstatements[0] | replace('\t', '|') | replace('\n', '||') | urlencode | replace('/','%2F') }}">
<button class="btn btn-primary">Submit to Quickstatements ↗</button>
</a>

{% endif %}

{% if (quickstatements|length) > 1 %}
Expand Down
16 changes: 8 additions & 8 deletions scholia/app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def show_id_to_quickstatements():
show_arxiv.
"""
query = request.args.get('arxiv')
query = request.args.get('query')

if not query:
return render_template('id-to-quickstatements.html')
Expand Down Expand Up @@ -302,7 +302,7 @@ def show_id_to_quickstatements():

if len(matched) > 0 and len(unmatched) == 0:
# The identifiers are already in Wikidata
return render_template('id-to-quickstatements.html', arxiv=query, qs=matched)
return render_template('id-to-quickstatements.html', query=query, qs=matched)

get_metadata_mapping = {
'arxiv': get_arxiv_metadata,
Expand All @@ -316,9 +316,9 @@ def show_id_to_quickstatements():
metadata = fun(identifier)
except Exception:
if len(matched) > 0:
return render_template('id-to-quickstatements.html', arxiv=query, qs=matched, error=True)
return render_template('id-to-quickstatements.html', arxiv=query, error=True)
return render_template('id-to-quickstatements.html', query=query, qs=matched, error=True)
return render_template('id-to-quickstatements.html', query=query, error=True)

ids[identifier]["metadata"] = metadata
ids[identifier]['quickstatements'] = metadata_to_quickstatements(metadata)

Expand All @@ -334,14 +334,14 @@ def show_id_to_quickstatements():
# Here, we let jinja2 handle the encoding rather than adding an extra

if len(matched) > 0:
return render_template('id-to-quickstatements.html', arxiv=query,
return render_template('id-to-quickstatements.html', query=query,
qs=matched, quickstatements=quickstatements)
if len(matched) == 0 and len(quickstatements) == 0:
return render_template('id-to-quickstatements.html', arxiv=query,
return render_template('id-to-quickstatements.html', query=query,
qs=matched, quickstatements=quickstatements,
error=True)
return render_template('id-to-quickstatements.html',
arxiv=query, quickstatements=quickstatements)
query=query, quickstatements=quickstatements)


@main.route('/author/' + q_pattern)
Expand Down
2 changes: 1 addition & 1 deletion scholia/doi.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def getDate(input):
entry = response.json()["message"]

plain_date, date = getDate(entry["issued"]["date-parts"][0])

metadata = {
"doi": entry.get("DOI"),
"authornames": [
Expand Down
2 changes: 1 addition & 1 deletion scholia/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def metadata_to_quickstatements(metadata):

def clean(string):
return string.replace('"', '\"')

def getNiceDate(input):
date = list(map(int, input.split("-")))
if len(date) == 1:
Expand Down

0 comments on commit 848ab06

Please sign in to comment.