scribe : documentation

Customizing Scribe

This document describes Scribe version 0.60. For current documentation, go here.

This document will help explain how to customize the look and feel of Scribe.

Appearance

Style Sheets

Most appearance customization of Scribe can be done via CSS style sheets. We recommend this for users who don’t really want to quickly change the look of Scribe but don’t want to change the layout of the page too much.

The following style sheets are included with Scribe:

Style Sheet Name Usage
scribe.css Included on all pages.
forms.css Included on all pages with forms.
admin.css Included on all administrative pages.
code.css Included on all pages.

You can look through the HTML and CSS and modify colors and layout to the extent that is possible with CSS. If this is not sufficient for you, you can modify the templates that Scribe defines and create your own setup.

Templates

Additional configuration can be done by changing templates. The following table shows the different templates that Scribe uses and what variables each template receives. Each template is explained in more detail later.

Template Name Variables
article.html article, comment_preview, comment_created, comment_form
article_snippet.html article, short
article_snippet.xml article
base.html  
comment.email comment, host
comment-snippet.html comment
feed.xml articles, origlink
list.html paginator, short, feedlink
sidebar/sidebar.html sidebar

In addition, there are templates for the administrative pages, but it is rare that you will want to modify those.

article.html

Variables: article, comment_preview, comment_created, comment_form

This template is used to render articles when they are viewed independently. It should include a comment form for people to post comments.

Note: The comment_preview and comment_created variables are both actual comment objects (or None).

article_snippet.html

Variables: article, short

This template is used to render articles when they are viewed independently or in a list. It is simply the output of the article. The variable short will be set to True if the article is in a list. Generally, when short is True, you shouldn’t output the article’s extended content.

article_snippet.xml

Variables: article

This template is used to render articles when they are viewed on a feed. This exists because feed.xml uses it. feed.xml is the only template that uses it, so it it may not exist in a future version.

base.html

All other templates extend this template. Modifying it will allow you to change the style of your blog quickly to match your current site design.

comment.email

Variables: comment, host

This is the text that will be sent when a comment is posted on an article. It will be sent to the person who wrote the article. The host variable gives quick access to the name of the site Scribe is running on.

Note: Whitespace is significant in this template.

comment-snippet.html

Variables: comment

This template is for rendering an individual comment.

feed.xml

Variables: articles, origlink

This template is used to create the syndication feeds. articles is a list of articles, origlink is the web page the syndication feed is for.

list.html

Variables: paginator, short, feedlink

This template is used to render any list of articles. The paginator knows which articles are on the current page and how many pages there are. feedlink is defined if there is a syndication feed for this list. short is always True for lists (and might be removed in a future version of Scribe).

Functionality

Preferences

The following table outlines the different preferences that are available in Scribe. They are explained in more detail below.

Variable Type Default Value
BLOG_TITLE String 'My new weblog'
TEMPLATE_DIR String ''
STYLESHEETS_BASE String '/scribemedia/stylesheets'
ARTICLES_PER_PAGE Integer 5
ARTICLES_ON_FEED Integer 10
SPAMFILTER String None
TEXTPROCESSOR String 'markdown'
USER_CLASS Model django.contrib.auth.models.User
LOGIN_REQUIRED View Decorator scribe.conf.glogal_settings.login_required
LOGOUT View Decorator scribe.conf.glogal_settings.logout
VIEW_DECORATOR View Decorator None

BLOG_TITLE

This is used in templates everywhere the name of your weblog appears.

TEMPLATE_DIR

This should be set to the relative directory in which your templates reside.

For example, if you want Scribe to look for your templates in a subdirectory called blog, you would set TEMPLATE_DIR = 'blog/'. Changing the template directory means that you will have to copy the default templates to that directory or write a complete new set of templates.

(Note: This directory should be a directory within one of the directories in your Django TEMPLATE_DIRS list.)

STYLESHEETS_BASE

This should be set to the base location at which your style sheets are located.

Examples:

STYLESHEETS_BASE = '/media/stylesheets/' # hosted on the same server
STYLESHEETS_BASE = 'http://media.fadingred.org/stylesheets/' # hosted on a different server

ARTICLES_PER_PAGE

The number of articles displayed per page.

ARTICLES_ON_FEED

The number of articles displayed in news (RSS) feeds.

SPAMFILTER

The name of the spam-filter plugin used. This name should be in all lowercase. See the spam-filter page for more information.

TEXTPROCESSOR

The name of the text-processor plugin used. This name should be in all lowercase. The default is markdown, which comes prepackaged with Scribe. See the text-processor page for more information.

USER_CLASS

For those users who want to customize how users log in and out of Scribe, they can customize the user class that is used. The user class must be a Django model, and it must be stored in the request object when a user is logged in (request.user should yield the currently logged in user).

Unless you have a real need to change this (to integrate with your current user infrastructure, for example), we recommend that you leave it as its default.

LOGIN_REQUIRED

You will most likely only want to change this preference if you changed the USER_CLASS preference. It is the decorator that is used on all administrative pages.

LOGOUT

Like the LOGIN_REQUIRED preference, you’ll probably only want to change this if you changed the USER_CLASS preference. It is the function that is called to log a user out. It also handles redirecting the user to a valid page.

VIEW_DECORATOR

This decorator is added to every view within Scribe. If it is defined, it will be used, and you can modify all views or just about any view to your liking. Scribe uses a RenderingHttpResponse that allows you access to the template_name, dictionary, and context_instance attributes that will later be used to render the view. This gives you full control over what variables or what templates Scribe will render.

Plugins

Writing plugins for Scribe can give you a lot of control over what Scribe is doing. For more information, see the plugin pages:

Questions/Feedback

If you notice errors with this documentation, please open a ticket and let us know!