aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/templates
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2021-07-27 17:01:29 -0700
committerBryan Newbold <bnewbold@robocracy.org>2021-07-27 17:01:29 -0700
commitcb3d10a06c0166c4eb8ec2d48852e4bfc236ef27 (patch)
treef26df234c0a139f65f560343d14684473ce0d9a9 /python/fatcat_web/templates
parentd5ea71b2892b84040b07107643d939f1cfb74d67 (diff)
downloadfatcat-cb3d10a06c0166c4eb8ec2d48852e4bfc236ef27.tar.gz
fatcat-cb3d10a06c0166c4eb8ec2d48852e4bfc236ef27.zip
refs: support for wikipedia outbound refs, and display in tables
Diffstat (limited to 'python/fatcat_web/templates')
-rw-r--r--python/fatcat_web/templates/refs_macros.html20
-rw-r--r--python/fatcat_web/templates/wikipedia_view_fuzzy_refs.html27
2 files changed, 44 insertions, 3 deletions
diff --git a/python/fatcat_web/templates/refs_macros.html b/python/fatcat_web/templates/refs_macros.html
index 405aca73..ba4d18ad 100644
--- a/python/fatcat_web/templates/refs_macros.html
+++ b/python/fatcat_web/templates/refs_macros.html
@@ -35,12 +35,26 @@
<td class="">
{% if release %}
{{ entity_macros.release_summary(release) }}
- {% elif row.ref.target_unstructured %}
+ {% elif direction == "in" and row.ref.source_wikipedia_article %}
+ {% set wiki_lang = row.ref.source_wikipedia_article.split(':')[0] %}
+ {% set wiki_article = ':'.join(row.ref.source_wikipedia_article.split(':')[1:]) %}
+ <b>
+ <a href="https://{{ wiki_lang }}.wikipedia.org/wiki/{{ wiki_article.replace(' ', '_') }}">
+ {{ wiki_article }}
+ </a>
+ [wikipedia]
+ </b>
+ <br>
+ <span style="color:green;">lang:{{ wiki_lang }}</span>&nbsp;
+ <a href="/wikipedia/{{ wiki_lang }}:{{ wiki_article.replace(' ', '_') }}/refs-out" style="color:green;">[references]</a>&nbsp;
+ {% elif direction == "out" and row.ref.target_unstructured %}
<code>{{ row.ref.target_unstructured }}</code>
{% if row.ref.target_openlibrary_work %}
- <br><a href="https://openlibrary.org/{{ row.ref.target_openlibrary_work }}" style="color:green;">openlibrary:{{ row.ref.target_openlibrary_work }}</a>&nbsp;
+ <br>
+ <a href="https://openlibrary.org/{{ row.ref.target_openlibrary_work }}" style="color:green;">openlibrary:{{ row.ref.target_openlibrary_work }}</a>&nbsp;
+ <a href="/openlibrary/{{ row.ref.target_openlibrary_work}}/refs-in" style="color:green;">[cited-by]</a>&nbsp;
{% endif %}
- {% elif row.ref.target_csl %}
+ {% elif direction == "in" and row.ref.target_csl %}
{{ entity_macros.csl_summary(row.ref.target_csl) }}
{% else %}
<i>blank</i>
diff --git a/python/fatcat_web/templates/wikipedia_view_fuzzy_refs.html b/python/fatcat_web/templates/wikipedia_view_fuzzy_refs.html
new file mode 100644
index 00000000..5b53d692
--- /dev/null
+++ b/python/fatcat_web/templates/wikipedia_view_fuzzy_refs.html
@@ -0,0 +1,27 @@
+{% extends "base.html" %}
+{% import "refs_macros.html" as refs_macros %}
+
+{% block title %}Wikipedia Refs{% endblock %}
+
+{% block fullbody %}
+<h1 class="ui header">
+ [{{ wiki_lang }}] {{ wiki_article }}
+ <span class="sub header"><a href="{{ wiki_url }}"><code>{{ wiki_url }}</code></a></span>
+</h1>
+
+{% if direction == "in" %}
+ <h3>Cited By</h3>
+ <p>This page lists references to a wikipedia article, from other works (eg, journal articles).
+{% elif direction == "out" %}
+ <h3>References</h3>
+ <i>Refernces from wikipedia article to other entities.</i>
+{% endif %}
+
+{% if hits.result_refs %}
+ {{ refs_macros.refs_table(hits, direction) }}
+{% else %}
+ <br><br><p><b>None found</b>
+{% endif %}
+
+{% endblock %}
+