root/dotorg/trunk/html/beps/bep_0002.rst

Revision 11083, 21.7 KB (checked in by dave, 19 months ago)

Add .html to end of references to BEPs.

Line 
1BEP: 2
2Title: Sample reStructured Text BEP Template
3Version: $Revision$
4Last-Modified: $Date$
5Author:  David Harrison <dave@bittorrent.com>
6Status:  Active
7Type:    Process
8Content-Type: text/x-rst
9Created: 02-Feb-2008
10Post-History:
11
12
13Abstract
14========
15
16This BEP provides a boilerplate or sample template for creating your
17own reStructuredText BEPs.  In conjunction with the content guidelines
18in BEP 1 [#BEP-1]_, this should make it easy for you to conform your own
19BEPs to the format outlined below.
20
21Note: if you are reading this BEP via the web, you should first grab
22the text (reStructuredText) source of this BEP in order to complete
23the steps below.  **DO NOT USE THE HTML FILE AS YOUR TEMPLATE!**
24
25To get the source this (or any) BEP, look at the top of the HTML page
26and click on the date & time on the "Last-Modified" line.  It is a
27link to the source text in the BitTorrent.org subversion repository.
28
29
30Rationale
31=========
32
33BEP submissions come in a wide variety of forms, not all adhering
34to the format guidelines set forth below.  Use this template, in
35conjunction with the format guidelines below, to ensure that your
36BEP submission won't get automatically rejected because of form.
37
38ReStructuredText is offered as an alternative to plaintext BEPs, to
39allow BEP authors more functionality and expressivity, while
40maintaining easy readability in the source text.  The processed HTML
41form makes the functionality accessible to readers: live hyperlinks,
42styled text, tables, images, and automatic tables of contents, among
43other advantages. 
44
45
46How to Use This Template
47========================
48
49To use this template you must first decide whether your BEP is going
50to be an Informational or Standards Track BEP.  Most BEPs are
51Standards Track because they propose a new feature for the BitTorrent
52system including the BitTorrent suite of protocols.  When in doubt,
53read BEP 1 for details or contact the BEP editors
54<editor@bittorrent.org>.
55
56Once you've decided which type of BEP yours is going to be, follow the
57directions below.
58
59- Make a copy of this file (``.rst`` file, **not** HTML!)  and perform
60  the following edits.
61
62- Replace the "BEP: 2" header with "BEP: XXX" since you don't yet have
63  a BEP number assignment.
64
65- Change the Title header to the title of your BEP.
66
67- Leave the Version and Last-Modified headers alone; we'll take care
68  of those when we check your BEP into BitTorrent's Subversion repository.
69  These headers consist of keywords ("Revision" and "Date" enclosed in
70  "$"-signs) which are automatically expanded by the repository.
71  Please do not edit the expanded date or revision text.
72
73- Change the Author header to include your name, and optionally your
74  email address.  Be sure to follow the format carefully: your name
75  must appear first, and it must not be contained in parentheses.
76  Your email address may appear second (or it can be omitted) and if
77  it appears, it must appear in angle brackets.  It is okay to
78  obfuscate your email address.
79
80- If there is a mailing list for discussion of your new feature, add a
81  Discussions-To header right after the Author header.  You should not
82  add a Discussions-To header if the mailing list to be used is
83  bittorrent-list@bittorrent.org, or if discussions should be sent to
84  you directly.  Most Informational BEPs don't have a Discussions-To
85  header.
86
87- Change the Status header to "Draft".
88
89- For Standards Track BEPs, change the Type header to "Standards
90  Track".
91
92- For Informational BEPs, change the Type header to "Informational".
93
94- For Standards Track BEPs, if your feature depends on the acceptance
95  of some other currently in-development BEP, add a Requires header
96  right after the Type header.  The value should be the BEP number of
97  the BEP yours depends on.  Don't add this header if your dependent
98  feature is described in a Final BEP.
99
100- Change the Created header to today's date.  Be sure to follow the
101  format carefully: it must be in ``dd-mmm-yyyy`` format, where the
102  ``mmm`` is the 3 English letter month abbreviation, i.e. one of Jan,
103  Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec.
104
105- Leave Post-History alone for now; you'll add dates to this header
106  each time you post your BEP to bittorrent-list@bittorrent.org.  If
107  you posted your BEP to the lists on August 14, 2001 and September 3,
108  2001, the Post-History header would look like::
109
110      Post-History: 14-Aug-2001, 03-Sept-2001
111
112  You must manually add new dates and check them in.  If you don't
113  have check-in privileges, send your changes to the BEP editors.
114
115- Add a Replaces header if your BEP obsoletes an earlier BEP.  The
116  value of this header is the number of the BEP that your new BEP is
117  replacing.  Only add this header if the older BEP is in "final"
118  form, i.e. is either Accepted, Final, or Rejected.  You aren't
119  replacing an older open BEP if you're submitting a competing idea.
120
121- Now write your Abstract, Rationale, and other content for your BEP,
122  replacing all this gobbledygook with your own text. Be sure to
123  adhere to the format guidelines below, specifically on the
124  prohibition of tab characters and the indentation requirements.
125
126- Update your References and Copyright section.  Usually you'll place
127  your BEP into the public domain, in which case just leave the
128  Copyright section alone.  Alternatively, you can use the `Open
129  Publication License`__, but public domain is still strongly
130  preferred.
131
132  __ http://www.opencontent.org/openpub/
133
134- Leave the Emacs stanza at the end of this file alone, including the
135  formfeed character ("^L", or ``\f``).
136
137- Send your BEP submission to the BEP editors at editor@bittorrent.org.
138
139
140ReStructuredText BEP Formatting Requirements
141============================================
142
143The following is a BEP-specific summary of reStructuredText syntax.
144For the sake of simplicity and brevity, much detail is omitted.  For
145more detail, see `Resources`_ below.  `Literal blocks`_ (in which no
146markup processing is done) are used for examples throughout, to
147illustrate the plaintext markup.
148
149
150General
151-------
152
153You must adhere to the Emacs convention of adding two spaces at the
154end of every sentence.
155
156Tab characters must never appear in the document at all.  A BEP should
157include the standard Emacs stanza included by example at the bottom of
158this BEP.
159
160
161Section Headings
162----------------
163
164BEP headings must begin in column zero and the initial letter of each
165word must be capitalized as in book titles.  Acronyms should be in all
166capitals.  Section titles must be adorned with an underline, a single
167repeated punctuation character, which begins in column zero and must
168extend at least as far as the right edge of the title text (4
169characters minimum).  First-level section titles are underlined with
170"=" (equals signs), second-level section titles with "-" (hyphens),
171and third-level section titles with "'" (single quotes or
172apostrophes).  For example::
173
174    First-Level Title
175    =================
176
177    Second-Level Title
178    ------------------
179
180    Third-Level Title
181    '''''''''''''''''
182
183If there are more than three levels of sections in your BEP, you may
184insert overline/underline-adorned titles for the first and second
185levels as follows::
186
187    ============================
188    First-Level Title (optional)
189    ============================
190
191    -----------------------------
192    Second-Level Title (optional)
193    -----------------------------
194
195    Third-Level Title
196    =================
197
198    Fourth-Level Title
199    ------------------
200
201    Fifth-Level Title
202    '''''''''''''''''
203
204You shouldn't have more than five levels of sections in your BEP.  If
205you do, you should consider rewriting it.
206
207You must use two blank lines between the last line of a section's body
208and the next section heading.  If a subsection heading immediately
209follows a section heading, a single blank line in-between is
210sufficient.
211
212The body of each section is not normally indented, although some
213constructs do use indentation, as described below.  Blank lines are
214used to separate constructs.
215
216
217Paragraphs
218----------
219
220Paragraphs are left-aligned text blocks separated by blank lines.
221Paragraphs are not indented unless they are part of an indented
222construct (such as a block quote or a list item).
223
224
225Inline Markup
226-------------
227
228Portions of text within paragraphs and other text blocks may be
229styled.  For example::
230
231    Text may be marked as *emphasized* (single asterisk markup,
232    typically shown in italics) or **strongly emphasized** (double
233    asterisks, typically boldface).  ``Inline literals`` (using double
234    backquotes) are typically rendered in a monospaced typeface.  No
235    further markup recognition is done within the double backquotes,
236    so they're safe for any kind of code snippets.
237
238
239Block Quotes
240------------
241
242Block quotes consist of indented body elements.  For example::
243
244    This is a paragraph.
245
246        This is a block quote.
247
248        A block quote may contain many paragraphs.
249
250Block quotes are used to quote extended passages from other sources.
251Block quotes may be nested inside other body elements.  Use 4 spaces
252per indent level.
253
254
255Literal Blocks
256--------------
257
258.. 
259    In the text below, double backquotes are used to denote inline
260    literals.  "``::``" is written so that the colons will appear in a
261    monospaced font; the backquotes (``) are markup, not part of the
262    text.  See "Inline Markup" above.
263
264    By the way, this is a comment, described in "Comments" below.
265
266Literal blocks are used for code samples or preformatted ASCII art. To
267indicate a literal block, preface the indented text block with
268"``::``" (two colons).  The literal block continues until the end of
269the indentation.  Indent the text block by 4 spaces.  For example::
270
271    This is a typical paragraph.  A literal block follows.
272
273    ::
274
275        for a in [5,4,3,2,1]:   # this is program code, shown as-is
276            print a
277        print "it's..."
278        # a literal block continues until the indentation ends
279
280The paragraph containing only "``::``" will be completely removed from
281the output; no empty paragraph will remain.  "``::``" is also
282recognized at the end of any paragraph.  If immediately preceded by
283whitespace, both colons will be removed from the output.  When text
284immediately precedes the "``::``", *one* colon will be removed from
285the output, leaving only one colon visible (i.e., "``::``" will be
286replaced by "``:``").  For example, one colon will remain visible
287here::
288
289    Paragraph::
290
291        Literal block
292
293
294Lists
295-----
296
297Bullet list items begin with one of "-", "*", or "+" (hyphen,
298asterisk, or plus sign), followed by whitespace and the list item
299body.  List item bodies must be left-aligned and indented relative to
300the bullet; the text immediately after the bullet determines the
301indentation.  For example::
302
303    This paragraph is followed by a list.
304
305    * This is the first bullet list item.  The blank line above the
306      first list item is required; blank lines between list items
307      (such as below this paragraph) are optional.
308
309    * This is the first paragraph in the second item in the list.
310
311      This is the second paragraph in the second item in the list.
312      The blank line above this paragraph is required.  The left edge
313      of this paragraph lines up with the paragraph above, both
314      indented relative to the bullet.
315
316      - This is a sublist.  The bullet lines up with the left edge of
317        the text blocks above.  A sublist is a new list so requires a
318        blank line above and below.
319
320    * This is the third item of the main list.
321
322    This paragraph is not part of the list.
323
324Enumerated (numbered) list items are similar, but use an enumerator
325instead of a bullet.  Enumerators are numbers (1, 2, 3, ...), letters
326(A, B, C, ...; uppercase or lowercase), or Roman numerals (i, ii, iii,
327iv, ...; uppercase or lowercase), formatted with a period suffix
328("1.", "2."), parentheses ("(1)", "(2)"), or a right-parenthesis
329suffix ("1)", "2)").  For example::
330
331    1. As with bullet list items, the left edge of paragraphs must
332       align.
333
334    2. Each list item may contain multiple paragraphs, sublists, etc.
335
336       This is the second paragraph of the second list item.
337
338       a) Enumerated lists may be nested.
339       b) Blank lines may be omitted between list items.
340
341Definition lists are written like this::
342
343    what
344        Definition lists associate a term with a definition.
345
346    how
347        The term is a one-line phrase, and the definition is one
348        or more paragraphs or body elements, indented relative to
349        the term.
350
351
352Tables
353------
354
355Simple tables are easy and compact but you are not required to use
356simple tables::
357
358    =====  =====  =======
359      A      B    A and B
360    =====  =====  =======
361    False  False  False
362    True   False  False
363    False  True   False
364    True   True   True
365    =====  =====  =======
366
367There must be at least two columns in a table (to differentiate from
368section titles).  Column spans use underlines of hyphens ("Inputs"
369spans the first two columns)::
370
371    =====  =====  ======
372       Inputs     Output
373    ------------  ------
374      A      B    A or B
375    =====  =====  ======
376    False  False  False
377    True   False  True
378    False  True   True
379    True   True   True
380    =====  =====  ======
381
382Text in a first-column cell starts a new row.  No text in the first
383column indicates a continuation line; the rest of the cells may
384consist of multiple lines.  For example::
385
386    =====  =========================
387    col 1  col 2
388    =====  =========================
389    1      Second column of row 1.
390    2      Second column of row 2.
391           Second line of paragraph.
392    3      - Second column of row 3.
393
394           - Second item in bullet
395             list (row 3, column 2).
396    =====  =========================
397
398
399Hyperlinks
400----------
401
402When referencing an external web page in the body of a BEP, you should
403include the title of the page in the text, with either an inline
404hyperlink reference to the URL or a footnote reference (see
405`Footnotes`_ below).  Do not include the URL in the body text of the
406BEP.
407
408Hyperlink references use backquotes and a trailing underscore to mark
409up the reference text; backquotes are optional if the reference text
410is a single word.  For example::
411
412    In this paragraph, we refer to the `BitTorrent web site`_.
413
414An explicit target provides the URL.  Put targets in a References
415section at the end of the BEP, or immediately after the reference.
416Hyperlink targets begin with two periods and a space (the "explicit
417markup start"), followed by a leading underscore, the reference text,
418a colon, and the URL (absolute or relative)::
419
420    .. _BitTorrent web site: http://www.bittorrent.org/
421
422The reference text and the target text must match (although the match
423is case-insensitive and ignores differences in whitespace).  Note that
424the underscore trails the reference text but precedes the target text.
425If you think of the underscore as a right-pointing arrow, it points
426*away* from the reference and *toward* the target.
427
428The same mechanism can be used for internal references.  Every unique
429section title implicitly defines an internal hyperlink target.  We can
430make a link to the Abstract section like this::
431
432    Here is a hyperlink reference to the `Abstract`_ section.  The
433    backquotes are optional since the reference text is a single word;
434    we can also just write: Abstract_.
435
436Footnotes containing the URLs from external targets will be generated
437automatically at the end of the References section of the BEP, along
438with footnote references linking the reference text to the footnotes.
439
440Text of the form "BEP x" or "RFC x" (where "x" is a number) will be
441linked automatically to the appropriate URLs.
442
443
444Footnotes
445---------
446
447Footnote references consist of a left square bracket, a number, a
448right square bracket, and a trailing underscore::
449
450    This sentence ends with a footnote reference [1]_.
451
452Whitespace must precede the footnote reference.  Leave a space between
453the footnote reference and the preceding word.
454
455When referring to another BEP, include the BEP number in the body
456text, such as "BEP 1".  The title may optionally appear.  Add a
457footnote reference following the title.  For example::
458
459    Refer to BEP 1 [2]_ for more information.
460
461Add a footnote that includes the BEP's title and author.  It may
462optionally include the explicit URL on a separate line, but only in
463the References section.  Footnotes begin with ".. " (the explicit
464markup start), followed by the footnote marker (no underscores),
465followed by the footnote body.  For example::
466
467    References
468    ==========
469
470    .. [2] BEP 1, "BEP Purpose and Guidelines", Harrison
471       (http://www.bittorrent.org/beps/bep_0001.html)
472
473If you decide to provide an explicit URL for a BEP, please use this as
474the URL template::
475
476    http://www.bittorrent.org/beps/bep_xxxx
477
478BEP numbers in URLs must be padded with zeros from the left, so as to
479be exactly 4 characters wide, however BEP numbers in the text are
480never padded.
481
482During the course of developing your BEP, you may have to add, remove,
483and rearrange footnote references, possibly resulting in mismatched
484references, obsolete footnotes, and confusion.  Auto-numbered
485footnotes allow more freedom.  Instead of a number, use a label of the
486form "#word", where "word" is a mnemonic consisting of alphanumerics
487plus internal hyphens, underscores, and periods (no whitespace or
488other characters are allowed).  For example::
489
490    Refer to BEP 1 [#BEP-1]_ for more information.
491
492    References
493    ==========
494
495    .. [#BEP-1] BEP 1, "BEP Purpose and Guidelines", Harrison
496
497       http://www.bittorrent.org/beps/bep-0001
498
499Footnotes and footnote references will be numbered automatically, and
500the numbers will always match.  Once a BEP is finalized, auto-numbered
501labels should be replaced by numbers for simplicity.
502
503
504Images
505------
506
507If your BEP contains a diagram, you may include it in the processed
508output using the "image" directive::
509
510    .. image:: diagram.png
511
512Any browser-friendly graphics format is possible: .png, .jpeg, .gif,
513.tiff, etc.
514
515Since this image will not be visible to readers of the BEP in source
516text form, you should consider including a description or ASCII art
517alternative, using a comment (below).
518
519
520Comments
521--------
522
523A comment block is an indented block of arbitrary text immediately
524following an explicit markup start: two periods and whitespace.  Leave
525the ".." on a line by itself to ensure that the comment is not
526misinterpreted as another explicit markup construct.  Comments are not
527visible in the processed document.  For the benefit of those reading
528your BEP in source form, please consider including a descriptions of
529or ASCII art alternatives to any images you include.  For example::
530
531     .. image:: dataflow.png
532
533     ..
534        Data flows from the input module, through the "black box"
535        module, and finally into (and through) the output module.
536
537The Emacs stanza at the bottom of this document is inside a comment.
538
539
540Escaping Mechanism
541------------------
542
543reStructuredText uses backslashes ("``\``") to override the special
544meaning given to markup characters and get the literal characters
545themselves.  To get a literal backslash, use an escaped backslash
546("``\\``").  There are two contexts in which backslashes have no
547special meaning: `literal blocks`_ and inline literals (see `Inline
548Markup`_ above).  In these contexts, no markup recognition is done,
549and a single backslash represents a literal backslash, without having
550to double up.
551
552If you find that you need to use a backslash in your text, consider
553using inline literals or a literal block instead.
554
555
556Habits to Avoid
557===============
558
559Many programmers who are familiar with TeX often write quotation marks
560like this::
561
562    `single-quoted' or ``double-quoted''
563
564Backquotes are significant in reStructuredText, so this practice
565should be avoided.  For ordinary text, use ordinary 'single-quotes' or
566"double-quotes".  For inline literal text (see `Inline Markup`_
567above), use double-backquotes::
568
569    ``literal text: in here, anything goes!``
570
571
572Resources
573=========
574
575Many other constructs and variations are possible.  For more details
576about the reStructuredText markup, in increasing order of
577thoroughness, please see:
578
579* `A ReStructuredText Primer`__, a gentle introduction.
580
581  __ http://docutils.sourceforge.net/docs/rst/quickstart.html
582
583* `Quick reStructuredText`__, a users' quick reference.
584
585  __ http://docutils.sourceforge.net/docs/rst/quickref.html
586
587* `reStructuredText Markup Specification`__, the final authority.
588
589  __ http://docutils.sourceforge.net/spec/rst/reStructuredText.html
590
591The processing of reStructuredText BEPs is done using Docutils_.  If
592you have a question or require assistance with reStructuredText or
593Docutils, please `post a message`_ to the `Docutils-users mailing
594list`_.  The `Docutils project web site`_ has more information.
595
596.. _Docutils:
597.. _Docutils project web site: http://docutils.sourceforge.net/
598.. _post a message:
599   mailto:docutils-users@lists.sourceforge.net?subject=BEPs
600.. _Docutils-users mailing list:
601   http://docutils.sf.net/docs/user/mailing-lists.html#docutils-users
602
603
604This document was derived heavily from PEP-0012 [#PEP-12]_.  In many places
605text was simply copied and modified.  Although the PEP-0012 text
606was written by David Goodger and Barry Warsaw, they are not
607responsible for its use in the BitTorent Enhancement Process, and
608should not be bothered with technical questions specific to BitTorrent
609or the BEP process.  Please direct all comments to the BitTorrent
610editors <editor@bittorrent.org>.
611
612Acknowledgements
613================
614
615Thanks to Barry Warsaw, David Goodger, and Guido van Rossum for their
616guidance.
617
618References
619==========
620
621.. [#BEP-1] BEP_0001. BEP Purpose and Guidelines, Harrison
622   (http://www.bittorrent.org/beps/bep_0001.html)
623
624.. [#PEP-12] PEP-0012. Sample reStructuredText PEP Template, Goodger, Warsaw
625   (http://www.python.org/peps/pep-0012.html)
626
627
628Copyright
629=========
630
631This document has been placed in the public domain.
632
633
634
635..
636   Local Variables:
637   mode: indented-text
638   indent-tabs-mode: nil
639   sentence-end-double-space: t
640   fill-column: 70
641   coding: utf-8
642   End:
643
Note: See TracBrowser for help on using the browser.