diff options
Diffstat (limited to 'bn_django')
-rw-r--r-- | bn_django/git_wiki/templates/git_wiki/item.html | 26 | ||||
-rw-r--r-- | bn_django/git_wiki/views.py | 15 | ||||
-rw-r--r-- | bn_django/templates/comments/form.html | 2 | ||||
-rw-r--r-- | bn_django/templates/comments/freeform.html | 2 |
4 files changed, 27 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 }} » <a href="/k/{{ item.slug }}/"> {{ item.path }}</a>{% endblock %} -{% block title %}Knowledge Item: {{ item.path }}{% endblock %} +{% block title %}{% endblock %} {% block gitwiki %} - {{ item.contents|restructuredtext }} + +{{ 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 %} |