09b70d37fb65

Added the Typogrify template tag and started using it everywhere!
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sat, 24 Jan 2009 00:51:16 -0500
parents 4ee184bf2f39
children 26653a0d8d78
branches/tags (none)
files blog/views.py projects/views.py settings.py site-media/style/stevelosh.css templates/blog/entry.html templates/blog/list.html templates/flatpages/default.html templates/flatpages/splash.html templates/projects/list.html templates/projects/project.html templates/thoughts/list.html

Changes

--- a/blog/views.py	Fri Jan 23 23:56:12 2009 -0500
+++ b/blog/views.py	Sat Jan 24 00:51:16 2009 -0500
@@ -49,7 +49,7 @@
         akismet_data['user_agent'] = request.META['HTTP_USER_AGENT']
         akismet_data['comment_author'] = fields['name']
         akismet_data['comment_type'] ='comment'
-        spam = ak.comment_check(fields['body'], akismet_data)
+        spam = ak.comment_check(fields['body'].encode('ascii', 'ignore'), akismet_data)
         
         new_comment = Comment(name=fields['name'], 
                               body=fields['body'], 
--- a/projects/views.py	Fri Jan 23 23:56:12 2009 -0500
+++ b/projects/views.py	Sat Jan 24 00:51:16 2009 -0500
@@ -37,7 +37,7 @@
         akismet_data['user_agent'] = request.META['HTTP_USER_AGENT']
         akismet_data['comment_author'] = fields['name']
         akismet_data['comment_type'] ='comment'
-        spam = ak.comment_check(fields['body'], akismet_data)
+        spam = ak.comment_check(fields['body'].encode('ascii', 'ignore'), akismet_data)
         
         new_comment = Comment(name=fields['name'], 
                               body=fields['body'], 
--- a/settings.py	Fri Jan 23 23:56:12 2009 -0500
+++ b/settings.py	Sat Jan 24 00:51:16 2009 -0500
@@ -91,4 +91,5 @@
     'stevelosh.projects',
     'stevelosh.thoughts',
     'mobileadmin',
+    'typogrify',
 )
--- a/site-media/style/stevelosh.css	Fri Jan 23 23:56:12 2009 -0500
+++ b/site-media/style/stevelosh.css	Sat Jan 24 00:51:16 2009 -0500
@@ -106,3 +106,17 @@
 .invalid {
     color: #F00;
 }
+
+/* Typogrify Styles */
+
+.amp { 
+	color: #444; 
+	font-size: 1.05em; 
+    font-family: "Warnock Pro", "Palatino", "Book Antiqua", serif; 
+    font-style: italic;
+}
+
+a:hover .amp { color: inherit; }
+.caps { font-size: 0.92em; }
+.quo { margin-left: -0.30em; }
+.dquo { margin-left: -0.38em; }
--- a/templates/blog/entry.html	Fri Jan 23 23:56:12 2009 -0500
+++ b/templates/blog/entry.html	Sat Jan 24 00:51:16 2009 -0500
@@ -1,87 +1,88 @@
 {% extends "blog/base.html" %}
 {% load markup %}
+{% load typogrify %}
 
 {% block title %}{{ entry.title }}{% endblock %}
 
 {% block script %}
-	<script type="text/javascript"
-	        src="/site-media/scripts/jquery.validate.min.js">
-	</script>
-	<script type="text/javascript"
-	        src="/site-media/scripts/validate-comment-form.js">
-	</script>
+    <script type="text/javascript"
+            src="/site-media/scripts/jquery.validate.min.js">
+    </script>
+    <script type="text/javascript"
+            src="/site-media/scripts/validate-comment-form.js">
+    </script>
 {% endblock %}
 
 {% block content %}
-	<div id="blog-entry">
-		<h1 id="blog-entry-title">
-			<a href="{% url stevelosh.blog.views.entry entry.pub_date.year, entry.pub_date.month, entry.pub_date.day, entry.slug %}">
-				{{ entry.title }}
-			</a>
-		</h1>
-		<div id="blog-entry-date">
-			<p>
-				Posted
-				on {{ entry.pub_date.date|date:"F j, Y" }}
-				at {{ entry.pub_date.time|time:"g:i A" }}
-			</p>
-		</div>
-		<div id="blog-entry-body" class="content">
-			{{ entry.body|markdown:"codehilite" }}
-		</div>
-	</div>
-	<hr />
-	{% ifnotequal comments.count 0 %}
-		<div id="blog-entry-comments">
-			<h1>Comments</h1>
-			{% for comment in comments %}
-				<div class="blog-entry-comment">
-					<a name="comment-{{ comment.id }}"></a>
-					<h2>{{ comment.name }} said:</h2>
-					<div class="blog-entry-comment-body">
-						{{ comment.body|markdown:"safe" }}
-					</div>
-				</div>
-			{% endfor %}
-		</div>
-		<hr />
-	{% endifnotequal %}
-	<div id="blog-entry-new-comment">
-		<h1>Add your comment:</h1>
-		<form id="new-comment-form" method="post" 
-			  action="{% url stevelosh.blog.views.comment %}">
-			<p class="form-label">
-				What's your name?
-			</p>
-			<p id="blog-new-comment-name-area">
-				<input type="hidden" name="entry-id" 
-					   value="{{ entry.id }}" />
-				<input id="blog-new-comment-name" name="name" 
-					   maxlength="40" type="text" />
-			</p>
-			<p id="blog-new-comment-body-area">
-				<textarea id="blog-new-comment-body" rows="" cols=""
-			 		  	  name="body"></textarea>
-			</p>
-			<p id="blog-new-comment-instructions">
-				You can use <a href="http://daringfireball.net/projects/markdown/syntax">Markdown</a>.
-			</p>
-			<h2>You're going to say:</h2>
-			<div class="wmd-preview"></div>
-			<p>
-				<input id="blog-new-comment-submit" name="submit"
-				 	   type="submit" value="Comment" />
-			</p>
-		</form>
-	</div>
-	
-	<script type="text/javascript">
+    <div id="blog-entry">
+        <h1 id="blog-entry-title">
+            <a href="{% url stevelosh.blog.views.entry entry.pub_date.year, entry.pub_date.month, entry.pub_date.day, entry.slug %}">
+                {{ entry.title|typogrify }}
+            </a>
+        </h1>
+        <div id="blog-entry-date">
+            <p>
+                Posted
+                on {{ entry.pub_date.date|date:"F j, Y" }}
+                at {{ entry.pub_date.time|time:"g:i A" }}
+            </p>
+        </div>
+        <div id="blog-entry-body" class="content">
+            {{ entry.body|markdown:"codehilite"|typogrify }}
+        </div>
+    </div>
+    <hr />
+    {% ifnotequal comments.count 0 %}
+        <div id="blog-entry-comments">
+            <h1>Comments</h1>
+            {% for comment in comments %}
+                <div class="blog-entry-comment">
+                    <a name="comment-{{ comment.id }}"></a>
+                    <h2>{{ comment.name }} said:</h2>
+                    <div class="blog-entry-comment-body">
+                        {{ comment.body|markdown:"safe"|typogrify }}
+                    </div>
+                </div>
+            {% endfor %}
+        </div>
+        <hr />
+    {% endifnotequal %}
+    <div id="blog-entry-new-comment">
+        <h1>Add your comment:</h1>
+        <form id="new-comment-form" method="post" 
+              action="{% url stevelosh.blog.views.comment %}">
+            <p class="form-label">
+                What's your name?
+            </p>
+            <p id="blog-new-comment-name-area">
+                <input type="hidden" name="entry-id" 
+                       value="{{ entry.id }}" />
+                <input id="blog-new-comment-name" name="name" 
+                       maxlength="40" type="text" />
+            </p>
+            <p id="blog-new-comment-body-area">
+                <textarea id="blog-new-comment-body" rows="" cols=""
+                          name="body"></textarea>
+            </p>
+            <p id="blog-new-comment-instructions">
+                You can use <a href="http://daringfireball.net/projects/markdown/syntax">Markdown</a>.
+            </p>
+            <h2>You're going to say:</h2>
+            <div class="wmd-preview"></div>
+            <p>
+                <input id="blog-new-comment-submit" name="submit"
+                       type="submit" value="Comment" />
+            </p>
+        </form>
+    </div>
+    
+    <script type="text/javascript">
         wmd_options = {
-			output: "Markdown",
-			buttons: "bold italic | link blockquote code | ol ul heading hr"
-		};
-	</script>
-	<script type="text/javascript"
-	 		src="/site-media/scripts/wmd/wmd.js"></script>
-	
+            output: "Markdown",
+            buttons: "bold italic | link blockquote code | ol ul heading hr"
+        };
+    </script>
+    <script type="text/javascript"
+            src="/site-media/scripts/wmd/wmd.js"></script>
+    
 {% endblock %}
\ No newline at end of file
--- a/templates/blog/list.html	Fri Jan 23 23:56:12 2009 -0500
+++ b/templates/blog/list.html	Sat Jan 24 00:51:16 2009 -0500
@@ -1,4 +1,5 @@
 {% extends "blog/base.html" %}
+{% load typogrify %}
 
 {% block content %}
 	<div id="blog-list">
@@ -6,10 +7,10 @@
 			<div class="blog-list-entry">
 				<h2 class="blog-list-entry-title">
 					<a href="{% url stevelosh.blog.views.entry entry.pub_date.year, entry.pub_date.month, entry.pub_date.day, entry.slug %}">
-						{{ entry.title }}
+						{{ entry.title|typogrify }}
 					</a>
 				</h2>
-				<p class="blog-list-entry-snip">{{ entry.snip }}</p>
+				<p class="blog-list-entry-snip">{{ entry.snip|typogrify }}</p>
 			</div>
 		{% endfor %}
 		
--- a/templates/flatpages/default.html	Fri Jan 23 23:56:12 2009 -0500
+++ b/templates/flatpages/default.html	Sat Jan 24 00:51:16 2009 -0500
@@ -1,5 +1,6 @@
 {% extends "base.html" %}
 {% load markup %}
+{% load typogrify %}
 
 {% block title %}{{ flatpage.title }}{% endblock %}
 
@@ -7,6 +8,6 @@
 
 {% block content %}
 	<div id="flatpage-content">
-		{{ flatpage.content|markdown }}
+		{{ flatpage.content|markdown|typogrify }}
 	</div>
 {% endblock %}
\ No newline at end of file
--- a/templates/flatpages/splash.html	Fri Jan 23 23:56:12 2009 -0500
+++ b/templates/flatpages/splash.html	Sat Jan 24 00:51:16 2009 -0500
@@ -1,4 +1,5 @@
 {% extends "flatpages/default.html" %}
+{% load typogrify %}
 
 {% block style %}
 	<link rel="stylesheet" href="/site-media/style/splash.css" 
@@ -6,6 +7,7 @@
 {% endblock %}
 
 {% block content %}
+{% filter typogrify %}
 	<div id="splash-list">
 		<div class="splash-list-entry">
 			<h2>I like writing. &raquo;</h2>
@@ -23,4 +25,5 @@
 			<h2>Stay up to date. &raquo;</h2>
 		</div>
 	</div>
+{% endfilter %}
 {% endblock %}
\ No newline at end of file
--- a/templates/projects/list.html	Fri Jan 23 23:56:12 2009 -0500
+++ b/templates/projects/list.html	Sat Jan 24 00:51:16 2009 -0500
@@ -1,4 +1,5 @@
 {% extends "projects/base.html" %}
+{% load typogrify %}
 
 {% block content %}
 	<div id="projects-list">
@@ -6,10 +7,10 @@
 			<div class="projects-list-entry">
 				<h2 class="projects-list-entry-title">
 					<a href="{% url stevelosh.projects.views.project project.slug %}">
-						{{ project.name }}
+						{{ project.name|typogrify }}
 					</a>
 				</h2>
-				<p class="projects-list-entry-snip">{{ project.snip }}</p>
+				<p class="projects-list-entry-snip">{{ project.snip|typogrify }}</p>
 			</div>
 		{% endfor %}
 	</div>
--- a/templates/projects/project.html	Fri Jan 23 23:56:12 2009 -0500
+++ b/templates/projects/project.html	Sat Jan 24 00:51:16 2009 -0500
@@ -1,90 +1,91 @@
 {% extends "projects/base.html" %}
 {% load markup %}
+{% load typogrify %}
 
 {% block title %}{{ project.name }}{% endblock %}
 
 {% block script %}
-	<script type="text/javascript"
-	        src="/site-media/scripts/jquery.validate.min.js">
-	</script>
-	<script type="text/javascript"
-	        src="/site-media/scripts/validate-comment-form.js">
-	</script>
-	<script type="text/javascript"
-	        src="/site-media/scripts/stevelosh-gallery.js">
-	</script>
+    <script type="text/javascript"
+            src="/site-media/scripts/jquery.validate.min.js">
+    </script>
+    <script type="text/javascript"
+            src="/site-media/scripts/validate-comment-form.js">
+    </script>
+    <script type="text/javascript"
+            src="/site-media/scripts/stevelosh-gallery.js">
+    </script>
 {% endblock %}
 
 {% block content %}
-	<div id="projects-project">
-		<h1 id="projects-project-name">
-			<a href="{% url stevelosh.projects.views.project project.slug %}">
-					{{ project.name }}
-			</a>
-		</h1>
-		<div id="projects-project-date">
-			<p>
-				Posted
-				on {{ project.posted.date|date:"F j, Y" }}
-				at {{ project.posted.time|time:"g:i A" }}
-			</p>
-		</div>
-		<div id="projects-project-body" class="content">
-			{{ project.body|markdown:"codehilite" }}
-		</div>
-	</div>
-	<hr />
-	{% ifnotequal comments.count 0 %}
-		<div id="projects-project-comments">
-			<h1>Comments</h1>
-			{% for comment in comments %}
-				<div class="projects-project-comment">
-					<a name="comment-{{ comment.id }}"></a>
-					<h2>{{ comment.name }} said:</h2>
-					<div class="projects-project-comment-body">
-						{{ comment.body|markdown:"safe" }}
-					</div>
-				</div>
-			{% endfor %}
-		</div>
-		<hr />
-	{% endifnotequal %}
-	<div id="projects-project-new-comment">
-		<h1>Add your comment:</h1>
-		<form id="new-comment-form" method="post" 
-			  action="{% url stevelosh.projects.views.comment %}">
-			<p class="form-label">
-				What's your name?
-			</p>
-			<p id="projects-new-comment-name-area">
-				<input type="hidden" name="project-id" 
-					   value="{{ project.id }}" />
-				<input id="projects-new-comment-name" name="name" 
-					   maxlength="40" type="text" />
-			</p>
-			<p id="projects-new-comment-body-area">
-				<textarea id="projects-new-comment-body" rows="" cols=""
-			 		  	  name="body"></textarea>
-			</p>
-			<p id="projects-new-comment-instructions">
-				You can use <a href="http://daringfireball.net/projects/markdown/syntax">Markdown</a>.
-			</p>
-			<h2>You're going to say:</h2>
-			<div class="wmd-preview"></div>
-			<p>
-				<input id="projects-new-comment-submit" name="submit"
-				 	   type="submit" value="Comment" />
-			</p>
-		</form>
-	</div>
-	
-	<script type="text/javascript">
+    <div id="projects-project">
+        <h1 id="projects-project-name">
+            <a href="{% url stevelosh.projects.views.project project.slug %}">
+                    {{ project.name|typogrify }}
+            </a>
+        </h1>
+        <div id="projects-project-date">
+            <p>
+                Posted
+                on {{ project.posted.date|date:"F j, Y" }}
+                at {{ project.posted.time|time:"g:i A" }}
+            </p>
+        </div>
+        <div id="projects-project-body" class="content">
+            {{ project.body|markdown:"codehilite"|typogrify }}
+        </div>
+    </div>
+    <hr />
+    {% ifnotequal comments.count 0 %}
+        <div id="projects-project-comments">
+            <h1>Comments</h1>
+            {% for comment in comments %}
+                <div class="projects-project-comment">
+                    <a name="comment-{{ comment.id }}"></a>
+                    <h2>{{ comment.name }} said:</h2>
+                    <div class="projects-project-comment-body">
+                        {{ comment.body|markdown:"safe"|typogrify }}
+                    </div>
+                </div>
+            {% endfor %}
+        </div>
+        <hr />
+    {% endifnotequal %}
+    <div id="projects-project-new-comment">
+        <h1>Add your comment:</h1>
+        <form id="new-comment-form" method="post" 
+              action="{% url stevelosh.projects.views.comment %}">
+            <p class="form-label">
+                What's your name?
+            </p>
+            <p id="projects-new-comment-name-area">
+                <input type="hidden" name="project-id" 
+                       value="{{ project.id }}" />
+                <input id="projects-new-comment-name" name="name" 
+                       maxlength="40" type="text" />
+            </p>
+            <p id="projects-new-comment-body-area">
+                <textarea id="projects-new-comment-body" rows="" cols=""
+                          name="body"></textarea>
+            </p>
+            <p id="projects-new-comment-instructions">
+                You can use <a href="http://daringfireball.net/projects/markdown/syntax">Markdown</a>.
+            </p>
+            <h2>You're going to say:</h2>
+            <div class="wmd-preview"></div>
+            <p>
+                <input id="projects-new-comment-submit" name="submit"
+                       type="submit" value="Comment" />
+            </p>
+        </form>
+    </div>
+    
+    <script type="text/javascript">
         wmd_options = {
-			output: "Markdown",
-			buttons: "bold italic | link blockquote code | ol ul heading hr"
-		};
-	</script>
-	<script type="text/javascript"
-	 		src="/site-media/scripts/wmd/wmd.js"></script>
-	
+            output: "Markdown",
+            buttons: "bold italic | link blockquote code | ol ul heading hr"
+        };
+    </script>
+    <script type="text/javascript"
+            src="/site-media/scripts/wmd/wmd.js"></script>
+    
 {% endblock %}
\ No newline at end of file
--- a/templates/thoughts/list.html	Fri Jan 23 23:56:12 2009 -0500
+++ b/templates/thoughts/list.html	Sat Jan 24 00:51:16 2009 -0500
@@ -1,5 +1,6 @@
 {% extends "base.html" %}
 {% load markup %}
+{% load typogrify %}
 
 {% block title %}Thoughts{% endblock %}
 
@@ -21,9 +22,9 @@
 					</div>
 					<div class="thought-content text-thought colborder-left span-14 last">
 						{% ifnotequal thought.title None %}
-							<h2>{{ thought.title }}</h2>
+							<h2>{{ thought.title|typogrify }}</h2>
 						{% endifnotequal %}
-						{{ thought.body|markdown:"safe" }}
+						{{ thought.body|markdown|typogrify }}
 					</div>
 				{% endifequal %}
 				{% ifequal thought.type 'link' %}
@@ -34,13 +35,13 @@
 					<div class="thought-content link-thought colborder-left span-14 last">
 						<h2><a href="{{ thought.url }}">
 							{% if thought.name %}
-								{{ thought.name }}
+								{{ thought.name|typogrify }}
 							{% else %}
 								{{ thought.url }}
 							{% endif %}
 						</a></h2>
 						{% if thought.description %}
-							{{ thought.description|markdown:"safe" }}
+							{{ thought.description|markdown|typogrify }}
 						{% endif %}
 					</div>
 				{% endifequal %}