diff --git a/entries/jinja2/entries/h-entry.html b/entries/jinja2/entries/h-entry.html index b9a05f6..0cf7a80 100644 --- a/entries/jinja2/entries/h-entry.html +++ b/entries/jinja2/entries/h-entry.html @@ -10,7 +10,7 @@ {{i}}

{{ entry.name }}

{% endif %} {{i}}
- {{i}}{{ entry.content | markdown }} + {{i}}{{ entry.content | indent(indent_width + 6) }} {{i}}
{{i}} diff --git a/entries/templates/entries/entry.html b/entries/templates/entries/entry.html new file mode 100644 index 0000000..a620f55 --- /dev/null +++ b/entries/templates/entries/entry.html @@ -0,0 +1,17 @@ +{% extends 'lemoncurry/layout.html' %} +{% load absolute_url static %} + +{% block head %} + + +{% endblock %} + +{% block styles %} + +{% endblock %} + +{% block main %} +
+{% include 'entries/h-entry.html' %} +
+{% endblock %} diff --git a/entries/templates/entries/h-entry.html b/entries/templates/entries/h-entry.html new file mode 100644 index 0000000..a3740a9 --- /dev/null +++ b/entries/templates/entries/h-entry.html @@ -0,0 +1,67 @@ +{% load bleach friendly_url humanize jsonify markdown %}
+ {% if entry.photo %}{% endif %} + + {% if entry.in_reply_to %}{% with reply=entry.reply_context %} +
+ + {{ reply.author.name }} + +
+ {% if reply.name %}

{{ reply.name }}

{% endif %} +
{{ reply.content | bleach }}
+
+
{% endwith %}{% endif %} + +
+ {% if entry.name %}

{{ entry.name }}

{% endif %} +
{{ entry.content | markdown }}
+
+ + + + {% if entry.cats.exists %} + + {% endif %} + + {% if entry.syndications.exists %} + + {% endif %} + + +
diff --git a/entries/templates/entries/index.html b/entries/templates/entries/index.html new file mode 100644 index 0000000..d16f517 --- /dev/null +++ b/entries/templates/entries/index.html @@ -0,0 +1,17 @@ +{% extends 'lemoncurry/layout.html' %} +{% load static %} +{% block html_class %}h-feed{% endblock %} + +{% block styles %} + +{% endblock %} + +{% block main %} +
    + {% for entry in entries %} +
  1. + {% include 'entries/h-entry.html' %} +
  2. + {% endfor %} +
+{% endblock %} diff --git a/home/jinja2/home/index.html b/home/jinja2/home/index.html deleted file mode 100644 index ff6d51a..0000000 --- a/home/jinja2/home/index.html +++ /dev/null @@ -1,102 +0,0 @@ -{% extends 'lemoncurry/layout.html' %} - -{% block html_attr %} - class="h-feed"{{ super() }} -{%- endblock %} - -{% block styles %} - - -{% endblock %} - -{% block head %} - {% for key in user.keys.all() %} - - {% endfor %} -{% endblock %} - -{% block main %} - - - {% import 'entries/h-entry.html' as h %} -
    - {% for entry in entries %} -
  1. - {{ h.hEntry(entry, indent_width=10) }} -
  2. - {% endfor %} -
-{% endblock %} - -{% block foot %} - -{% endblock %} diff --git a/home/templates/home/index.html b/home/templates/home/index.html new file mode 100644 index 0000000..d5b76f5 --- /dev/null +++ b/home/templates/home/index.html @@ -0,0 +1,70 @@ +{% extends 'lemoncurry/layout.html' %} +{% load jsonify markdown static %} +{% block html_class %}h-feed{% endblock %} +{% block styles %} + + +{% endblock %} + +{% block head %}{% for key in user.keys.all %}{% endfor %}{% endblock %} + +{% block main %} + +
    + {% for entry in entries %} +
  1. + {% include 'entries/h-entry.html' %} +
  2. + {% endfor %} +
+{% endblock %} +{% block foot %} + +{% endblock %} diff --git a/lemoncurry/jinja2/__init__.py b/lemoncurry/jinja2.py similarity index 88% rename from lemoncurry/jinja2/__init__.py rename to lemoncurry/jinja2.py index 681f1d0..57fcfdf 100644 --- a/lemoncurry/jinja2/__init__.py +++ b/lemoncurry/jinja2.py @@ -7,8 +7,7 @@ from compressor.contrib.jinja2ext import CompressorExtension from django_activeurl.ext.django_jinja import ActiveUrl from entries.kinds import all as entry_kinds -from .markdown import markdown -from ..utils import friendly_url, load_package_json +from .utils import friendly_url, load_package_json def environment(**options): @@ -20,7 +19,6 @@ def environment(**options): ) env.filters.update({ 'friendly_url': friendly_url, - 'markdown': markdown, 'naturaltime': naturaltime, }) env.globals.update({ diff --git a/lemoncurry/jinja2/bleach.py b/lemoncurry/jinja2/bleach.py deleted file mode 100644 index de09c04..0000000 --- a/lemoncurry/jinja2/bleach.py +++ /dev/null @@ -1,21 +0,0 @@ -from bleach.sanitizer import Cleaner, ALLOWED_TAGS -from bleach.linkifier import LinkifyFilter -from jinja2 import evalcontextfilter, Markup - -TAGS = ['cite', 'code', 'p', 'pre', 'img', 'span'] -TAGS.extend(ALLOWED_TAGS) -ATTRIBUTES = { - 'a': ('href', 'title', 'class'), - 'img': ('alt', 'src', 'title'), - 'span': ('class',), -} - -cleaner = Cleaner(tags=TAGS, attributes=ATTRIBUTES, filters=(LinkifyFilter,)) - - -@evalcontextfilter -def bleach(ctx, html): - res = cleaner.clean(html) - if ctx.autoescape: - res = Markup(res) - return res diff --git a/lemoncurry/jinja2/lemoncurry/layout.html b/lemoncurry/jinja2/lemoncurry/layout.html index 783879f..1564b14 100644 --- a/lemoncurry/jinja2/lemoncurry/layout.html +++ b/lemoncurry/jinja2/lemoncurry/layout.html @@ -81,41 +81,6 @@ diff --git a/lemoncurry/jinja2/markdown.py b/lemoncurry/jinja2/markdown.py deleted file mode 100644 index 951b3b8..0000000 --- a/lemoncurry/jinja2/markdown.py +++ /dev/null @@ -1,16 +0,0 @@ -from jinja2 import evalcontextfilter -from markdown import Markdown - -from .bleach import bleach - -md = Markdown(extensions=( - 'markdown.extensions.extra', - 'markdown.extensions.headerid', - 'markdown.extensions.sane_lists', - 'markdown.extensions.smarty', -)) - - -@evalcontextfilter -def markdown(ctx, source): - return bleach(ctx, md.reset().convert(source)) diff --git a/lemoncurry/templates/lemoncurry/layout.html b/lemoncurry/templates/lemoncurry/layout.html new file mode 100644 index 0000000..1b31cf3 --- /dev/null +++ b/lemoncurry/templates/lemoncurry/layout.html @@ -0,0 +1,134 @@ +{% load analytical compress favicon lemoncurry_tags meta static theme_colour %} + + {% site_name as site_name %}{% request_uri request as uri %}{% request_origin request as origin %} + + + + + + {% if title %}{{ title }} ~ {% endif %}{{ site_name }} + + {% analytical_head_top %} + {% if atom %}{% endif %} + {% if rss %} {% endif %} + {% block head %}{% endblock %} + + + + + + + + + + + + + {% get_package_json as package %} + + + + + {% include 'meta/meta.html' %} + {% get_favicons 'favicon/' %} + + + + + + {% compress css %} + + {% block styles %}{% endblock %} + {% endcompress %} + + {% analytical_head_bottom %} + + + {% analytical_body_top %} +
+ + {% if request.resolver_match.view_name %} + {% nav_crumbs request.resolver_match %} + {% endif %} +
+ +
+ {% block main %}{% endblock %} +
+ + + + + + + + + + {% compress js %} + + {% block foot %}{% endblock %} + {% endcompress %} + {% analytical_body_bottom %} + + diff --git a/lemoncurry/templates/lemoncurry/tags/breadcrumbs.html b/lemoncurry/templates/lemoncurry/tags/breadcrumbs.html new file mode 100644 index 0000000..0b1ddb0 --- /dev/null +++ b/lemoncurry/templates/lemoncurry/tags/breadcrumbs.html @@ -0,0 +1,11 @@ +{% load jsonify %}{% if crumbs %} + +{% endif %} diff --git a/lemoncurry/templates/lemoncurry/tags/nav.html b/lemoncurry/templates/lemoncurry/tags/nav.html new file mode 100644 index 0000000..8359cdc --- /dev/null +++ b/lemoncurry/templates/lemoncurry/tags/nav.html @@ -0,0 +1,8 @@ +{% load activeurl %}{% activeurl %}{% endactiveurl %}