Django Wiki Part 2
Published on May 31, 2007Building on the simple wikitags parser I wrote about earlier I'm now trying to build an application around that template tag.
A basic wiki should the following features:
- Give the user the ability to create and edit pages.
- Recent versions of a page should be stored to help see what has been changed and to mitigate the effects of spam.
- The syntax of the markup/formatting language should be simple and allow easy linking, especially internal linking.
- Have the ability to contain static pages
The django.views.generic.create_update module looks like the obvious choice to use for creating/editing pages but the basic structure will be something like this.
Read MoreBreak page template tag
Published on May 31, 2007Just looking over some of the posts here I realised that many of them are very long. Django's template system will let you truncate a piece of text using the truncatewords:N tag but this often is not what you want.
For this site if i decide to truncate all my posts at say 200 words then it is possible that a <code> or <p> tag will be left open, which will mess up the appearance of the page.
It would be nicer if I could just tell the template system where to break my post so that bad things don't happen or that a post is broken with only a few words to go.
This little piece of code should implement this, breaking the page when it finds BREAKHERE on it's own on a line.
Read MoreCSS for displaying code snippets in <pre> tags
Published on May 28, 2007I just had a look at this site using IE and was a bit shocked at how it looked. It was a disgrace! I use FF almost exclusivly except for sites in work which only work in IE and I use kubuntu on my laptop at home so I have never really tested the site in IE. The problem was code inside <code> tags which screwed up the widths of the divs in the page. (Everything inside <code> tags is also inside <pre> tags) I could of course go back and edit all the posts to shorten the lines but I found this which sorts out all the problems.
pre {
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
}
Read More


