aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-03-07 11:09:02 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-03-07 11:09:02 -0800
commitb7c189d3d6912c91874de54d44f6346adc635060 (patch)
tree737614edaa46fc3de52cabc9c9d419db5f453703 /python
parent49ac34c2b23ce586c19630999af9f72a976aa7df (diff)
downloadfatcat-b7c189d3d6912c91874de54d44f6346adc635060.tar.gz
fatcat-b7c189d3d6912c91874de54d44f6346adc635060.zip
clean up HTML whitespace
Diffstat (limited to 'python')
-rw-r--r--python/fatcat_web/__init__.py4
-rw-r--r--python/fatcat_web/templates/base.html24
-rw-r--r--python/fatcat_web/templates/release_view.html4
3 files changed, 25 insertions, 7 deletions
diff --git a/python/fatcat_web/__init__.py b/python/fatcat_web/__init__.py
index 1ad278ba..e80393c2 100644
--- a/python/fatcat_web/__init__.py
+++ b/python/fatcat_web/__init__.py
@@ -28,6 +28,10 @@ conf = fatcat_client.Configuration()
conf.host = Config.FATCAT_API_HOST
api = fatcat_client.DefaultApi(fatcat_client.ApiClient(conf))
+# remove most jinja2 template whitespace
+app.jinja_env.trim_blocks = True
+app.jinja_env.lstrip_blocks = True
+
def auth_api(token):
conf = fatcat_client.Configuration()
conf.api_key["Authorization"] = token
diff --git a/python/fatcat_web/templates/base.html b/python/fatcat_web/templates/base.html
index 2a5e0dd6..d3353ca4 100644
--- a/python/fatcat_web/templates/base.html
+++ b/python/fatcat_web/templates/base.html
@@ -4,13 +4,21 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width">
- {# sorry this line is so long; don't want any whitespace #}
- <title>{% block title %}{% if config.FATCAT_DOMAIN.startswith('qa.') %}[QA] {% elif config.FATCAT_DOMAIN.startswith('dev.') %}[DEV] {% endif %}fatcat!{% endblock %}</title>
+ <title>{%- block title -%}
+ {%- if config.FATCAT_DOMAIN.startswith('qa.') -%}
+ {{- "[QA] " -}}
+ {%- elif config.FATCAT_DOMAIN.startswith('dev.') -%}
+ {{- "[DEV] " -}}
+ {%- endif -%}
+ fatcat!
+ {%- endblock -%}</title>
<meta name="referrer" content="origin-when-cross-origin">
<meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.3.2/dist/semantic.min.css">
+ <link rel="stylesheet"
+ href="https://cdn.jsdelivr.net/npm/semantic-ui@2.3.2/dist/semantic.min.css"
+ crossorigin="anonymous">
<style>
- /* bnewbold: fix light grey bars in header */
+ {# bnewbold: fix light grey bars in header #}
.ui.inverted.menu .item:before { background: none; }
</style>
{% block extra_head %}{% endblock %}
@@ -112,8 +120,12 @@
<script
src="https://code.jquery.com/jquery-3.1.1.min.js"
integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
- crossorigin="anonymous"></script>
-<script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.3.2/dist/semantic.min.js"></script>
+ crossorigin="anonymous">
+</script>
+<script
+ src="https://cdn.jsdelivr.net/npm/semantic-ui@2.3.2/dist/semantic.min.js"
+ crossorigin="anonymous">
+</script>
{% block postscript %}{% endblock %}
</body>
diff --git a/python/fatcat_web/templates/release_view.html b/python/fatcat_web/templates/release_view.html
index 14e50953..14ff4b44 100644
--- a/python/fatcat_web/templates/release_view.html
+++ b/python/fatcat_web/templates/release_view.html
@@ -36,7 +36,9 @@
<meta name="citation_journal_title" content="{{ release.container.name }}">
<meta name="DC.publisher" content="{{ release.container.publisher }}">
<meta name="citation_publisher" content="{{ release.container.publisher }}">
- {% if release.container.issnl %}<meta name="citation_issn" content="{{ release.container.issnl }}">{% endif %}
+ {% if release.container.issnl %}
+ <meta name="citation_issn" content="{{ release.container.issnl }}">
+ {% endif %}
{% elif release.publisher %}
<meta name="DC.publisher" content="{{ release.publisher }}">
<meta name="citation_publisher" content="{{ release.publisher }}">