-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d79e0ee
commit 59cb96f
Showing
16 changed files
with
308 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
|
||
<link rel="stylesheet" href="/static/bootstrap.min.css"> | ||
<link rel="stylesheet" href="/static/frozn.css" type="text/css" media="all" /> | ||
<link rel="stylesheet" href="/static/prettify/prettify.css" type="text/css" media="all" /> | ||
<script type="text/javascript" src="/static/prettify/prettify.js"></script> | ||
|
||
</head> | ||
|
||
<body onload="prettyPrint()"> | ||
<div class="container span8"> | ||
|
||
<div class="header"> | ||
<ul class="tabs"> | ||
<li class="active"><a href="/">Blog</a></li> | ||
<!--<li><a href="#">Portfolio <span class="label warning">External</span></a></li>--> | ||
<li><a target="_blank" href="http://twitter.com/jasonbartz">@jasonbartz <span class="label warning">External</span></a></li> | ||
<!--<li><a href="#">Contact</a></li>--> | ||
</ul> | ||
<h1>Jason Bartz</h1> | ||
|
||
</div> | ||
|
||
|
||
<div class="content"> | ||
|
||
|
||
|
||
<p><strong>2012-1-19 - </strong><a href="/posts/testing-markdown">testing-markdown</a></p> | ||
|
||
<p><strong>2012-1-12 - </strong><a href="/posts/new-blog-design-and-infrastructure">new-blog-design-and-infrastructure</a></p> | ||
|
||
<p><strong>2011-2-4 - </strong><a href="/posts/configuring-coda-and-sftp-to-work-with-amazon-aws">configuring-coda-and-sftp-to-work-with-amazon-aws</a></p> | ||
|
||
|
||
|
||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
|
||
<link rel="stylesheet" href="/static/bootstrap.min.css"> | ||
<link rel="stylesheet" href="/static/frozn.css" type="text/css" media="all" /> | ||
<link rel="stylesheet" href="/static/prettify/prettify.css" type="text/css" media="all" /> | ||
<script type="text/javascript" src="/static/prettify/prettify.js"></script> | ||
|
||
</head> | ||
|
||
<body onload="prettyPrint()"> | ||
<div class="container span8"> | ||
|
||
<div class="header"> | ||
<ul class="tabs"> | ||
<li class="active"><a href="/">Blog</a></li> | ||
<!--<li><a href="#">Portfolio <span class="label warning">External</span></a></li>--> | ||
<li><a target="_blank" href="http://twitter.com/jasonbartz">@jasonbartz <span class="label warning">External</span></a></li> | ||
<!--<li><a href="#">Contact</a></li>--> | ||
</ul> | ||
<h1>Jason Bartz</h1> | ||
|
||
</div> | ||
|
||
|
||
<div class="content"> | ||
|
||
|
||
<div class="headline"><h2>Testing markdown</h2></div> | ||
<div class="meta"> | ||
<div class="datetime">2012-1-19 </div> | ||
</div> | ||
<div class="post_body"> | ||
|
||
<p>This is a paragraph</p><div class="codeblock"> | ||
<pre class="prettyprint"> | ||
|
||
vim ~/.ssh/config | ||
|
||
</pre> | ||
</div> | ||
<p>Here is another.</p> | ||
<p>And one more paragraph.</p> | ||
<ul> | ||
<li>bullets</li> | ||
<li>boom</li> | ||
</ul> | ||
|
||
</div> | ||
|
||
<h3>Previous posts</h3> | ||
|
||
<p><strong>2012-1-19 - </strong><a href="/posts/testing-markdown">testing-markdown</a></p> | ||
|
||
<p><strong>2012-1-12 - </strong><a href="/posts/new-blog-design-and-infrastructure">new-blog-design-and-infrastructure</a></p> | ||
|
||
<p><strong>2011-2-4 - </strong><a href="/posts/configuring-coda-and-sftp-to-work-with-amazon-aws">configuring-coda-and-sftp-to-work-with-amazon-aws</a></p> | ||
|
||
|
||
<p><a href="/archives/">Archives</a></p> | ||
|
||
|
||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,40 @@ | ||
from jinja2 import nodes | ||
from jinja2.ext import Extension | ||
|
||
# class CodeBlock(Extension): | ||
# # a set of names that trigger the extension. | ||
# tags = set(['codeblock']) | ||
# | ||
# def __init__(self, environment): | ||
# super(CodeBlock, self).__init__(environment) | ||
# | ||
# def parse(self, parser): | ||
# # the first token is the token that started the tag. In our case | ||
# # we only listen to ``'cache'`` so this will be a name token with | ||
# # `cache` as value. We get the line number so that we can give | ||
# # that line number to the nodes we create by hand. | ||
# lineno = parser.stream.next().lineno | ||
# | ||
# | ||
# # now we parse the body of the cache block up to `endcache` and | ||
# # drop the needle (which would always be `endcache` in that case) | ||
# body = parser.parse_statements(['name:endcodeblock'], drop_needle=True) | ||
# | ||
# body[0].nodes[0].data | ||
# | ||
# codeblock_string = '''<div class="codeblock"> | ||
# <pre class="prettyprint"> | ||
# %s | ||
# </pre> | ||
# </div> | ||
# ''' % body[0].nodes[0].data | ||
# body[0].nodes[0].data = codeblock_string | ||
# | ||
# # now return a `CallBlock` node that calls our _cache_support | ||
# # helper method on this extension. | ||
# return nodes.Block('codeblock',body,[]).set_lineno(lineno) | ||
import markdown | ||
|
||
class CodeBlock(Extension): | ||
tags = set(['codeblock']) | ||
|
||
def parse(self, parser): | ||
node = nodes.Scope(lineno=next(parser.stream).lineno) | ||
node.body = parser.parse_statements(('name:endcodeblock',),drop_needle=True) | ||
#import pdb;pdb.set_trace() | ||
codeblock_string = '''<div class="codeblock"> | ||
<pre class="prettyprint"> | ||
%s | ||
</pre> | ||
</div> | ||
</div> | ||
''' % node.body[0].nodes[0].data | ||
node.body[0].nodes[0].data = codeblock_string | ||
|
||
return node | ||
|
||
class MarkDown(Extension): | ||
tags = set(['markdown']) | ||
|
||
def parse(self, parser): | ||
node = nodes.Scope(lineno=next(parser.stream).lineno) | ||
# Set the node body | ||
node.body = parser.parse_statements(('name:markdown',), drop_needle=True) | ||
|
||
# Loop through the body, ignoring CodeBlocks | ||
# Transform the body into Markdown | ||
for body_object in node.body: | ||
# Conform body to markdown | ||
try: | ||
body_object.nodes[0].data = markdown.markdown(body_object.nodes[0].data) | ||
|
||
# Other scope objects, like CodeBlock, will trigger this exception | ||
except AttributeError: | ||
pass | ||
|
||
return node |
Oops, something went wrong.