aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbnewbold <bnewbold@manus.(none)>2007-03-04 16:43:26 -0800
committerbnewbold <bnewbold@manus.(none)>2007-03-04 16:43:26 -0800
commitcf804de463c83bfe11aba3576be2ccdd34443fd1 (patch)
tree56d9a8370eb0739be7927798080cf8b6f06bcb70
parent5b8d6138d3544ce14ad44598fbfbf42fc259865e (diff)
downloadbnewnet-cf804de463c83bfe11aba3576be2ccdd34443fd1.tar.gz
bnewnet-cf804de463c83bfe11aba3576be2ccdd34443fd1.zip
added seperate docutils stylesheet for wiki
-rw-r--r--bn_django/git_wiki/templates/git_wiki/item.html26
-rw-r--r--bn_django/git_wiki/views.py15
-rw-r--r--bn_django/templates/comments/form.html2
-rw-r--r--bn_django/templates/comments/freeform.html2
-rw-r--r--static/style/docutils.css279
5 files changed, 306 insertions, 18 deletions
diff --git a/bn_django/git_wiki/templates/git_wiki/item.html b/bn_django/git_wiki/templates/git_wiki/item.html
index 7562fc6..16d3518 100644
--- a/bn_django/git_wiki/templates/git_wiki/item.html
+++ b/bn_django/git_wiki/templates/git_wiki/item.html
@@ -1,25 +1,29 @@
{% extends "git_wiki/base.html" %}
-{% load markup %}
+{% block stylesheets %}
+{{ block.super }}
+<link rel="STYLESHEET" type="text/css" href="/style/docutils.css" />
+{% endblock %}
{% block path %}{{ block.super }} &raquo; <a href="/k/{{ item.slug }}/">
{{ item.path }}</a>{% endblock %}
-{% block title %}Knowledge Item: {{ item.path }}{% endblock %}
+{% block title %}{% endblock %}
{% block gitwiki %}
- {{ item.contents|restructuredtext }}
+&nbsp;
+{{ doc.html_body }}
<br /><hr />
- <h3>Item name:</h3>
- <span class="hash">{{ item.name }}</span>
- <h3>Item sha1 hash:</h3>
- <span class="hash">{{ item.id }}</span>
- <h3>Raw Contents:</h3>
- <pre class="large">{{ item.contents|escape|wordwrap:80 }}</pre>
-
+ <h3>Meta</h3>
+ <b>Item name:</b>
+ <span class="hash">{{ item.name }}</span><br />
+ <b>Item sha1 hash:</b>
+ <span class="hash">{{ item.id }}</span><br />
<br />
<span class="righty">
- <a href="/k/{{ item.slug }}/pdf/">pdf</a> - <a href="/k/{{ item.slug }}/log">log</a>
+ <a href="/k/{{ item.slug }}/raw/">raw</a> -
+ <a href="/k/{{ item.slug }}/pdf/">pdf</a> -
+ <a href="/k/{{ item.slug }}/log">log</a>
</span>
<br />
{% endblock %}
diff --git a/bn_django/git_wiki/views.py b/bn_django/git_wiki/views.py
index 2e66061..c0681c7 100644
--- a/bn_django/git_wiki/views.py
+++ b/bn_django/git_wiki/views.py
@@ -1,7 +1,7 @@
from django import forms, http, template
from django.contrib.auth.decorators import login_required
from django.shortcuts import get_object_or_404, render_to_response
-from django.http import HttpResponse, Http404
+from django.http import HttpResponse, Http404, HttpResponseServerError
import os, commands
@@ -42,8 +42,17 @@ def item(request, reqslug, blob=None):
else:
i = blob
i.update()
- return render_to_response('git_wiki/item.html',
- dict(item=i))
+
+ try:
+ from docutils.core import publish_parts
+ except ImportError:
+ if settings.DEBUG:
+ raise HttpResponseServerError(request)
+ else:
+ docutils_settings = getattr(settings, "GITWIKI_REST_SETTINGS", {})
+ parts = publish_parts(source=i.contents, writer_name="html4css1", settings_overrides=docutils_settings)
+ return render_to_response('git_wiki/item.html',
+ dict(item=i,doc=parts))
def olditem(request, hash):
i = get_object_or_404(Item, id=hash)
diff --git a/bn_django/templates/comments/form.html b/bn_django/templates/comments/form.html
index c5aa768..316d6a1 100644
--- a/bn_django/templates/comments/form.html
+++ b/bn_django/templates/comments/form.html
@@ -1,5 +1,4 @@
{% load i18n %}
-{% if display_form %}
<form {% if photos_optional or photos_required %}enctype="multipart/form-data" {% endif %}action="/comments/post/" method="post">
{% if user.is_authenticated %}
@@ -35,4 +34,3 @@
<input type="submit" name="preview" value="{% trans "Preview comment" %}" />
</p>
</form>
-{% endif %}
diff --git a/bn_django/templates/comments/freeform.html b/bn_django/templates/comments/freeform.html
index f0d00b9..95e5153 100644
--- a/bn_django/templates/comments/freeform.html
+++ b/bn_django/templates/comments/freeform.html
@@ -1,5 +1,4 @@
{% load i18n %}
-{% if display_form %}
<form action="/comments/postfree/" method="post">
<p><label for="id_person_name">{% trans "Your name:" %}</label> <input type="text" id="id_person_name" name="person_name" /></p>
<p><label for="id_comment">{% trans "Comment:" %}</label><br /><textarea name="comment" id="id_comment" rows="10" cols="60"></textarea></p>
@@ -10,4 +9,3 @@
<input type="submit" name="preview" value="{% trans "Preview comment" %}" />
</p>
</form>
-{% endif %}
diff --git a/static/style/docutils.css b/static/style/docutils.css
new file mode 100644
index 0000000..3f75dc6
--- /dev/null
+++ b/static/style/docutils.css
@@ -0,0 +1,279 @@
+/*
+:Author: David Goodger
+:Contact: goodger@users.sourceforge.net
+:Date: $Date: 2005-12-18 01:56:14 +0100 (Sun, 18 Dec 2005) $
+:Revision: $Revision: 4224 $
+:Copyright: This stylesheet has been placed in the public domain.
+
+Default cascading style sheet for the HTML output of Docutils.
+
+See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
+customize this style sheet.
+*/
+
+/* used to remove borders from tables and images */
+.borderless, table.borderless td, table.borderless th {
+ border: 0 }
+
+table.borderless td, table.borderless th {
+ /* Override padding for "table.docutils td" with "! important".
+ The right padding separates the table cells. */
+ padding: 0 0.5em 0 0 ! important }
+
+.first {
+ /* Override more specific margin styles with "! important". */
+ margin-top: 0 ! important }
+
+.last, .with-subtitle {
+ margin-bottom: 0 ! important }
+
+.hidden {
+ display: none }
+
+a.toc-backref {
+ text-decoration: none ;
+ color: black }
+
+blockquote.epigraph {
+ margin: 2em 5em ; }
+
+dl.docutils dd {
+ margin-bottom: 0.5em }
+
+/* Uncomment (and remove this text!) to get bold-faced definition list terms
+dl.docutils dt {
+ font-weight: bold }
+*/
+
+div.abstract {
+ margin: 2em 5em }
+
+div.abstract p.topic-title {
+ font-weight: bold ;
+ text-align: center }
+
+div.admonition, div.attention, div.caution, div.danger, div.error,
+div.hint, div.important, div.note, div.tip, div.warning {
+ margin: 2em ;
+ border: medium outset ;
+ padding: 1em }
+
+div.admonition p.admonition-title, div.hint p.admonition-title,
+div.important p.admonition-title, div.note p.admonition-title,
+div.tip p.admonition-title {
+ font-weight: bold ;
+ font-family: sans-serif }
+
+div.attention p.admonition-title, div.caution p.admonition-title,
+div.danger p.admonition-title, div.error p.admonition-title,
+div.warning p.admonition-title {
+ color: red ;
+ font-weight: bold ;
+ font-family: sans-serif }
+
+/* Uncomment (and remove this text!) to get reduced vertical space in
+ compound paragraphs.
+div.compound .compound-first, div.compound .compound-middle {
+ margin-bottom: 0.5em }
+
+div.compound .compound-last, div.compound .compound-middle {
+ margin-top: 0.5em }
+*/
+
+div.dedication {
+ margin: 2em 5em ;
+ text-align: center ;
+ font-style: italic }
+
+div.dedication p.topic-title {
+ font-weight: bold ;
+ font-style: normal }
+
+div.figure {
+ margin-left: 2em ;
+ margin-right: 2em }
+
+div.footer, div.header {
+ clear: both;
+ font-size: smaller }
+
+div.line-block {
+ display: block ;
+ margin-top: 1em ;
+ margin-bottom: 1em }
+
+div.line-block div.line-block {
+ margin-top: 0 ;
+ margin-bottom: 0 ;
+ margin-left: 1.5em }
+
+div.sidebar {
+ margin-left: 1em ;
+ border: medium outset ;
+ padding: 1em ;
+ background-color: #ffffee ;
+ width: 40% ;
+ float: right ;
+ clear: right }
+
+div.sidebar p.rubric {
+ font-family: sans-serif ;
+ font-size: medium }
+
+div.system-messages {
+ margin: 5em }
+
+div.system-messages h1 {
+ color: red }
+
+div.system-message {
+ border: medium outset ;
+ padding: 1em }
+
+div.system-message p.system-message-title {
+ color: red ;
+ font-weight: bold }
+
+div.topic {
+ margin: 2em }
+
+h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
+h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
+ margin-top: 0.4em }
+
+h1.title {
+ text-align: center }
+
+h2.subtitle {
+ text-align: center }
+
+hr.docutils {
+ width: 75% }
+
+img.align-left {
+ clear: left }
+
+img.align-right {
+ clear: right }
+
+ol.simple, ul.simple {
+ margin-bottom: 1em }
+
+ol.arabic {
+ list-style: decimal }
+
+ol.loweralpha {
+ list-style: lower-alpha }
+
+ol.upperalpha {
+ list-style: upper-alpha }
+
+ol.lowerroman {
+ list-style: lower-roman }
+
+ol.upperroman {
+ list-style: upper-roman }
+
+p.attribution {
+ text-align: right ;
+ margin-left: 50% }
+
+p.caption {
+ font-style: italic }
+
+p.credits {
+ font-style: italic ;
+ font-size: smaller }
+
+p.label {
+ white-space: nowrap }
+
+p.rubric {
+ font-weight: bold ;
+ font-size: larger ;
+ color: maroon ;
+ text-align: center }
+
+p.sidebar-title {
+ font-family: sans-serif ;
+ font-weight: bold ;
+ font-size: larger }
+
+p.sidebar-subtitle {
+ font-family: sans-serif ;
+ font-weight: bold }
+
+p.topic-title {
+ font-weight: bold }
+
+pre.address {
+ margin-bottom: 0 ;
+ margin-top: 0 ;
+ font-family: serif ;
+ font-size: 100% }
+
+pre.literal-block, pre.doctest-block {
+ margin-left: 2em ;
+ margin-right: 2em ;
+ background-color: #ffffff; }
+
+span.classifier {
+ font-family: sans-serif ;
+ font-style: oblique }
+
+span.classifier-delimiter {
+ font-family: sans-serif ;
+ font-weight: bold }
+
+span.interpreted {
+ font-family: sans-serif }
+
+span.option {
+ white-space: nowrap }
+
+span.pre {
+ white-space: pre }
+
+span.problematic {
+ color: red }
+
+span.section-subtitle {
+ /* font-size relative to parent (h1..h6 element) */
+ font-size: 80% }
+
+table.citation {
+ border-left: solid 1px gray;
+ margin-left: 1px }
+
+table.docinfo {
+ margin: 2em 4em }
+
+table.docutils {
+ margin-top: 0.5em ;
+ margin-bottom: 0.5em }
+
+table.footnote {
+ border-left: solid 1px black;
+ margin-left: 1px }
+
+table.docutils td, table.docutils th,
+table.docinfo td, table.docinfo th {
+ padding-left: 0.5em ;
+ padding-right: 0.5em ;
+ vertical-align: top }
+
+table.docutils th.field-name, table.docinfo th.docinfo-name {
+ font-weight: bold ;
+ text-align: left ;
+ white-space: nowrap ;
+ padding-left: 0 }
+
+h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
+h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
+ font-size: 100% }
+
+tt.docutils {
+ background-color: #ffffff; }
+
+ul.auto-toc {
+ list-style-type: none }