Initial commit

This commit is contained in:
Edward Betts 2023-10-04 12:56:21 +01:00
commit f07b407e7a
25 changed files with 2383 additions and 0 deletions

10
templates/all_done.html Normal file
View file

@ -0,0 +1,10 @@
{% extends "base.html" %}
{% block title %}Index{% endblock %}
{% block content %}
<div class="container">
<h1>All done</h1>
<div><a href="{{ url_for('index') }}">back to index </a></div>
</div>
{% endblock %}

56
templates/article.html Normal file
View file

@ -0,0 +1,56 @@
{% extends "base.html" %}
{% block title %}{{ title }}{% endblock %}
{% block style %}
<style>
span.exact { padding: 2px; background: green; color: white; font-weight: bold; }
span.nomatch { padding: 2px; background: red; color: white; font-weight: bold; }
span.case_mismatch { padding: 2px; background: orange; color: white; font-weight: bold; }
span.searchmatch { font-weight: bold; }
table.diff,td.diff-otitle,td.diff-ntitle{background-color:white}
td.diff-otitle,td.diff-ntitle{text-align:center}
td.diff-marker{text-align:right;font-weight:bold;font-size:1.25em}
td.diff-lineno{font-weight:bold}
td.diff-addedline,td.diff-deletedline,td.diff-context{font-size:88%;vertical-align:top;white-space:-moz-pre-wrap;white-space:pre-wrap}
td.diff-addedline,td.diff-deletedline{border-style:solid;border-width:1px 1px 1px 4px;border-radius:0.33em}
td.diff-addedline{border-color:#a3d3ff}
td.diff-deletedline{border-color:#ffe49c}
td.diff-context{background:#f3f3f3;color:#333333;border-style:solid;border-width:1px 1px 1px 4px;border-color:#e6e6e6;border-radius:0.33em}
.diffchange{font-weight:bold;text-decoration:none}
table.diff{border:none;width:98%;border-spacing:4px; table-layout:fixed}
td.diff-addedline .diffchange,td.diff-deletedline .diffchange{border-radius:0.33em;padding:0.25em 0}
td.diff-addedline .diffchange{background:#d8ecff}
td.diff-deletedline .diffchange{background:#feeec8}
table.diff td{padding:0.33em 0.66em}
table.diff col.diff-marker{width:2%}
table.diff col.diff-content{width:48%}
table.diff td div{ word-wrap:break-word; overflow:auto}
</style>
{% endblock %}
{% block content %}
<div class="container">
<h1>{{ self.title() }}</h1>
<form>
<input name="q">
<input type="submit" value="search">
</form>
<div id="app"></div>
</div>
<script type="module">
import main from {{ url_for('static', filename='add_links.es.js') | tojson }};
const props = {
title: {{ title | tojson }},
api_base_url: "/api/1"
}
main(props);
</script>
{% endblock %}

66
templates/article2.html Normal file
View file

@ -0,0 +1,66 @@
{% extends "base.html" %}
{% block title %}{{ title }}{% endblock %}
{% block style %}
<style>
span.exact { padding: 2px; background: green; color: white; font-weight: bold; }
span.nomatch { padding: 2px; background: red; color: white; font-weight: bold; }
span.case_mismatch { padding: 2px; background: orange; color: white; font-weight: bold; }
span.searchmatch { font-weight: bold; }
table.diff,td.diff-otitle,td.diff-ntitle{background-color:white}
td.diff-otitle,td.diff-ntitle{text-align:center}
td.diff-marker{text-align:right;font-weight:bold;font-size:1.25em}
td.diff-lineno{font-weight:bold}
td.diff-addedline,td.diff-deletedline,td.diff-context{font-size:88%;vertical-align:top;white-space:-moz-pre-wrap;white-space:pre-wrap}
td.diff-addedline,td.diff-deletedline{border-style:solid;border-width:1px 1px 1px 4px;border-radius:0.33em}
td.diff-addedline{border-color:#a3d3ff}
td.diff-deletedline{border-color:#ffe49c}
td.diff-context{background:#f3f3f3;color:#333333;border-style:solid;border-width:1px 1px 1px 4px;border-color:#e6e6e6;border-radius:0.33em}
.diffchange{font-weight:bold;text-decoration:none}
table.diff{border:none;width:98%;border-spacing:4px; table-layout:fixed}
td.diff-addedline .diffchange,td.diff-deletedline .diffchange{border-radius:0.33em;padding:0.25em 0}
td.diff-addedline .diffchange{background:#d8ecff}
td.diff-deletedline .diffchange{background:#feeec8}
table.diff td{padding:0.33em 0.66em}
table.diff col.diff-marker{width:2%}
table.diff col.diff-content{width:48%}
table.diff td div{ word-wrap:break-word; overflow:auto}
</style>
{% endblock %}
{% block content %}
<div class="container">
<h1>{{ self.title() }}</h1>
<form action="{{ url_for("index") }}">
<input name="q">
<input type="submit" value="search">
</form>
<div>Username: {{ g.user }}</div>
<div><a href="https://en.wikipedia.org/wiki/{{ title }}" target="_blank">view article</a></div>
<div><a href="{{ url_for('index') }}">back to index </a></div>
<div>total: {{ total }}</div>
<div>with link: {{ with_link }}</div>
<div>ratio: {{ "{:.1%}".format(with_link / total) }}</div>
<div>hit: {{ hit }}</div>
<div>replacement: {{ found.replacement }}</div>
<div>section: {{ found.section }}</div>
<table>
{{ diff | safe }}
</table>
<form method="POST">
<input type="hidden" name="hit" value="{{ hit.title }}">
<div class="my-3">
<input type="submit" class="btn btn-primary" value="save"/>
<a href="{{url_for("article_page", url_title=url_title, after=hit["title"])}}" class="btn btn-primary">skip</a>
</div>
</form>
</div>
{% endblock %}

22
templates/base.html Normal file
View file

@ -0,0 +1,22 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link href="{{ url_for("static", filename="bootstrap/css/bootstrap.min.css") }}" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>
{% block title %}{% endblock %}
</title>
{% block style %}{% endblock %}
</head>
<body>
{% block content %}{% endblock %}
<script src="{{ url_for("static", filename="bootstrap/js/bootstrap.bundle.min.js")}}></script>
{% block script %}{% endblock %}
</body>
</html>

25
templates/index.html Normal file
View file

@ -0,0 +1,25 @@
{% extends "base.html" %}
{% block title %}Index{% endblock %}
{% block content %}
<div class="container">
<h1>Index</h1>
<form>
<input name="q">
<input type="submit" value="search">
</form>
<div>Username: {{ g.user }}</div>
<table class="table w-auto">
{% for item in examples %}
<tr>
<td><a href="{{ article_url(item.title) }}">{{ item.title }}</a></td>
<td>{{ item.total }}</td>
<td>{{ "{:.1%}".format(item.with_links / item.total) }}</td>
</tr>
{% endfor %}
</table>
</div>
{% endblock %}

10
templates/save_done.html Normal file
View file

@ -0,0 +1,10 @@
{% extends "base.html" %}
{% block title %}Index{% endblock %}
{% block content %}
<div class="container">
<h1>Save done</h1>
<div>Save is complete.</div>
</div>
{% endblock %}