[PATCH] Theme changes to allow highlight.js to be loaded on 1) main screen and 2) comments for andreas08 and buriy themes

0 views
Skip to first unread message

Steve Garton

unread,
Oct 18, 2009, 12:59:16 PM10/18/09
to byteflow...@googlegroups.com
# HG changeset patch
# User sheepeatingtaz@corellia
# Date 1255772716 -3600
# Node ID 4878e04d2e386498645b804e6e86f2d33691bc53
# Parent 5b03e3df285d63f3f1acb1da4091f637434ceece
Theme changes to allow highlight.js to be loaded on 1) main screen and 2) comments for andreas08 and buriy themes

diff --git a/templates/blog/comment.html b/templates/blog/comment.html
--- a/templates/blog/comment.html
+++ b/templates/blog/comment.html
@@ -1,11 +1,15 @@
{% load i18n %}
+{% load theme %}
+{% theme_css "highlight" %}
+{% theme_js "highlight.pack" %}
+<script type="text/javascript">initHighlightingOnLoad();</script>
<div
style="margin-left:{% widthratio comment.level 30 100 %}%"
class="blogcomment {% cycle odd,even %}{% ifequal object.author comment.user %} creator{% endifequal %}"
id="c{{ comment.id }}">
<span class="comment-time"><a href="#c{{ comment.id }}">{{ comment.pub_date|date }} {{ comment.pub_date|time }}</a></span>
<span class="author">{% link comment.user %}</span>
- <div class="text">{% if settings.GRAVATAR_ENABLE %}<img alt="avatar" src="{{ comment.get_gravatar_url }}" class="avatar" />{% endif %}{{ comment.body_html|safe }}</div>
+ <div class="text">{% if settings.GRAVATAR_ENABLE %}<img alt="avatar" src="{{ comment.get_gravatar_url }}" class="avatar" />{% endif %}{{ comment.body|safe}}</div>

<div class="comment-links">
{% if object.comments_open %}
diff --git a/themes/andreas08/blog/comment.html b/themes/andreas08/blog/comment.html
--- a/themes/andreas08/blog/comment.html
+++ b/themes/andreas08/blog/comment.html
@@ -8,7 +8,7 @@
<span class="comment-time"><a href="#c{{ comment.id }}">{{ comment.pub_date|date }} {{ comment.pub_date|time }}</a></span>
<div class="clear"></div>
</div>
- <div class="text">{% if settings.GRAVATAR_ENABLE %}<img alt="avatar" src="{{ comment.get_gravatar_url }}" class="avatar" />{% endif %}{{ comment.body_html|safe }}</div>
+ <div class="text">{% if settings.GRAVATAR_ENABLE %}<img alt="avatar" src="{{ comment.get_gravatar_url }}" class="avatar" />{% endif %}{{ comment.body|safe }}</div>

<div class="comment-footer">
{% if object.comments_open %}
diff --git a/themes/andreas08/blog/post_entry.html b/themes/andreas08/blog/post_entry.html
--- a/themes/andreas08/blog/post_entry.html
+++ b/themes/andreas08/blog/post_entry.html
@@ -5,6 +5,12 @@
{% load bookmarks %}
{% load tagging_tags %}
{% load bfmarkup %}
+{% load theme %}
+
+{% theme_css "highlight" %}
+{% theme_js "highlight.pack" %}
+<script type="text/javascript">initHighlightingOnLoad();</script>
+
{% endspaceless %}

<div class="entry {% cycle 'odd' 'even' %}" id="post-{{ object.id }}">
diff --git a/themes/andreas08/blog/post_list.html b/themes/andreas08/blog/post_list.html
--- a/themes/andreas08/blog/post_list.html
+++ b/themes/andreas08/blog/post_list.html
@@ -4,6 +4,11 @@
{% load theme %}
{% load tagging_tags %}
{% load bfmarkup %}
+{% load theme %}
+
+{% theme_css "highlight" %}
+{% theme_js "highlight.pack" %}
+<script type="text/javascript">initHighlightingOnLoad();</script>

{% block title %}{% trans "Posts" %}{% endblock %}

diff --git a/themes/buriy/blog/post_list.html b/themes/buriy/blog/post_list.html
--- a/themes/buriy/blog/post_list.html
+++ b/themes/buriy/blog/post_list.html
@@ -5,8 +5,9 @@
{% block title %}{% trans "Posts" %}{% endblock %}

{% block extrahead %}
-<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/highlight.css" />
-<script type="text/javascript" src="{{ STATIC_URL }}js/highlight.js"></script>
+{% load theme %}
+{% theme_css "highlight" %}
+{% theme_js "highlight.pack" %}
<script type="text/javascript">initHighlightingOnLoad();</script>
{% if tag %}
<link rel="alternate" type="application/rss+xml" title="{{ site.name }}: posts with tag '{{ tag }}' feed" href="{% url feed feedurl %}" />

Alexander Solovyov

unread,
Oct 20, 2009, 5:59:40 AM10/20/09
to byteflow...@googlegroups.com
On Sun, Oct 18, 2009 at 7:59 PM, Steve Garton <sheepea...@gmail.com> wrote:
>
> # HG changeset patch
> # User sheepeatingtaz@corellia
> # Date 1255772716 -3600
> # Node ID 4878e04d2e386498645b804e6e86f2d33691bc53
> # Parent  5b03e3df285d63f3f1acb1da4091f637434ceece
> Theme changes to allow highlight.js to be loaded on 1) main screen and 2) comments for andreas08 and buriy themes
>
> diff --git a/templates/blog/comment.html b/templates/blog/comment.html
> --- a/templates/blog/comment.html
> +++ b/templates/blog/comment.html
> @@ -1,11 +1,15 @@
>  {% load i18n %}
> +{% load theme %}
> +{% theme_css "highlight" %}
> +{% theme_js "highlight.pack" %}
> +<script type="text/javascript">initHighlightingOnLoad();</script>

I'm not sure I understand why would you need to do that? It is done
already on this page, right?


> -  <div class="text">{% if settings.GRAVATAR_ENABLE %}<img alt="avatar" src="{{ comment.get_gravatar_url }}" class="avatar" />{% endif %}{{ comment.body_html|safe }}</div>
> +  <div class="text">{% if settings.GRAVATAR_ENABLE %}<img alt="avatar" src="{{ comment.get_gravatar_url }}" class="avatar" />{% endif %}{{ comment.body|safe }}</div>

And this change is rather strange... body_html is a comment body,
already rendered to HTML. Why would you want to output comment source?

--
Alexander

Stephen Garton

unread,
Oct 21, 2009, 2:33:59 AM10/21/09
to byteflow...@googlegroups.com
Alexander,

Comments in line...

2009/10/20 Alexander Solovyov <pir...@piranha.org.ua>:


>
> On Sun, Oct 18, 2009 at 7:59 PM, Steve Garton <sheepea...@gmail.com> wrote:
>>
>> # HG changeset patch
>> # User sheepeatingtaz@corellia
>> # Date 1255772716 -3600
>> # Node ID 4878e04d2e386498645b804e6e86f2d33691bc53
>> # Parent  5b03e3df285d63f3f1acb1da4091f637434ceece
>> Theme changes to allow highlight.js to be loaded on 1) main screen and 2) comments for andreas08 and buriy themes
>>
>> diff --git a/templates/blog/comment.html b/templates/blog/comment.html
>> --- a/templates/blog/comment.html
>> +++ b/templates/blog/comment.html
>> @@ -1,11 +1,15 @@
>>  {% load i18n %}
>> +{% load theme %}
>> +{% theme_css "highlight" %}
>> +{% theme_js "highlight.pack" %}
>> +<script type="text/javascript">initHighlightingOnLoad();</script>
>
> I'm not sure I understand why would you need to do that? It is done
> already on this page, right?
>

It is already loading in post_detail.html, but the comments weren't
rendering with highlights until I added this in here.

>> -  <div class="text">{% if settings.GRAVATAR_ENABLE %}<img alt="avatar" src="{{ comment.get_gravatar_url }}" class="avatar" />{% endif %}{{ comment.body_html|safe }}</div>
>> +  <div class="text">{% if settings.GRAVATAR_ENABLE %}<img alt="avatar" src="{{ comment.get_gravatar_url }}" class="avatar" />{% endif %}{{ comment.body|safe }}</div>
>
> And this change is rather strange... body_html is a comment body,
> already rendered to HTML. Why would you want to output comment source?
>

To be honest, I'm not sure. All I can tell you is that
comment.body_html did not render using highlight.js, whereas
comment.body does.

> --
> Alexander
>

Steve Garton
http://www.sheepeatingtaz.co.uk

Reply all
Reply to author
Forward
0 new messages