Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge ssh://occams/home/tauberer/ogdbook

  • Loading branch information...
commit a0886b637eb99885b18f7b4f9845a9f761a20462 2 parents 9d1bef1 + b0c7052
@JoshData authored
View
4 README
@@ -28,9 +28,9 @@ DEFAULT_BOOK = "mybook" # root directory of book content
HASHTAG = "myhashtag" # suggested hashtag, no #-sign
TWEET = "What a great book." # suggested tweet
RELATED_TWITTER_HANDLE = "YourHandle" # your twitter handle, no @-sign
-GOOGLE_GROUP_NAME = "opengovdatabook" # name of your Google Group
+GOOGLE_GROUP_NAME = "mybookgroup" # name of your Google Group
GOOGLE_ANALYTICS_ID = "UAXXXXXXXX1" # your Google Analytics ID
-FACEBOOK_APP_ID = "119329904748946" # your Facebook App ID
+FACEBOOK_APP_ID = "1133344455511" # your Facebook App ID
You may also specify chapters to embargo (hide from the site) using the chapter
numbers, e.g.:
View
12 django.wsgi
@@ -0,0 +1,12 @@
+#!/usr/bin/python
+import sys, os, os.path
+
+os.chdir(os.path.dirname(__file__))
+sys.path.insert(0, ".")
+
+# Set the DJANGO_SETTINGS_MODULE environment variable.
+os.environ['DJANGO_SETTINGS_MODULE'] = "settings"
+os.environ['DJANGO_PRODUCTION'] = "1"
+
+import django.core.handlers.wsgi
+application = django.core.handlers.wsgi.WSGIHandler()
View
221 master.html
@@ -1,7 +1,8 @@
-<!doctype>
-<!--[if lt IE 7]> class="no-js ie6 oldie" lang="en"> <![endif]-->
-<!--[if IE 7]> class="no-js ie7 oldie" lang="en"> <![endif]-->
-<!--[if IE 8]> class="no-js ie8 oldie" lang="en"> <![endif]-->
+<!doctype html>
+<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
+<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
+<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
+<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head itemscope itemtype="http://schema.org/Book">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
@@ -12,204 +13,18 @@
<!-- CSS concatenated and minified via ant build script-->
<link rel="stylesheet" href="/static/css/style.css">
+ <link rel="stylesheet" href="/static/css/local.css">
<link type="text/css" href="/static/css/jquery.jscrollpane.css" rel="stylesheet" media="all" />
<!-- end CSS-->
<script src="/static/js/libs/modernizr-2.0.6.min.js"></script>
- <style>
-
- @import url(http://fonts.googleapis.com/css?family=Arvo:700);
- @import url(http://fonts.googleapis.com/css?family=PT+Serif:400,700,400italic);
-
-
- body {
- font-family: 'PT Serif', serif;
- }
- header, footer {
- background-color: black;
- color: white;
- }
- header {
- padding: 1em;
- text-align: center;
- }
- header h1 {
- margin: 0;
- font-size: {% if page %}22pt{% else %}30pt{% endif %};
- font-family: 'Arvo', serif;
- letter-spacing: 1px;
- }
- header h2 {
- margin: 10px 0 0 2px;
- font-size: 13pt;
- font-weight: normal;
- }
- header h2 a {
- color: black;
- }
- header a, header a:visited {
- color: #EEF;
- }
- header a {
- text-decoration: none;
- }
- header a:hover {
- text-decoration: underline;
- }
- #main {
- background-color: white;
- border-top: 1px solid #DDD;
- border-bottom: 1px solid #DDD;
- }
- #toc {
- width: 230px;
- height: 100%;
- float: left;
- overflow: auto;
- padding: 0 20px 0 1em;
- border-right: 1px solid #DDD;
- background: #444;
- color: #EEE;
- font-size: 12px;
- }
- #toc ul {
- margin: 0;
- padding: 0;
- }
- #toc li {
- list-style-type: none;
- margin-bottom: .25em;
- }
- #toc li.active {
- background: #666;
- font-weight: bold;
- padding: 2px;
- }
- #toc a {
- color: #EEE;
- text-decoration: none;
- }
- #toc a:hover {
- color: #FFF;
- text-decoration: underline;
- }
- #toc span.num {
- color: #DDD;
- }
- #main #content-frame {
- float: left;
- height: 100%;
- }
- #content {
- overflow: auto;
- font-size: 10.5pt;
- line-height: 140%;
- text-align: justify;
- padding: 1.5em 15px 2.5em 25px;
- margin-right: 40px;
- }
- #content .footnotes {
- margin-top: 15px;
- border-top: 1px solid black;
- padding-top: 10px;
- font-size: 9pt;
- }
- #content .footnote_entry {
- display: block;
- }
- #nav {
- height: 2em;
- border-top: 1px solid #DDD;
- padding: .5em 1em .5em 1em;
- vertical-align: middle;
- }
- #nav .prev, #nav .next {
- width: 50%;
- height: 100%;
- }
- #nav .next {
- float: right;
- text-align: right;
- }
- #nav a {
- color: black;
- text-decoration: none;
- }
- #nav a:hover {
- text-decoration: underline;
- }
- #tools {
- float: left;
- width: 160px;
- height: 100%;
- border-left: 1px solid #DDD;
- }
- #tools .padder {
- margin: .5em 5px 0 10px;
- }
- #tools .comments {
- cursor: pointer;
- margin: 20px 0 25px 0;
- }
- .fb-like {
- margin-top: 15px;
- margin-bottom: 15px;
- }
- #tools .maillist {
- margin-top: 25px;
- }
- footer {
- padding: 1em;
- }
- footer a, footer a:visited {
- color: white;
- }
- footer div.copyright {
- font-size: 12px;
- }
- #comments .close {
- padding: 3px;
- font-family: Arial, sans-serif;
- cursor: pointer;
- text-align: right;
- }
-
- #content p.indent {
- text-indent: 1.5em;
- }
- #content li p.indent {
- text-indent: 0;
- }
- #content .figure {
- margin: 2em;
- }
- #content .figure table {
- border: 1px solid black;
- }
- #content .figure table td {
- border: 1px solid black;
- padding: 2px;
- font-size: 10.5pt;
- }
- #content .footnote_marker {
- /* Chrome is messing up position: relative */
- font-size: 85%;
- padding: 3px;
- color: #555;
- }
-
- #toc .jspVerticalBar { display: none; }
- #toc .jspContainer:hover .jspVerticalBar { display: block; }
-
- </style>
</head>
<body>
<div id="container">
<header>
- {% include "header.html" %}
</header>
<div id="main" role="main">
<div id="toc">
@@ -231,26 +46,34 @@
<div id="content">
<div class="wrapper">
{% if page %}
- {{page.content|safe}}
+ <div id="header">
+ {% include "header.html" %}
+ <div style="clear: both"> </div>
+ </div>
+ <div id="page-content">
+ {{page.content|safe}}
+ </div>
{% else %}
- {% include "home.html" %}
+ <div id="home">
+ {% include "home.html" %}
+ </div>
{% endif %}
</div>
</div>
<div id="nav">
- {% if prev %}<a class="prev" href="{{prev.href}}">{{prev.name}}</a>{% endif %}
- {% if next %}<a class="next" href="{{next.href}}">{{next.name}}</a>{% endif %}
+ {% if prev %}<a class="prev" href="{{prev.href}}">&lt; {{prev.name}}</a>{% endif %}
+ {% if next %}<a class="next" href="{{next.href}}">{{next.name}} &gt;</a>{% endif %}
</div>
</div>
<div id="tools">
<div class="padder">
- <div class="comments">
+ <div class="comments myButton">
Read <fb:comments-count href="http://{{host}}"/></fb:comments-count> comments or add a comment on this
book.
</div>
-
- <a href="https://twitter.com/intent/tweet?button_hashtag={{hashtag|urlencode}}&text={{tweet|urlencode}}" class="twitter-hashtag-button" data-related="{{related_twitter_handle}}" data-url="http://{{host}}">Tweet #{{hashtag}}</a>
+
+ <a href="https://twitter.com/intent/tweet?button_hashtag={{hashtag|urlencode}}&text={{tweet|urlencode}}" class="twitter-hashtag-button" data-related="{{related_twitter_handle}}" data-url="{{current_url}}">Tweet #{{hashtag}}</a>
<div class="fb-like" data-send="false" data-layout="button_count" data-width="133" data-show-faces="false" data-action="like" data-font="verdana"></div>
@@ -332,7 +155,7 @@
var toc = $('#toc');
var contentframe = $('#content-frame');
var tools = $('#tools');
- contentframe.css({width: $(window).width() - toc.outerWidth() - tools.outerWidth()});
+ contentframe.css({width: $(window).width() - toc.outerWidth() - tools.outerWidth() - 1});
$('#content').css({height: contentframe.height() - $('#nav').outerHeight() });
View
340 static/css/local.css
@@ -0,0 +1,340 @@
+/* @override http://opengovdata.io/static/css/local.css */
+@import url(http://fonts.googleapis.com/css?family=Lora);
+@import url(http://fonts.googleapis.com/css?family=PT+Serif:400,700,400italic);
+@import url(http://fonts.googleapis.com/css?family=Telex);
+@import url(http://fonts.googleapis.com/css?family=Montserrat);
+/* link color: #83AF9B; _NO__DOTCOMMA__AFTER__*/
+body {
+ font-family: 'Gudea', serif
+}
+header, footer, #toc {
+ background-color: #FDF8EC;
+ color: #404045;
+}
+header {
+ padding: 1em;
+ text-align: center;
+}
+p {
+ font-size: 13px;
+ font-family: 'Telex', sans-serif;
+ font-weight: 500;
+ line-height: 1.8em;
+ color: #555555;
+}
+#toc {
+ width: 230px;
+ height: 100%;
+ float: left;
+ overflow: auto;
+ padding: 0 20px 0 1em;
+ font-size: 12px;
+}
+ #toc ul {
+ margin: 0;
+ padding: 0;
+ }
+ #toc li {
+ list-style-type: none;
+ margin-bottom: .25em;
+ font-family: 'Telex', sans-serif;
+ margin-bottom: 10px;
+ }
+ #toc li.active {
+ background: #EEE;
+ border: 1px solid #FFF;
+ font-weight: bold;
+ padding: 2px;
+ }
+ #toc a {
+ color: #687;
+ text-decoration: none;
+ }
+ #toc a:hover {
+ color: #466c5b;
+ text-decoration: none;
+ }
+ #toc span.num {
+ color: #444
+ }
+ #toc h2 {
+ font-size: 20px;
+ font-family: 'Montserrat', san-serif;
+ color: #556270;
+ }
+#content-frame {
+ float: left;
+ width: 640px; /* initial width before javascript sets the proper width */
+ height: 100%;
+ /* border-left: 1px solid black;;
+ border-top: 1px solid black;
+ border-bottom: 1px solid black;*/
+}
+#content {
+ background: white;
+ overflow: auto;
+ font-size: 10.5pt;
+ line-height: 140%;
+ text-align: justify;
+ padding: 1.5em 15px 2.5em 25px;
+ margin-right: 40px;
+}
+ #content .footnotes {
+ margin-top: 15px;
+ border-top: 2px solid #AAA;
+ padding-top: 10px;
+ font-size: 9pt;
+ }
+ #content .footnote_entry {
+ display: block;
+ font-family: 'Telex', sans-serif;
+ }
+ #content .footnote_entry a {
+ color: #83AF9B
+ }
+ #content .footnote_entry a:hover {
+ color: #466c5b
+ }
+ #content h4 {
+ font-size: 16px;
+ font-family: 'Montserrat', san-serif;
+ color: #C44D58;
+ text-transform: uppercase;
+ border-bottom: 2px solid #555555;
+ padding-bottom: 8px;
+ }
+#nav {
+ height: 3em;
+ padding: 1em 1em .5em 1em;
+}
+ #nav .prev, #nav .next {
+ display: block;
+ float: left;
+ width: 50%;
+ height: 100%;
+ }
+ #nav .next {
+ float: right;
+ text-align: right;
+ }
+ #nav a {
+ color: #798;
+ text-decoration: none;
+ font-family: 'Telex', sans-serif;
+ font-size: 16px;
+ font-weight: bold;
+ }
+ #nav a:hover {
+ text-decoration: none;
+ color: #466c5b;
+ }
+#tools {
+ float: left;
+ width: 200px;
+ height: 100%;
+ /* border-left: 1px solid #DDD;;
+ border-top: 1px solid black;
+ border-bottom: 1px solid black;
+ border-right: 1px solid black;*/
+ background-color: #FFFAEE;
+}
+ #tools .padder {
+ margin: .5em 15px 0 20px
+ }
+ #tools .comments {
+ cursor: pointer;
+ margin: 20px 0 25px 0;
+ font-family: 'Telex', sans-serif;
+ }
+.myButton {
+ -moz-box-shadow: inset 0px 1px 0px 0px #ffffff;
+ -webkit-box-shadow: inset 0px 1px 0px 0px #ffffff;
+ box-shadow: inset 0px 1px 0px 0px #ffffff;
+ background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) );
+ background: -moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% );
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf');
+ background-color: #ededed;
+ -moz-border-radius: 6px;
+ -webkit-border-radius: 6px;
+ border-radius: 6px;
+ border: 1px solid #dcdcdc;
+ display: inline-block;
+ padding: 6px;
+ text-decoration: none;
+ text-shadow: 1px 1px 0px #ffffff;
+}
+.myButton:hover {
+ background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #dfdfdf), color-stop(1, #ededed) );
+ background: -moz-linear-gradient( center top, #dfdfdf 5%, #ededed 100% );
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#dfdfdf', endColorstr='#ededed');
+ background-color: #dfdfdf;
+}
+.myButton:active {
+ position: relative;
+ top: 1px;
+}
+.fb-like {
+ margin-top: 15px;
+ margin-bottom: 15px;
+}
+#tools .maillist {
+ margin-top: 25px;
+ font-family: 'Telex', sans-serif;
+}
+footer {
+ padding: 1em;
+ background-color: #E8E5DF;
+}
+ footer a, footer a:visited {
+ color: #333
+ }
+ footer div.copyright {
+ font-size: 12px
+ }
+#comments .close {
+ padding: 3px;
+ font-family: Arial, sans-serif;
+ cursor: pointer;
+ text-align: right;
+}
+/* not working because noindent is going on the para after where it goes */
+/*#content p.indent {
+ text-indent: 1.5em;
+ }
+ #content li p.indent {
+ text-indent: 0;
+ }*/
+#home #title {
+ text-align: center;
+ margin-bottom: 50px;
+ font-family: 'Lora', sans-serif;
+}
+#home h1 {
+ margin: 1em 0 1em 0;
+ font-size: 28pt;
+ letter-spacing: 1px;
+ font-family: 'Montserrat', san-serif;
+ text-transform: uppercase;
+ font-weight: bold;
+ color: #556270;
+}
+#home h2 {
+ margin: 50px 0 10px 2px;
+ font-size: 12pt;
+ font-weight: normal;
+ font-family: 'Montserrat', san-serif;
+ color: #C44D58;
+}
+ #home h2 a:hover {
+ color: #466c5b
+ }
+ #home h2 a, header h2 a:visited {
+ color: #83AF9B
+ }
+#home p a {
+ color: #83AF9B
+}
+#content #header {
+ margin-bottom: 25px;
+ padding-bottom: 4px;
+ border-bottom: 2px solid #AAA;
+}
+ #content #header h1, #content #header h2 {
+ float: left;
+ margin: 0;
+ font-size: 11pt;
+ font-weight: normal;
+ color: #555;
+ }
+ #content #header h2 {
+ float: right;
+ font-size: 10pt;
+ font-weight: normal;
+ font-family: 'Montserrat', san-serif;
+ color: #556270;
+ }
+ #content #header a {
+ font-size: 10pt;
+ font-weight: normal;
+ font-family: 'Montserrat', san-serif;
+ color: #83AF9B;
+ text-decoration: none;
+ }
+ #content #header a:hover {
+ color: #466c5b
+ }
+#page-content h1 {
+ line-height: normal;
+ margin: 40px 0 30px 0;
+ font-family: 'Montserrat', san-serif;
+ font-size: 24px;
+ color: #C44D58;
+}
+#page-content h2 {
+ line-height: normal;
+ margin: 40px 0 30px 0;
+ font-family: 'Montserrat', san-serif;
+ font-size: 20px;
+ color: #556270;
+}
+#page-content h3 {
+ line-height: normal;
+ margin: 40px 0 30px 0;
+ font-family: 'Montserrat', san-serif;
+ font-size: 17px;
+ color: #C44D58;
+}
+#page-content h4 {
+ font-size: 15px;
+ font-family: 'Montserrat', san-serif;
+ color: #C44D58;
+ text-transform: none;
+ border-bottom: 2px solid #555555;
+ padding-bottom: 8px;
+}
+#page-content p a {
+ color: #83AF9B
+}
+#page-content p a:hover {
+ color: #466c5b
+}
+#content .figure {
+ margin: 2em
+}
+ #content .figure table {
+ border: 1px solid black
+ }
+ #content .figure table td {
+ border: 1px solid black;
+ padding: 2px;
+ font-size: 10.5pt;
+ }
+#content .footnote_marker {
+ /* Chrome is messing up position: relative */;
+ font-size: 85%;
+ padding: 3px;
+ color: #C44D58;
+}
+#content blockquote {
+ background-color: #8395a8;
+ padding: .5em;
+ font-family: 'Telex', sans-serif;
+ color: #fff;
+ padding: 20px;
+}
+ #content blockquote p {
+ color: #fff
+ }
+ #content blockquote .footnote_marker {
+ color: #eee
+ }
+#title p {
+ margin-top: 10px;
+ margin-bottom: 90px;
+}
+#toc .jspVerticalBar {
+ display: none
+}
+#toc .jspContainer:hover .jspVerticalBar {
+ display: block
+}
View
6 static/css/style.css
@@ -11,11 +11,11 @@ html { font-size: 100%; overflow-y: scroll; -webkit-text-size-adjust: 100%; -ms-
body { margin: 0; font-size: 13px; line-height: 1.231; }
body, button, input, select, textarea { font-family: sans-serif; color: #222; }
-::-moz-selection { background: #fe57a1; color: #fff; text-shadow: none; }
-::selection { background: #fe57a1; color: #fff; text-shadow: none; }
+::-moz-selection { background: #6666fe; color: #fff; text-shadow: none; }
+::selection { background: #6666fe; color: #fff; text-shadow: none; }
a { color: #00e; }
-a:visited { color: #551a8b; }
+a:visited { color: #00f; }
a:hover { color: #06e; }
a:focus { outline: thin dotted; }
a:hover, a:active { outline: 0; }
View
21 views.py
@@ -48,6 +48,9 @@ def write_raw(s):
class Renderer:
pass_through = ("#document", "document", "appendix", "bgroup")
skip = ("documentclass", "usepackage", "setdefaultlanguage", "restylefloat", "floatstyle", "makeindex", "newcommand", "tableofcontents", "addcontentsline", "printindex", "Index")
+
+ # specify either a tag name as a string (e.g. "p")
+ # or a tuple of HTML to wrap around the content (e.g. ("<p>", "</p>")).
wrap = {
"slash": ("<br/>", ""),
"newpage": ("<hr/>", ""),
@@ -62,7 +65,7 @@ class Renderer:
"_": ("_", ""),
"$": ("$", ""),
"%": ("%", ""),
- "&": ("&", ""),
+ "&": ("&amp;", ""),
"#": ("#", ""),
" ": (" ", ""),
"quotation": "blockquote",
@@ -167,13 +170,21 @@ def par_end(self, node):
if node.textContent.strip() == "": return
write_raw("</p>")
def noindent(self, node):
+ # not working, seems to ocurr *after* the par node
self.indent = False
+
def url(self, node):
write_raw("<a href=\"")
write(node.attributes["url"])
write_raw("\" target=\"_blank\">")
write(node.attributes["url"])
write_raw("</a>")
+ def href(self, node):
+ write_raw("<a href=\"")
+ write(node.attributes["url"])
+ write_raw("\" target=\"_blank\">")
+ write(node.attributes["self"])
+ write_raw("</a>")
def figure_start(self, node):
self.cur_figure = self.next_counter("figure")
@@ -194,7 +205,7 @@ def graphic(self, node):
fn = fn.replace(".pdf", "").replace(".png", "")
write_raw("<div class='img_container'><img width='100%' src='/" + bookname + "/figure/")
write(fn)
- write("'/></div>")
+ write_raw("'/></div>")
node.parentNode.removeChild(node.nextSibling)
def footnote_start(self, node):
@@ -293,6 +304,9 @@ def process_node(node):
})
def fill_ref(match):
+ if not match.group(1) in renderer.labels:
+ return "[unknown reference]"
+
section_index, section_number, figure_counter = renderer.labels[match.group(1)]
if figure_counter:
@@ -300,7 +314,7 @@ def fill_ref(match):
else:
text = section_number
- if section_index not in content_map:
+ if section_index not in content_map or figure_counter:
return cgi.escape(text)
return str("<a class=\"reference\" href=\"" + cgi.escape(toc[content_map[section_index]]["href"]) + "\">" + cgi.escape(text) + "</a>")
@@ -330,6 +344,7 @@ def page(request, bookname, pagename):
return render_to_response('master.html', {
"host": request.get_host(),
+ "current_url": request.build_absolute_uri(),
"hashtag": settings.HASHTAG,
"tweet": settings.TWEET,
"related_twitter_handle": settings.RELATED_TWITTER_HANDLE,
Please sign in to comment.
Something went wrong with that request. Please try again.