Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

tweaks

  • Loading branch information...
commit b56e938d97aa6e0dea91f236c8c3e8ccc4cd9a6c 1 parent c250eb7
@JoshData authored
Showing with 20 additions and 10 deletions.
  1. +4 −1 master.html
  2. +6 −5 static/css/local.css
  3. +10 −4 views.py
View
5 master.html
@@ -146,6 +146,7 @@
</script>
<script>
+var throttleTimeout = null;
function layout() {
var header = $('header');
var main = $('#main');
@@ -180,8 +181,9 @@
$(document).ready(function() {
$('#toc, #content').jScrollPane();
layout();
+ layout(); // it takes two calls to get this right??
$(window).resize(layout);
- setTimeout("layout()", 1000);
+ setTimeout("layout()", 1000); // still need this really
// move footnotes from inline to the bottom
@@ -209,6 +211,7 @@
$('#comments .close').click(function() {
$("#comments").animate({ left: $(window).width() }).fadeOut();
});
+
});
</script>
</body>
View
11 static/css/local.css
@@ -10,9 +10,10 @@ body {
header, footer, #toc {
background-color: #FDF8EC;
color: #404045;
+ clear: both;
}
header {
- padding: 1em;
+ padding: 1em;ma
text-align: center;
}
p {
@@ -23,7 +24,7 @@ p {
color: #555555;
}
#toc {
- width: 230px;
+ width: 190px;
height: 100%;
float: left;
overflow: auto;
@@ -129,8 +130,8 @@ p {
color: #466c5b;
}
#tools {
- float: left;
- width: 200px;
+ float: right;
+ width: 190px;
height: 100%;
/* border-left: 1px solid #DDD;;
border-top: 1px solid black;
@@ -139,7 +140,7 @@ p {
background-color: #FFFAEE;
}
#tools .padder {
- margin: .5em 15px 0 20px
+ margin: .5em 15px 0 10px
}
#tools .comments {
cursor: pointer;
View
14 views.py
@@ -74,6 +74,7 @@ class Renderer:
"%": ("%", ""),
"&": ("&amp;", ""),
"#": ("#", ""),
+ "active::~": ("&nbsp;", ""),
" ": (" ", ""),
"quotation": "blockquote",
"center": "center",
@@ -91,6 +92,7 @@ class Renderer:
"active::_": "sub",
"ldots": (" . . . ", ""),
"textasciitilde": ("~", ""),
+ "rule": ("<hr/>", ""),
}
def __init__(self):
@@ -181,7 +183,7 @@ def noindent(self, node):
self.indent = False
def url(self, node):
- if "url" not in node.attributes: raise Exception(repr(node))
+ if "url" not in node.attributes: raise Exception("\\url without url attribute: " + node.toXML())
write_raw("<a href=\"")
write(node.attributes["url"])
write_raw("\" target=\"_blank\">")
@@ -191,7 +193,7 @@ def href(self, node):
write_raw("<a href=\"")
write(node.attributes["url"])
write_raw("\" target=\"_blank\">")
- write(node.attributes["self"])
+ write(node.attributes["self"] if node.attributes["self"] else "???")
write_raw("</a>")
def figure_start(self, node):
@@ -238,7 +240,7 @@ def ref(self, node):
write_raw("<reference>")
write_raw(lab)
write_raw("</reference>")
-
+
renderer = Renderer()
def process_node(node):
@@ -371,7 +373,7 @@ def page(request, bookname, pagename):
}, context_instance=RequestContext(request))
def figure(request, bookname, figurename):
- for ext in ('png', 'pdf'):
+ for ext in ('png', 'jpg', 'jpeg', 'pdf'):
fn = os.path.dirname(__file__) + "/books/" + bookname + "/" + figurename + "." + ext
if not os.path.exists(fn): continue
@@ -379,6 +381,10 @@ def figure(request, bookname, figurename):
resp = HttpResponse(content_type="image/png")
resp.write(open(fn).read())
return resp
+ if ext in ("jpg", "jpeg"):
+ resp = HttpResponse(content_type="image/jpeg")
+ resp.write(open(fn).read())
+ return resp
if ext == "pdf":
# convert PDF to png (and cache the result in memory)
Please sign in to comment.
Something went wrong with that request. Please try again.