Title:Sample reStructuredText CEP Template
Last-Modified:2008-08-10 07:59:20 -0600 (Sun, 10 Aug 2008)
Author:William Hart



This CEP provides a boilerplate or sample template for creating your own reStructuredText CEPs. In conjunction with the content guidelines in CEP 1 [1], this should make it easy for you to conform your own CEPs to the format outlined below.

Note: if you are reading this CEP via the web, you should first grab the text (reStructuredText) source of this CEP in order to complete the steps below. DO NOT USE THE HTML FILE AS YOUR TEMPLATE!

To get the source this (or any) CEP, look at the top of the HTML page and click on the date & time on the "Last-Modified" line. It is a link to the source text in the Coopr repository.

If you would prefer not to use markup in your CEP, please see CEP 2, "Sample Plaintext CEP Template" [2].


CEP submissions come in a wide variety of forms, not all adhering to the format guidelines set forth below. Use this template, in conjunction with the format guidelines below, to ensure that your CEP submission won't get automatically rejected because of form.

ReStructuredText is offered as an alternative to plaintext CEPs, to allow CEP authors more functionality and expressivity, while maintaining easy readability in the source text. The processed HTML form makes the functionality accessible to readers: live hyperlinks, styled text, tables, images, and automatic tables of contents, among other advantages.

How to Use This Template

To use this template you must first decide whether your CEP is going to be an Informational or Standards Track CEP. Most CEPs are Standards Track because they propose a new feature for Coopr. When in doubt, read CEP 1 for details or contact the CEP editors <coopr-admin@googlegroups.com>.

Once you've decided which type of CEP yours is going to be, follow the directions below.

ReStructuredText CEP Formatting Requirements

The following is a CEP-specific summary of reStructuredText syntax. For the sake of simplicity and brevity, much detail is omitted. For more detail, see Resources below. Literal blocks (in which no markup processing is done) are used for examples throughout, to illustrate the plaintext markup.


You must adhere to the Emacs convention of adding two spaces at the end of every sentence. You should fill your paragraphs to column 70, but under no circumstances should your lines extend past column 79. If your code samples spill over column 79, you should rewrite them.

Tab characters must never appear in the document at all. A CEP should include the standard Emacs stanza included by example at the bottom of this CEP.

Section Headings

CEP headings must begin in column zero and the initial letter of each word must be capitalized as in book titles. Acronyms should be in all capitals. Section titles must be adorned with an underline, a single repeated punctuation character, which begins in column zero and must extend at least as far as the right edge of the title text (4 characters minimum). First-level section titles are underlined with "=" (equals signs), second-level section titles with "-" (hyphens), and third-level section titles with "'" (single quotes or apostrophes). For example:

First-Level Title

Second-Level Title

Third-Level Title

If there are more than three levels of sections in your CEP, you may insert overline/underline-adorned titles for the first and second levels as follows:

First-Level Title (optional)

Second-Level Title (optional)

Third-Level Title

Fourth-Level Title

Fifth-Level Title

You shouldn't have more than five levels of sections in your CEP. If you do, you should consider rewriting it.

You must use two blank lines between the last line of a section's body and the next section heading. If a subsection heading immediately follows a section heading, a single blank line in-between is sufficient.

The body of each section is not normally indented, although some constructs do use indentation, as described below. Blank lines are used to separate constructs.


Paragraphs are left-aligned text blocks separated by blank lines. Paragraphs are not indented unless they are part of an indented construct (such as a block quote or a list item).

Inline Markup

Portions of text within paragraphs and other text blocks may be styled. For example:

Text may be marked as *emphasized* (single asterisk markup,
typically shown in italics) or **strongly emphasized** (double
asterisks, typically boldface).  ``Inline literals`` (using double
backquotes) are typically rendered in a monospaced typeface.  No
further markup recognition is done within the double backquotes,
so they're safe for any kind of code snippets.

Block Quotes

Block quotes consist of indented body elements. For example:

This is a paragraph.

    This is a block quote.

    A block quote may contain many paragraphs.

Block quotes are used to quote extended passages from other sources. Block quotes may be nested inside other body elements. Use 4 spaces per indent level.

Literal Blocks

Literal blocks are used for code samples or preformatted ASCII art. To indicate a literal block, preface the indented text block with "::" (two colons). The literal block continues until the end of the indentation. Indent the text block by 4 spaces. For example:

This is a typical paragraph.  A literal block follows.


    for a in [5,4,3,2,1]:   # this is program code, shown as-is
        print a
    print "it's..."
    # a literal block continues until the indentation ends

The paragraph containing only "::" will be completely removed from the output; no empty paragraph will remain. "::" is also recognized at the end of any paragraph. If immediately preceded by whitespace, both colons will be removed from the output. When text immediately precedes the "::", one colon will be removed from the output, leaving only one colon visible (i.e., "::" will be replaced by ":"). For example, one colon will remain visible here:


    Literal block


Bullet list items begin with one of "-", "*", or "+" (hyphen, asterisk, or plus sign), followed by whitespace and the list item body. List item bodies must be left-aligned and indented relative to the bullet; the text immediately after the bullet determines the indentation. For example:

This paragraph is followed by a list.

* This is the first bullet list item.  The blank line above the
  first list item is required; blank lines between list items
  (such as below this paragraph) are optional.

* This is the first paragraph in the second item in the list.

  This is the second paragraph in the second item in the list.
  The blank line above this paragraph is required.  The left edge
  of this paragraph lines up with the paragraph above, both
  indented relative to the bullet.

  - This is a sublist.  The bullet lines up with the left edge of
    the text blocks above.  A sublist is a new list so requires a
    blank line above and below.

* This is the third item of the main list.

This paragraph is not part of the list.

Enumerated (numbered) list items are similar, but use an enumerator instead of a bullet. Enumerators are numbers (1, 2, 3, ...), letters (A, B, C, ...; uppercase or lowercase), or Roman numerals (i, ii, iii, iv, ...; uppercase or lowercase), formatted with a period suffix ("1.", "2."), parentheses ("(1)", "(2)"), or a right-parenthesis suffix ("1)", "2)"). For example:

1. As with bullet list items, the left edge of paragraphs must

2. Each list item may contain multiple paragraphs, sublists, etc.

   This is the second paragraph of the second list item.

   a) Enumerated lists may be nested.
   b) Blank lines may be omitted between list items.

Definition lists are written like this:

    Definition lists associate a term with a definition.

    The term is a one-line phrase, and the definition is one
    or more paragraphs or body elements, indented relative to
    the term.


Simple tables are easy and compact:

=====  =====  =======
  A      B    A and B
=====  =====  =======
False  False  False
True   False  False
False  True   False
True   True   True
=====  =====  =======

There must be at least two columns in a table (to differentiate from section titles). Column spans use underlines of hyphens ("Inputs" spans the first two columns):

=====  =====  ======
   Inputs     Output
------------  ------
  A      B    A or B
=====  =====  ======
False  False  False
True   False  True
False  True   True
True   True   True
=====  =====  ======

Text in a first-column cell starts a new row. No text in the first column indicates a continuation line; the rest of the cells may consist of multiple lines. For example:

=====  =========================
col 1  col 2
=====  =========================
1      Second column of row 1.
2      Second column of row 2.
       Second line of paragraph.
3      - Second column of row 3.

       - Second item in bullet
         list (row 3, column 2).
=====  =========================


Footnote references consist of a left square bracket, a number, a right square bracket, and a trailing underscore:

This sentence ends with a footnote reference [1]_.

Whitespace must precede the footnote reference. Leave a space between the footnote reference and the preceding word.

When referring to another CEP, include the CEP number in the body text, such as "CEP 1". The title may optionally appear. Add a footnote reference following the title. For example:

Refer to CEP 1 [2]_ for more information.

Add a footnote that includes the CEP's title and author. It may optionally include the explicit URL on a separate line, but only in the References section. Footnotes begin with ".. " (the explicit markup start), followed by the footnote marker (no underscores), followed by the footnote body. For example:


.. [1] CEP 1, "CEP Purpose and Guidelines", Hart

If you decide to provide an explicit URL for a CEP, please use this as the URL template:


CEP numbers in URLs must be padded with zeros from the left, so as to be exactly 4 characters wide, however CEP numbers in the text are never padded.

During the course of developing your CEP, you may have to add, remove, and rearrange footnote references, possibly resulting in mismatched references, obsolete footnotes, and confusion. Auto-numbered footnotes allow more freedom. Instead of a number, use a label of the form "#word", where "word" is a mnemonic consisting of alphanumerics plus internal hyphens, underscores, and periods (no whitespace or other characters are allowed). For example:

Refer to CEP 1 [#CEP-1]_ for more information.


.. [#CEP-1] CEP 1, "CEP Purpose and Guidelines", Hart


Footnotes and footnote references will be numbered automatically, and the numbers will always match. Once a CEP is finalized, auto-numbered labels should be replaced by numbers for simplicity.


If your CEP contains a diagram, you may include it in the processed output using the "image" directive:

.. image:: diagram.png

Any browser-friendly graphics format is possible: .png, .jpeg, .gif, .tiff, etc.

Since this image will not be visible to readers of the CEP in source text form, you should consider including a description or ASCII art alternative, using a comment (below).


A comment block is an indented block of arbitrary text immediately following an explicit markup start: two periods and whitespace. Leave the ".." on a line by itself to ensure that the comment is not misinterpreted as another explicit markup construct. Comments are not visible in the processed document. For the benefit of those reading your CEP in source form, please consider including a descriptions of or ASCII art alternatives to any images you include. For example:

.. image:: dataflow.png

   Data flows from the input module, through the "black box"
   module, and finally into (and through) the output module.

The Emacs stanza at the bottom of this document is inside a comment.

Escaping Mechanism

reStructuredText uses backslashes ("\") to override the special meaning given to markup characters and get the literal characters themselves. To get a literal backslash, use an escaped backslash ("\\"). There are two contexts in which backslashes have no special meaning: literal blocks and inline literals (see Inline Markup above). In these contexts, no markup recognition is done, and a single backslash represents a literal backslash, without having to double up.

If you find that you need to use a backslash in your text, consider using inline literals or a literal block instead.

Habits to Avoid

Many programmers who are familiar with TeX often write quotation marks like this:

`single-quoted' or ``double-quoted''

Backquotes are significant in reStructuredText, so this practice should be avoided. For ordinary text, use ordinary 'single-quotes' or "double-quotes". For inline literal text (see Inline Markup above), use double-backquotes:

``literal text: in here, anything goes!``


Many other constructs and variations are possible. For more details about the reStructuredText markup, in increasing order of thoroughness, please see:

The processing of reStructuredText CEPs is done using Docutils [3]. If you have a question or require assistance with reStructuredText or Docutils, please post a message [4] to the Docutils-users mailing list [5]. The Docutils project web site [3] has more information.


[1]CEP 1, CEP Purpose and Guidelines, Hart (http://www.coin-or.org/Coopr/ceps/cep-0001.html)
[2]CEP 2, Sample Plaintext CEP Template, Hart (http://www.coin-or.org/Coopr/ceps/cep-0002.html)
[3](1, 2) http://docutils.sourceforge.net/