Commits

Georg Brandl committed 4078e2b

Initial commit.

  • Participants

Comments (0)

Files changed (14)

+# -*- coding: utf-8 -*-
+"""
+    zine.plugins.pythoni_theme
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+    The theme for pythonic.pocoo.org
+
+    :copyright: 2008 by Armin Ronacher.
+    :copyright: 2010 by Georg Brandl.
+    :license: BSD, see LICENSE for more details.
+"""
+from os.path import join, dirname
+try:
+    from pygments.style import Style
+    from pygments.token import Keyword, Name, Comment, String, Error, \
+         Number, Operator, Generic, Whitespace, Punctuation, Other, Literal
+
+    from zine.plugins.pygments_support import add_style
+
+    have_pygments = True
+except ImportError:
+    have_pygments = False
+
+
+TEMPLATE_FILES = join(dirname(__file__), 'templates')
+SHARED_FILES = join(dirname(__file__), 'shared')
+
+
+if have_pygments:
+    class LucumrStyle(Style):
+        default_style = ""
+
+        styles = {
+            Whitespace:                "underline #f8f8f8",
+            Error:                     "#a40000 border:#ef2929",
+            Other:                     "#000000",
+
+            Comment:                   "italic #666",
+            Comment.Multiline:         "italic #666",
+            Comment.Preproc:           "noitalic",
+            Comment.Single:            "italic #666",
+            Comment.Special:           "italic #666",
+
+            Keyword:                   "bold #204a87",
+            Keyword.Constant:          "bold #204a87",
+            Keyword.Declaration:       "bold #204a87",
+            Keyword.Namespace:         "bold #204a87",
+            Keyword.Pseudo:            "bold #204a87",
+            Keyword.Reserved:          "bold #204a87",
+            Keyword.Type:              "bold #204a87",
+
+            Operator:                  "#333",
+            Operator.Word:             "bold #204a87",
+
+            Punctuation:               "#333",
+
+            # because special names such as Name.Class, Name.Function, etc.
+            # are not recognized as such later in the parsing, we choose them
+            # to look the same as ordinary variables.
+            Name:                          "#000000",
+            Name.Attribute:                "#c4a000",
+            Name.Builtin:                  "#204a87",
+            Name.Builtin.Pseudo:           "#3465a4",
+            Name.Class:                    "#000000",
+            Name.Constant:                 "#000000",
+            Name.Decorator:                "bold #5c35cc",
+            Name.Entity:                   "#ce5c00",
+            Name.Exception:                "bold #cc0000",
+            Name.Function:                 "#000000",
+            Name.Property:                 "#000000",
+            Name.Label:                    "#f57900",
+            Name.Namespace:                "#000000",
+            Name.Other:                    "#000000",
+            Name.Tag:                      "bold #204a87",
+            Name.Variable:                 "#000000",
+            Name.Variable.Class:           "#000000",
+            Name.Variable.Global:          "#000000",
+            Name.Variable.Instance:        "#000000",
+
+            # since the tango light blue does not show up well in text, we choose
+            # a pure blue instead.
+            Number:                        "#0000cf",
+            Number.Float:                  "#0000cf",
+            Number.Hex:                    "#0000cf",
+            Number.Integer:                "#0000cf",
+            Number.Integer.Long:           "#0000cf",
+            Number.Oct:                    "#0000cf",
+
+            Literal:                   "#000000",
+            Literal.Date:              "#000000",
+
+            String:                    "#4e9a06",
+            String.Backtick:           "#4e9a06",
+            String.Char:               "#4e9a06",
+            String.Doc:                "#4e9a06",
+            String.Double:             "#4e9a06",
+            String.Escape:             "#4e9a06",
+            String.Heredoc:            "#4e9a06",
+            String.Interpol:           "#4e9a06",
+            String.Other:              "#4e9a06",
+            String.Regex:              "#4e9a06",
+            String.Single:             "#4e9a06",
+            String.Symbol:             "#4e9a06",
+
+            Generic:                   "#000000",
+            Generic.Deleted:           "#a40000",
+            Generic.Emph:              "italic #000000",
+            Generic.Error:             "#ef2929",
+            Generic.Heading:           "bold #000080",
+            Generic.Inserted:          "#00A000",
+            Generic.Output:            "#555",
+            Generic.Prompt:            "#8f5902",
+            Generic.Strong:            "bold #000000",
+            Generic.Subheading:        "bold #800080",
+            Generic.Traceback:         "bold #a40000",
+        }
+
+
+def setup(app, plugin):
+    lazy_columns = frozenset(['comments', 'tags', 'author', 'links', 'categories'])
+    deferred_columns = frozenset(['text', 'parser_data', 'extra', 'comment_count'])
+
+    app.add_theme('pythonic', TEMPLATE_FILES, plugin.metadata, {
+        'pagination.left_threshold':    2,
+        'pagination.right_threshold':   2,
+        'pagination.threshold':         3,
+        'pagination.next_link':         True,
+        'pagination.prev_link':         True,
+        'archive.per_page':             50,
+        'category.per_page':            50,
+        'tag.per_page':                 50,
+        'date.date_format.default':     'full',
+        'date.datetime_format.default': 'full',
+        'date.datetime_format.full':    'EEEE, MMMM d, yyyy H:mm',
+        'sql.tag.lazy':                 lazy_columns,
+        'sql.tag.deferred':             deferred_columns,
+        'sql.author.lazy':              lazy_columns,
+        'sql.author.deferred':          deferred_columns
+    })
+    app.add_shared_exports('pythonic_theme', SHARED_FILES)
+
+    if have_pygments:
+        add_style('lucumr', LucumrStyle)

File art/header.xcf

Binary file added.

File metadata.txt

+Name: Pythonic Theme
+Author: Georg Brandl <georg@python.org>
+Author URL: http://pythonic.pocoo.org/
+Version: 0.1
+License: BSD
+Description: The theme for pythonic.pocoo.org, adapted from the lucumr.pocoo.org theme.

File shared/gb.jpg

Added
New image

File shared/header.png

Added
New image

File shared/ruler.png

Added
New image

File shared/style.css

+body {
+    background: url(header.png) no-repeat center 10px;
+    font-family: 'Cambria', 'Georgia', serif;
+    margin: 0px auto;
+    width: 740px;
+    font-size: 16px;
+    padding: 40px 25px;
+    line-height: 1.2;
+    border-right: 5px solid #eee;
+    border-left: 5px solid #eee;
+}
+
+div.homelink a {
+    display: block;
+    position: absolute;
+    height: 128px;
+    width: 125px;
+    margin-top: -8px;
+    margin-left: 602px;
+    text-decoration: none;
+}
+
+div.homelink a:hover {
+    background: transparent;
+}
+
+div.homelink a span {
+    display: none;
+}
+
+img {
+    border: none;
+}
+
+a {
+    color: #666;
+}
+
+p {
+    margin: 10px 0;
+    text-align: justify;
+}
+
+a:hover {
+    color: #f37a21;
+    background: #f7efe1;
+}
+
+h1, h2, h3 {
+    font-variant: small-caps;
+    font-weight: normal;    
+}
+
+h2 { font-size: 32px; margin: 15px 0 0 -15px; color: #333; }
+h3 { font-size: 24px; margin: 15px 0 0 -15px; }
+
+abbr {
+    font-variant: small-caps;
+    text-transform: lowercase;
+    letter-spacing: 0.05em;
+}
+
+var {
+    font-variant: small-caps;
+    text-transform: lowercase;
+    font-style: normal;
+    letter-spacing: 0.05em;
+}
+
+pre, tt, code, samp {
+    font-family: 'Consolas', 'Monaco', 'Bitstream Vera Sans Mono', monospace;
+}
+
+tt, code, samp {
+    font-size: 13px;
+}
+
+pre {
+    margin: 20px 0;
+    line-height: 1.3;
+    font-size: 13px;
+}
+
+blockquote {
+    margin: 10px 0 10px 30px;
+    padding: 0;
+    color: #333;
+}
+
+blockquote blockquote {
+    color: #666;
+}
+
+blockquote blockquote blockquote {
+    color: #999;
+}
+
+div.header {
+    text-align: left;
+    height: 150px;
+}
+
+div.contents {
+    padding: 0 0 0 15px;
+}
+
+div.header h1 {
+    margin: 0 0 15px 0;
+    font-size: 31px;
+    color: #333;
+    max-width: 500px;
+}
+
+div.header p.navigation {
+    margin: 5px 2px;
+    color: #bbb;
+    font-size: 15px;
+}
+
+div.header p.navigation a {
+    text-decoration: none;
+    font-variant: small-caps;
+    text-transform: lowercase;
+}
+
+div.header p.navigation a:hover {
+    text-decoration: underline;
+}
+
+div.entry {
+    padding: 10px 10px 10px 0;
+}
+
+div.entry p,
+div.entry li,
+div.entry dl dd,
+div.entry dl dt {
+    line-height: 1.4;
+}
+
+div.entry dl dd {
+    margin: 0 0 0 30px;
+    padding: 0;
+}
+
+div.entry li p {
+    line-height: 1.2;
+}
+
+div.entry h3 {
+    margin: 0 0 0 -15px;
+}
+
+div.entry h3 a {
+    color: #333;
+    text-decoration: none;
+}
+
+div.entry h3 a:hover {
+    color: #f37a21;
+    background: #f7efe1;
+    border-bottom: 1px solid #f79a00;
+}
+
+div.entry p.meta {
+    font-size: 14px;
+    margin: 3px 0;
+    color: #666;
+}
+
+div.entry p.related {
+    margin: 15px 0;
+    font-size: 14px;
+    text-align: right;
+}
+
+div.entry h2 {
+    margin: 0 0 0 -15px;
+}
+
+div.entry h3 {
+    color: #111;
+    font-size: 26px;
+    margin: 10px 0 10px -10px;
+}
+
+div.entry h4 {
+    color: #111;
+    font-size: 18px;
+    margin: 10px 0 10px -10px;
+}
+
+div.entry h5 {
+    color: #111;
+    font-size: 18px;
+    margin: 10px 0;
+}
+
+div.entry + div.entry {
+    padding-top: 30px;
+    background: url(ruler.png) no-repeat center 0;
+}
+
+form.comments {
+    margin: 0;
+}
+
+form.comments dl {
+    margin: 0;
+    padding: 0;
+}
+
+form.comments dl dd {
+    padding: 5px 0;
+    margin: 0;
+}
+
+form.comments dl dt {
+    padding: 5px 0 0 0;
+    margin: 0;
+    font-size: 14px;
+    color: #666;
+}
+
+form.comments textarea {
+    margin: 5px 0;
+}
+
+ol#comments {
+    margin: 0 0 0 25px;
+    color: #f37a21;
+    font-weight: bold;
+    padding: 0;
+}
+
+ol#comments li {
+    margin: 10px 0 30px 0;
+    padding: 0;
+}
+
+ol#comments li li {
+    margin: 10px 0;
+}
+
+ol#comments p {
+    margin: 0;
+    padding: 0;
+}
+
+ol#comments div.text {
+    color: black;
+    font-weight: normal;
+}
+
+ol#comments div.text p {
+    margin: 10px 0 0 0;
+}
+
+ol#comments p.meta {
+    color: #666;
+    text-align: right;
+    font-size: 14px;
+    font-weight: normal;
+    margin: 10px 0 0 0;
+    padding: 0;
+}
+
+ol#comments li div.blocked {
+    margin: -4px -8px -4px -40px;
+    padding: 2px 8px 12px 40px;
+    background: #eee;
+}
+
+#comment-message {
+    margin: 10px 0;
+    font-size: 14px;
+    color: #888;
+}
+
+div.pagination {
+    font-size: 14px;
+    text-align: right;
+}
+
+table.standalone {
+    margin: 10px 0 10px 0;
+    border: 1px solid #aaa;
+    border-collapse: collapse;
+}
+
+table.standalone th {
+    background: #eee;
+    font-variant: small-caps;
+    padding: 2px 5px;
+    border-bottom: 1px solid black;
+}
+
+table.standalone td {
+    padding: 2px 5px;
+}
+
+div.tag-cloud {
+    margin: 20px 0;
+    font-size: 12px;
+    text-align: justify;
+    line-height: 240%;
+}
+
+div.tag-cloud a {
+    padding: 2px 10px;
+    text-decoration: none;
+}

File templates/404.html

+{% extends "layout.html" %}
+{% block title %}{{ _("Page Not Found") }}{% endblock %}
+{% block contents %}
+  <h2>{{ _("Page Not Found") }}</h2>
+  <p>Sorry, but the page you requested was not found on this server.</p>
+{#  <p>
+    I've recently revised my website.  While it is my goal for nothing to get
+    lost, you may have found a page that was mis-placed.  Check your URL to
+    ensure you have gone where you intended.  If everything looks OK and you
+    still see this error page, please consider
+    <a href="mailto:armin.ronacher@active-4.com">sending an e-mail to me</a>.
+  </p> #}
+  <h3>Places of interest</h3>
+  <ul>
+    <li><a href="/">the index page</a></li>
+{#    <li><a href="/projects/">my projects</a></li> #}
+    <li><a href="/about">about me</a></li>
+  </ul>
+{% endblock %}

File templates/_comment.html

+{% macro render_comment(comment, add_reply_link=false) %}
+  {%- if comment.visible %}
+    <div class="comment{% if comment.is_pingback %} pingback{% endif %}{%
+      if comment.blocked %} blocked{% endif %}" id="comment-{{ comment.id }}">
+      <div class="text">{{ comment.body }}</div>
+      <p class="meta">—  {% if comment.is_pingback %}pinged{% endif %}
+        {% if comment.www %}<a rel="nofollow" href="{{ comment.www|e }}">{{ comment.author|e
+        }}</a>{% else %}{{ comment.author|e }}{% endif %} on {{
+        comment.pub_date|datetimeformat }} 
+        <a href="#comment-{{ comment.id }}">#</a>
+      {%- if add_reply_link %}
+        - <a href="javascript:Zine.replyToComment({{ comment.id
+          }})" title="{{ _('reply to this comment') }}">re</a>
+      {% endif -%}
+      </p>
+    </div>
+  {%- endif %}
+{%- endmacro %}
+
+{% macro render_comments(post) %}
+  {%- if cfg.use_flat_comments %}
+    <ol id="comments">
+    {%- for comment in post.visible_comments %}
+      <li class="comment">{{ render_comment(comment) }}</li>
+    {%- else %}
+      {# invisble LI to make validators happy.  We do not omit the
+         list itself because javascript might still want to reference it. #}
+      <li style="display: none"></li>
+    {%- endfor %}
+    </ol>
+  {%- else %}
+    <ul id="comments">
+    {%- for comment in post.visible_root_comments recursive %}
+      <li class="comment">
+        {{ render_comment(comment, post.comments_enabled) }}
+        {%- if comment.visible_children %}
+          <ul class="sub_comments">{{ loop(comment.visible_children) }}</ul>
+        {%- endif %}
+      </li>
+    {%- else %}
+      {# invisble LI to make validators happy.  We do not omit the
+         list itself because javascript might still want to reference it. #}
+      <li style="display: none"></li>
+    {%- endfor %}
+    </ul>
+  {%- endif %}
+{% endmacro %}
+
+{% macro render_comment_editor(post, form) %}
+  {%- call form(class='comments') %}
+    {{ emit_event('before-comment-editor-rendered', post) }}
+    {%- if not form.small_form %}
+    <dl>
+      {{ form.author.as_dd() }}
+      {{ form.email.as_dd() }}
+      {{ form.www.as_dd() }}
+    </dl>
+    {%- endif %}
+    <div>{{ form.body() }}{{ form.parent() }}</div>
+    <div id="comment-message">{# used for the reply callback #}</div>
+    {{ emit_event('before-comment-editor-buttons-rendered', post) }}
+    <div class="actions">
+      <input type="submit" value="{{ _('Submit Comment') }}">
+      <input type="reset" value="{{ _('Reset Form') }}">
+    </div>
+    {{ emit_event('after-comment-editor-rendered', post) }}
+  {%- endcall %}
+{% endmacro %}

File templates/_widgets.html

+{{ widgets.latest_posts(show_title=true) }}
+{{ widgets.post_archive_summary('months', 6, show_title=true) }}
+{% if request.user.is_manager %}
+<h3>{{ _('Administration') }}</h3>
+<p>
+  {% trans username=request.user.username|e %}logged in as {{ username }}.{% endtrans %}
+  <a href="{{ url_for('admin/index')|e }}">{{ _('go to admin panel') }}</a>
+</p>
+{% endif %}

File templates/admin/configure_vessel_theme.html

+{% extends "admin/layout.html" %}
+{% block title %}{{ _("Configure Vessel Theme") }}{% endblock %}
+{% block contents %}
+  <h1>{{ _("Configure Vessel Theme") }}</h1>
+  <p>{% trans %}
+    This theme comes with various color variations you can choose from.
+  {% endtrans %}
+  {%- call form() %}
+    {{ form.as_dl() }}
+    <div class="actions">
+      <input type="submit" name="save" value="{{ _('Save') }}">
+      <input type="submit" name="cancel" value="{{ _('Cancel') }}">
+    </div>
+  {%- endcall %}
+{% endblock %}

File templates/archive.html

+{% extends "layout.html" %}
+{% block title %}{{ _("Archive") }}{% endblock %}
+{% block contents %}
+  {%- if month_list %}
+    <h2>{% trans %}Archive{% endtrans %}</h2>
+    <ul>
+    {%- for item in months %}
+      <li><a href="{{ url_for('blog/archive', year=item.year,
+        month=item.month)|e }}">{{ item|monthformat }}</a></li>
+    {%- else %}
+      <li><em>{{ _("empty archive") }}</em></li>
+    {%- endfor %}
+    </ul>
+    <h3>Tags</h3>
+    {{ widgets.tag_cloud() }}
+  {%- else -%}
+    {%- if not month %}
+      <h2>{% trans year %}Archive for {{ year }}{% endtrans %}</h2>
+    {%- elif not day %}
+      <h2>{% trans month=date|monthformat %}Archive for {{ month }}{% endtrans %}</h2>
+    {%- else %}
+      <h2>{% trans day=date|dateformat('full') %}Archive for {{ day }}{% endtrans %}</h2>
+    {%- endif %}
+    <ul>
+    {%- for post in posts %}
+      <li><a href="{{ url_for(post)|e }}">{{ post.title|e }}</a>,
+          <small>{{ post.pub_date|datetimeformat }}</small></li>
+    {%- endfor %}
+    </ul>
+    {%- if pagination.necessary %}
+    <div class="pagination">
+      {{ pagination.generate() }}
+    </div>
+    {%- endif %}
+  {%- endif %}
+{% endblock %}

File templates/layout.html

+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html>
+<head>
+<title>{% block title %}{% endblock %} &raquo; {{ cfg.blog_title|e }}</title>
+{# <link rel="openid.server" href="http://www.myopenid.com/server"> #}
+{# <link rel="openid.delegate" href="http://mitsuhiko.myopenid.com/"> #}
+<link rel="stylesheet" type="text/css" href="{{ shared_url('pythonic_theme::style.css') }}">
+{{ get_page_metadata() }}
+</head>
+
+<div class="header">
+  <div class="homelink"><a href="{{ url_for('blog/index') }}" title="go home"><span>back to the index</span></a></div>
+  <h1>{{ cfg.blog_title|e }}</h1>
+  <p class="navigation">
+    <a href="{{ url_for('blog/index') }}">Index</a> //
+    <a href="{{ url_for('blog/archive') }}">Archive</a> //
+    {# <a href="{{ url_for('blog/post', slug='projects/') }}">Projects</a> // #}
+    <a href="{{ url_for('blog/post', slug='about') }}">About</a>
+</div>
+<div class="contents">
+  {{ emit_event('before-contents-rendered') }}
+  {% block contents %}{% endblock %}
+  {{ emit_event('after-contents-rendered') }}
+</div>
+</html>

File templates/show_tag.html

+{% extends "layout.html" %}
+{% block title %}{% trans tag=tag.name|e %}Show “{{ tag }}”{% endtrans %}{% endblock %}
+{% block contents %}
+  <h2>{% trans tag=tag.name|e %}Entries tagged “{{ tag }}”{% endtrans %}</h2>
+  <p>
+    The following blog entries are tagged “{{ tag.name|e }}”.  For a complete list of
+    posts go back to the <a href="{{ url_for('blog/archive') }}">archive</a>.
+  <ul>
+  {%- for post in posts %}
+    <li><a href="{{ url_for(post)|e }}">{{ post.title|e }}</a>,
+        <small>{{ post.pub_date|datetimeformat }}</small></li>
+  {%- endfor %}
+  </ul>
+  {%- if pagination.necessary %}
+  <div class="pagination">
+    {{ pagination.generate() }}
+  </div>
+  {%- endif %}
+{% endblock %}