reStructuredText: Plain Text Gets Superpowers

rST.gif

Quit Scribbling Notes

Slides at http://catherinedevlin.pythoneers.com

Outlines are boring

The Concept

Or, Why You Are Here

twofeet.jpg

Kathy Sierra

rtfm.jpg
License: Creative Commons Attribution 2.0 Generic

Problem

Nobody uses your (favorite) stuff

Reason

Your docs stink

Python web frameworks

Reason2

Programming is a labor of love

You hate writing docs

Solution

You used to hate writing docs

Stylesheet revolution

Separate Presentation from content

Where's our revolution?

les-miserables.jpg

To create a document

stovepipe.png

Classic workflow

workflow-old.bmp

reStructuredText

  Plain-text conventions
+ conversion programs
------------------------
  pretty much anything

Flexible, formatted results from simple plaintext

Expert help available

yourface.jpeg

example

==================================
My Amiga is better than your Atari
==================================

The Amiga 2000 is the *most powerful*
computer you can imagine.  It is the **ULTIMATE**!

Specs
-----

========= ==============
RAM       512 KB
CPU speed 7.14 MHz
display   640x400 pixels
========= ==============

Workflow with reStructuredText

workflow-rst.bmp

Plain-text rocks anyway

What about LaTeX?

\title{My Amiga is better than your Atari%
  \phantomsection%
  \label{my-amiga-is-better-than-your-atari}}

The Amiga 2000 is the \emph{most powerful}
computer you can imagine.  It is the \textbf{ULTIMATE}!

\section*{Specs%
  \phantomsection%
  \addcontentsline{toc}{section}{Specs}%
  \label{specs}%
}

"I still prefer LaTeX"

Fine, be that way.

How flexible?

Separate installs

Advanced stuff

Also recognized by

Let's do this

Quick reST Syntax

It came from Python

eeek.jpg

David Goodger, maker of reStructuredText

Tools & Installation

installation.jpg

Editor support

WYSIWYG Editors

Installation

aptitude install python-dev / yum install python-devel
http://pypi.python.org/pypi/setuptools
easy_install -UZ docutils

easy_install -UZ sphinx
easy_install -UZ rst2pdf rst2man

Editor installation

Crunchy
download, unzip
Enthought Tool Suite
aptitude install python-numeric python-qt4
easy_install -U TraitsBackendQt[nonets] AppTools[nonets]

Consider Enthought Python Distribution

rst2a.com: no-install alternative

rst2a.png

Sphinx

Creates advanced documentation tree.

  1. sphinx-quickstart
  2. fill out toctree (Table of Contents)
  3. Write .rst docs for the contents
  4. make html or sphinx-build

Customization

customized.jpg
License: Creative Commons Attribution 2.0 Generic

Styles

style.jpg bananarepublic.jpg cardigan.jpg

Styles

rst2html --stylesheet=

rst2pdf --stylesheets=

rst2s5 --theme-url=ui/mytheme (edit ui/mytheme/pretty.css)

rst2odt --stylesheet=

Sphinx themes

In conf.py:

http://sphinx.pocoo.org/theming.html

Custom Roles

.. role:: weird (emphasis)
   :class: crazy

That reST talk was :weird:`interesting`.

.crazy {color: green; font-family: cursive;}

That reST talk was interesting.

Code-based customization

Your own reST-based tools

Go write

Document your code

Document other people's code

Write your mom

mom.png
License: Creative Commons Attribution 2.0 Generic

Questions?