1 ==================================================
2 A Record of reStructuredText Syntax Alternatives
3 ==================================================
5 :Contact: goodger@users.sourceforge.net
6 :Revision: $Revision: 684 $
7 :Date: $Date: 2005-10-06 15:45:31 -0500 (Thu, 06 Oct 2005) $
9 The following are ideas, alternatives, and justifications that were
10 considered for reStructuredText syntax, which did not originate with
11 Setext_ or StructuredText_. For an analysis of constructs which *did*
12 originate with StructuredText or Setext, please see `Problems With
13 StructuredText`_. See the `reStructuredText Markup Specification`_
14 for full details of the established syntax.
16 .. _Setext: http://docutils.sourceforge.net/mirror/setext.html
18 http://dev.zope.org/Members/jim/StructuredTextWiki/FrontPage
19 .. _Problems with StructuredText: problems.html
20 .. _reStructuredText Markup Specification: reStructuredText.html
29 This is the realm of the possible but questionably probable. These
30 ideas are kept here as a record of what has been proposed, for
31 posterity and in case any of them prove to be useful.
34 Compound Enumerated Lists
35 -------------------------
37 Allow for compound enumerators, such as "1.1." or "1.a." or "1(a)", to
38 allow for nested enumerated lists without indentation?
41 Sloppy Indentation of List Items
42 --------------------------------
44 Perhaps the indentation shouldn't be so strict. Currently, this is
50 Anything wrong with this? ::
59 Block quote. (no good: requires some indent relative to first
64 2. Have to carefully define where the literal block ends::
70 Hmm... Non-strict indentation isn't such a good idea.
73 Lazy Indentation of List Items
74 ------------------------------
76 Another approach: Going back to the first draft of reStructuredText
77 (2000-11-27 post to Doc-SIG)::
79 - This is the fourth item of the main list (no blank line above).
80 The second line of this item is not indented relative to the
81 bullet, which precludes it from having a second paragraph.
83 Change that to *require* a blank line above and below, to reduce
84 ambiguity. This "loosening" may be added later, once the parser's
85 been nailed down. However, a serious drawback of this approach is to
86 limit the content of each list item to a single paragraph.
89 David's Idea for Lazy Indentation
90 `````````````````````````````````
92 Consider a paragraph in a word processor. It is a single logical line
93 of text which ends with a newline, soft-wrapped arbitrarily at the
94 right edge of the page or screen. We can think of a plaintext
95 paragraph in the same way, as a single logical line of text, ending
96 with two newlines (a blank line) instead of one, and which may contain
97 arbitrary line breaks (newlines) where it was accidentally
98 hard-wrapped by an application. We can compensate for the accidental
99 hard-wrapping by "unwrapping" every unindented second and subsequent
100 line. The indentation of the first line of a paragraph or list item
101 would determine the indentation for the entire element. Blank lines
102 would be required between list items when using lazy indentation.
104 The following example shows the lazy indentation of multiple body
107 - This is the first paragraph
108 of the first list item.
110 Here is the second paragraph
111 of the first list item.
113 - This is the first paragraph
114 of the second list item.
116 Here is the second paragraph
117 of the second list item.
119 A more complex example shows the limitations of lazy indentation::
121 - This is the first paragraph
122 of the first list item.
124 Next is a definition list item:
127 Definition. The indentation of the term is
128 required, as is the indentation of the definition's
131 When the definition extends to more than
132 one line, lazy indentation may occur. (This is the second
133 paragraph of the definition.)
135 - This is the first paragraph
136 of the second list item.
138 - Here is the first paragraph of
139 the first item of a nested list.
141 So this paragraph would be outside of the nested list,
142 but inside the second list item of the outer list.
144 But this paragraph is not part of the list at all.
146 And the ambiguity remains::
148 - Look at the hyphen at the beginning of the next line
149 - is it a second list item marker, or a dash in the text?
151 Similarly, we may want to refer to numbers inside enumerated
154 1. How many socks in a pair? There are
155 2. How many pants in a pair? Exactly
158 Literal blocks and block quotes would still require consistent
159 indentation for all their lines. For block quotes, we might be able
160 to get away with only requiring that the first line of each contained
161 element be indented. For example::
165 This is a paragraph inside a block quote.
166 Second and subsequent lines need not be indented at all.
168 - A bullet list inside
171 Second paragraph of the
172 bullet list inside the block quote.
174 Although feasible, this form of lazy indentation has problems. The
175 document structure and hierarchy is not obvious from the indentation,
176 making the source plaintext difficult to read. This will also make
177 keeping track of the indentation while writing difficult and
178 error-prone. However, these problems may be acceptable for Wikis and
179 email mode, where we may be able to rely on less complex structure
180 (few nested lists, for example).
186 Prior to the syntax for field lists being finalized, several
187 alternatives were proposed.
189 1. Unadorned RFC822_ everywhere::
194 Advantages: clean, precedent (RFC822-compliant). Disadvantage:
195 ambiguous (these paragraphs are a prime example).
197 Conclusion: rejected.
199 2. Special case: use unadorned RFC822_ for the very first or very last
200 text block of a document::
206 The rest of the document...
209 Advantages: clean, precedent (RFC822-compliant). Disadvantages:
210 special case, flat (unnested) field lists only, still ambiguous::
213 Usage: cmdname [options] arg1 arg2 ...
215 We obviously *don't* want the like above to be interpreted as a
216 field list item. Or do we?
219 Conclusion: rejected for the general case, accepted for specific
220 contexts (PEPs, email).
229 Advantages: explicit and unambiguous, RFC822-compliant.
230 Disadvantage: cumbersome.
232 Conclusion: rejected for the general case (but such a directive
233 could certainly be written).
235 4. Use Javadoc-style::
241 Advantages: unambiguous, precedent, flexible. Disadvantages:
242 non-intuitive, ugly, not RFC822-compliant.
244 Conclusion: rejected.
246 5. Use leading colons::
251 Advantages: unambiguous, obvious (*almost* RFC822-compliant),
252 flexible, perhaps even elegant. Disadvantages: no precedent, not
253 quite RFC822-compliant.
255 Conclusion: accepted!
257 6. Use double colons::
262 Advantages: unambiguous, obvious? (*almost* RFC822-compliant),
263 flexible, similar to syntax already used for literal blocks and
264 directives. Disadvantages: no precedent, not quite
265 RFC822-compliant, similar to syntax already used for literal blocks
268 Conclusion: rejected because of the syntax similarity & conflicts.
270 Why is RFC822 compliance important? It's a universal Internet
271 standard, and super obvious. Also, I'd like to support the PEP format
272 (ulterior motive: get PEPs to use reStructuredText as their standard).
273 But it *would* be easy to get used to an alternative (easy even to
274 convert PEPs; probably harder to convert python-deviants ;-).
276 Unfortunately, without well-defined context (such as in email headers:
277 RFC822 only applies before any blank lines), the RFC822 format is
278 ambiguous. It is very common in ordinary text. To implement field
279 lists unambiguously, we need explicit syntax.
281 The following question was posed in a footnote:
283 Should "bibliographic field lists" be defined at the parser level,
284 or at the DPS transformation level? In other words, are they
285 reStructuredText-specific, or would they also be applicable to
286 another (many/every other?) syntax?
288 The answer is that bibliographic fields are a
289 reStructuredText-specific markup convention. Other syntaxes may
290 implement the bibliographic elements explicitly. For example, there
291 would be no need for such a transformation for an XML-based markup
294 .. _RFC822: http://www.rfc-editor.org/rfc/rfc822.txt
297 Interpreted Text "Roles"
298 ========================
300 The original purpose of interpreted text was as a mechanism for
301 descriptive markup, to describe the nature or role of a word or
302 phrase. For example, in XML we could say "<function>len</function>"
303 to mark up "len" as a function. It is envisaged that within Python
304 docstrings (inline documentation in Python module source files, the
305 primary market for reStructuredText) the role of a piece of
306 interpreted text can be inferred implicitly from the context of the
307 docstring within the program source. For other applications, however,
308 the role may have to be indicated explicitly.
310 Interpreted text is enclosed in single backquotes (`).
312 1. Initially, it was proposed that an explicit role could be indicated
313 as a word or phrase within the enclosing backquotes:
315 - As a prefix, separated by a colon and whitespace::
317 `role: interpreted text`
319 - As a suffix, separated by whitespace and a colon::
321 `interpreted text :role`
323 There are problems with the initial approach:
325 - There could be ambiguity with interpreted text containing colons.
326 For example, an index entry of "Mission: Impossible" would
327 require a backslash-escaped colon.
329 - The explicit role is descriptive markup, not content, and will
330 not be visible in the processed output. Putting it inside the
331 backquotes doesn't feel right; the *role* isn't being quoted.
333 2. Tony Ibbs suggested that the role be placed outside the
336 role:`prefix` or `suffix`:role
338 This removes the embedded-colons ambiguity, but limits the role
339 identifier to be a single word (whitespace would be illegal).
340 Since roles are not meant to be visible after processing, the lack
341 of whitespace support is not important.
343 The suggested syntax remains ambiguous with respect to ratios and
344 some writing styles. For example, suppose there is a "signal"
345 identifier, and we write::
347 ...calculate the `signal`:noise ratio.
349 "noise" looks like a role.
351 3. As an improvement on #2, we can bracket the role with colons::
353 :role:`prefix` or `suffix`:role:
355 This syntax is similar to that of field lists, which is fine since
356 both are doing similar things: describing.
358 This is the syntax chosen for reStructuredText.
360 4. Another alternative is two colons instead of one::
362 role::`prefix` or `suffix`::role
364 But this is used for analogies ("A:B::C:D": "A is to B as C is to
367 Both alternative #2 and #4 lack delimiters on both sides of the
368 role, making it difficult to parse (by the reader).
370 5. Some kind of bracketing could be used:
374 (role)`prefix` or `suffix`(role)
378 {role}`prefix` or `suffix`{role}
382 [role]`prefix` or `suffix`[role]
386 <role>`prefix` or `suffix`<role>
388 (The overlap of \*ML tags with angle brackets would be too
389 confusing and precludes their use.)
391 Syntax #3 was chosen for reStructuredText.
397 A problem with comments (actually, with all indented constructs) is
398 that they cannot be followed by an indented block -- a block quote --
399 without swallowing it up.
401 I thought that perhaps comments should be one-liners only. But would
402 this mean that footnotes, hyperlink targets, and directives must then
403 also be one-liners? Not a good solution.
405 Tony Ibbs suggested a "comment" directive. I added that we could
406 limit a comment to a single text block, and that a "multi-block
407 comment" could use "comment-start" and "comment-end" directives. This
408 would remove the indentation incompatibility. A "comment" directive
409 automatically suggests "footnote" and (hyperlink) "target" directives
410 as well. This could go on forever! Bad choice.
412 Garth Kidd suggested that an "empty comment", a ".." explicit markup
413 start with nothing on the first line (except possibly whitespace) and
414 a blank line immediately following, could serve as an "unindent". An
415 empty comment does **not** swallow up indented blocks following it,
416 so block quotes are safe. "A tiny but practical wart." Accepted.
422 Alan Jaffray came up with this idea, along with the following syntax::
424 Search the `Python DOC-SIG mailing list archives`{}_.
426 .. _: http://mail.python.org/pipermail/doc-sig/
428 The idea is sound and useful. I suggested a "double underscore"
431 Search the `Python DOC-SIG mailing list archives`__.
433 .. __: http://mail.python.org/pipermail/doc-sig/
435 But perhaps single underscores are okay? The syntax looks better, but
436 the hyperlink itself doesn't explicitly say "anonymous"::
438 Search the `Python DOC-SIG mailing list archives`_.
440 .. _: http://mail.python.org/pipermail/doc-sig/
442 Mixing anonymous and named hyperlinks becomes confusing. The order of
443 targets is not significant for named hyperlinks, but it is for
444 anonymous hyperlinks::
446 Hyperlinks: anonymous_, named_, and another anonymous_.
452 Without the extra syntax of double underscores, determining which
453 hyperlink references are anonymous may be difficult. We'd have to
454 check which references don't have corresponding targets, and match
455 those up with anonymous targets. Keeping to a simple consistent
456 ordering (as with auto-numbered footnotes) seems simplest.
458 reStructuredText will use the explicit double-underscore syntax for
459 anonymous hyperlinks. An alternative (see `Reworking Explicit
460 Markup`_ below) for the somewhat awkward ".. __:" syntax is "__"::
462 An anonymous__ reference.
467 Reworking Explicit Markup
468 =========================
470 Alan Jaffray came up with the idea of `anonymous hyperlinks`_, added
471 to reStructuredText. Subsequently it was asserted that hyperlinks
472 (especially anonymous hyperlinks) would play an increasingly important
473 role in reStructuredText documents, and therefore they require a
474 simpler and more concise syntax. This prompted a review of the
475 current and proposed explicit markup syntaxes with regards to
480 .. _blah: internal hyperlink target
481 .. _blah: http://somewhere external hyperlink target
482 .. _blah: blahblah_ indirect hyperlink target
483 .. __: anonymous internal target
484 .. __: http://somewhere anonymous external target
485 .. __: blahblah_ anonymous indirect target
486 .. [blah] http://somewhere footnote
487 .. blah:: http://somewhere directive
488 .. blah: http://somewhere comment
492 The comment text was intentionally made to look like a hyperlink
497 * Except for the colon (a delimiter necessary to allow for
498 phrase-links), hyperlink target ``.. _blah:`` comes from Setext.
499 * Comment syntax from Setext.
500 * Footnote syntax from StructuredText ("named links").
501 * Directives and anonymous hyperlinks original to reStructuredText.
505 + Consistent explicit markup indicator: "..".
506 + Consistent hyperlink syntax: ".. _" & ":".
510 - Anonymous target markup is awkward: ".. __:".
511 - The explicit markup indicator ("..") is excessively overloaded?
512 - Comment text is limited (can't look like a footnote, hyperlink,
513 or directive). But this is probably not important.
515 2. Alan Jaffray's proposed syntax #1::
517 __ _blah internal hyperlink target
518 __ blah: http://somewhere external hyperlink target
519 __ blah: blahblah_ indirect hyperlink target
520 __ anonymous internal target
521 __ http://somewhere anonymous external target
522 __ blahblah_ anonymous indirect target
523 __ [blah] http://somewhere footnote
524 .. blah:: http://somewhere directive
525 .. blah: http://somewhere comment
527 The hyperlink-connoted underscores have become first-level syntax.
531 + Anonymous targets are simpler.
532 + All hyperlink targets are one character shorter.
536 - Inconsistent internal hyperlink targets. Unlike all other named
537 hyperlink targets, there's no colon. There's an extra leading
538 underscore, but we can't drop it because without it, "blah" looks
539 like a relative URI. Unless we restore the colon::
541 __ blah: internal hyperlink target
545 3. Alan Jaffray's proposed syntax #2::
547 .. _blah internal hyperlink target
548 .. blah: http://somewhere external hyperlink target
549 .. blah: blahblah_ indirect hyperlink target
550 .. anonymous internal target
551 .. http://somewhere anonymous external target
552 .. blahblah_ anonymous indirect target
553 .. [blah] http://somewhere footnote
554 !! blah: http://somewhere directive
555 ## blah: http://somewhere comment
557 Leading underscores have been (almost) replaced by "..", while
558 comments and directives have gained their own syntax.
562 + Anonymous hyperlinks are simpler.
563 + Unique syntax for comments. Connotation of "comment" from
564 some programming languages (including our favorite).
565 + Unique syntax for directives. Connotation of "action!".
569 - Inconsistent internal hyperlink targets. Again, unlike all other
570 named hyperlink targets, there's no colon. There's a leading
571 underscore, matching the trailing underscores of references,
572 which no other hyperlink targets have. We can't drop that one
573 leading underscore though: without it, "blah" looks like a
574 relative URI. Again, unless we restore the colon::
576 .. blah: internal hyperlink target
578 - All (except for internal) hyperlink targets lack their leading
579 underscores, losing the "hyperlink" connotation.
581 - Obtrusive syntax for comments. Alternatives::
583 ;; blah: http://somewhere
584 (also comment syntax in Lisp & others)
585 ,, blah: http://somewhere
586 ("comma comma": sounds like "comment"!)
588 - Iffy syntax for directives. Alternatives?
590 4. Tony Ibbs' proposed syntax::
592 .. _blah: internal hyperlink target
593 .. _blah: http://somewhere external hyperlink target
594 .. _blah: blahblah_ indirect hyperlink target
595 .. anonymous internal target
596 .. http://somewhere anonymous external target
597 .. blahblah_ anonymous indirect target
598 .. [blah] http://somewhere footnote
599 .. blah:: http://somewhere directive
600 .. blah: http://somewhere comment
602 This is the same as the current syntax, except for anonymous
603 targets which drop their "__: ".
607 + Anonymous targets are simpler.
611 - Anonymous targets lack their leading underscores, losing the
612 "hyperlink" connotation.
613 - Anonymous targets are almost indistinguishable from comments.
614 (Better to know "up front".)
616 5. David Goodger's proposed syntax: Perhaps going back to one of
617 Alan's earlier suggestions might be the best solution. How about
618 simply adding "__ " as a synonym for ".. __: " in the original
619 syntax? These would become equivalent::
621 .. __: anonymous internal target
622 .. __: http://somewhere anonymous external target
623 .. __: blahblah_ anonymous indirect target
625 __ anonymous internal target
626 __ http://somewhere anonymous external target
627 __ blahblah_ anonymous indirect target
629 Alternative 5 has been adopted.
632 Backquotes in Phrase-Links
633 ==========================
635 [From a 2001-06-05 Doc-SIG post in reply to questions from Doug
638 The first draft of the spec, posted to the Doc-SIG in November 2000,
639 used square brackets for phrase-links. I changed my mind because:
641 1. In the first draft, I had already decided on single-backquotes for
644 2. However, I wanted to minimize the necessity for backslash escapes,
645 for example when quoting Python repr-equivalent syntax that uses
648 3. The processing of identifiers (function/method/attribute/module
649 etc. names) into hyperlinks is a useful feature. PyDoc recognizes
650 identifiers heuristically, but it doesn't take much imagination to
651 come up with counter-examples where PyDoc's heuristics would result
652 in embarassing failure. I wanted to do it deterministically, and
653 that called for syntax. I called this construct "interpreted
656 4. Leveraging off the ``*emphasis*/**strong**`` syntax, lead to the
657 idea of using double-backquotes as syntax.
659 5. I worked out some rules for inline markup recognition.
661 6. In combination with #5, double backquotes lent themselves to inline
662 literals, neatly satisfying #2, minimizing backslash escapes. In
663 fact, the spec says that no interpretation of any kind is done
664 within double-backquote inline literal text; backslashes do *no*
665 escaping within literal text.
667 7. Single backquotes are then freed up for interpreted text.
669 8. I already had square brackets required for footnote references.
671 9. Since interpreted text will typically turn into hyperlinks, it was
672 a natural fit to use backquotes as the phrase-quoting syntax for
673 trailing-underscore hyperlinks.
675 The original inspiration for the trailing underscore hyperlink syntax
676 was Setext. But for phrases Setext used a very cumbersome
677 ``underscores_between_words_like_this_`` syntax.
679 The underscores can be viewed as if they were right-pointing arrows:
680 ``-->``. So ``hyperlink_`` points away from the reference, and
681 ``.. _hyperlink:`` points toward the target.
684 Substitution Mechanism
685 ======================
687 Substitutions arose out of a Doc-SIG thread begun on 2001-10-28 by
688 Alan Jaffray, "reStructuredText inline markup". It reminded me of a
689 missing piece of the reStructuredText puzzle, first referred to in my
690 contribution to "Documentation markup & processing / PEPs" (Doc-SIG
693 Substitutions allow the power and flexibility of directives to be
694 shared by inline text. They are a way to allow arbitrarily complex
695 inline objects, while keeping the details out of the flow of text.
696 They are the equivalent of SGML/XML's named entities. For example, an
697 inline image (using reference syntax alternative 4d (vertical bars)
698 and definition alternative 3, the alternatives chosen for inclusion in
701 The |biohazard| symbol must be used on containers used to dispose
704 .. |biohazard| image:: biohazard.png
707 The ``|biohazard|`` substitution reference will be replaced in-line by
708 whatever the ``.. |biohazard|`` substitution definition generates (in
709 this case, an image). A substitution definition contains the
710 substitution text bracketed with vertical bars, followed by a an
711 embedded inline-compatible directive, such as "image". A transform is
712 required to complete the substitution.
714 Syntax alternatives for the reference:
716 1. Use the existing interpreted text syntax, with a predefined role
719 The `biohazard`:sub: symbol...
721 Advantages: existing syntax, explicit. Disadvantages: verbose,
724 2. Use a variant of the interpreted text syntax, with a new suffix
725 akin to the underscore in phrase-link references::
736 Due to incompatibility with other constructs and ordinary text
737 usage, (f) and (g) are not possible.
739 3. Use interpreted text syntax with a fixed internal format::
755 To avoid ML confusion (k) and (l) are definitely out. Square
756 brackets (j) won't work in the target (the substitution definition
757 would be indistinguishable from a footnote).
759 The ```/name/``` syntax (g) is reminiscent of "s/find/sub"
760 substitution syntax in ed-like languages. However, it may have a
761 misleading association with regexps, and looks like an absolute
762 POSIX path. (i) is visually equivalent and lacking the
765 A disadvantage of all of these is that they limit interpreted text,
766 albeit only slightly.
768 4. Use specialized syntax, something new::
785 "#" (a) and "@" (b) are obtrusive. "/" (c) without backquotes
786 looks just like a POSIX path; it is likely for such usage to appear
789 "|" (d) and "^" (h) are feasible.
791 5. Redefine the trailing underscore syntax. See definition syntax
792 alternative 4, below.
794 Syntax alternatives for the definition:
796 1. Use the existing directive syntax, with a predefined directive such
797 as "sub". It contains a further embedded directive resolving to an
798 inline-compatible object::
801 .. image:: biohazard.png
805 That bird wouldn't *voom* if you put 10,000,000 volts
808 The advantages and disadvantages are the same as in inline
811 2. Use syntax as in #1, but with an embedded directivecompressed::
813 .. sub:: biohazard image:: biohazard.png
816 This is a bit better than alternative 1, but still too much.
818 3. Use a variant of directive syntax, incorporating the substitution
819 text, obviating the need for a special "sub" directive name. If we
820 assume reference alternative 4d (vertical bars), the matching
821 definition would look like this::
823 .. |biohazard| image:: biohazard.png
826 4. (Suggested by Alan Jaffray on Doc-SIG from 2001-11-06.)
828 Instead of adding new syntax, redefine the trailing underscore
829 syntax to mean "substitution reference" instead of "hyperlink
830 reference". Alan's example::
832 I had lunch with Jonathan_ today. We talked about Zope_.
834 .. _Jonathan: lj [user=jhl]
835 .. _Zope: http://www.zope.org/
837 A problem with the proposed syntax is that URIs which look like
838 simple reference names (alphanum plus ".", "-", "_") would be
839 indistinguishable from substitution directive names. A more
840 consistent syntax would be::
842 I had lunch with Jonathan_ today. We talked about Zope_.
844 .. _Jonathan: lj:: user=jhl
845 .. _Zope: http://www.zope.org/
847 (``::`` after ``.. _Jonathan: lj``.)
849 The "Zope" target is a simple external hyperlink, but the
850 "Jonathan" target contains a directive. Alan proposed is that the
851 reference text be replaced by whatever the referenced directive
852 (the "directive target") produces. A directive reference becomes a
853 hyperlink reference if the contents of the directive target resolve
854 to a hyperlink. If the directive target resolves to an icon, the
855 reference is replaced by an inline icon. If the directive target
856 resolves to a hyperlink, the directive reference becomes a
859 This seems too indirect and complicated for easy comprehension.
861 The reference in the text will sometimes become a link, sometimes
862 not. Sometimes the reference text will remain, sometimes not. We
863 don't know *at the reference*::
865 This is a `hyperlink reference`_; its text will remain.
866 This is an `inline icon`_; its text will disappear.
870 The syntax that has been incorporated into the spec and parser is
871 reference alternative 4d with definition alternative 3::
873 The |biohazard| symbol...
875 .. |biohazard| image:: biohazard.png
878 We can also combine substitution references with hyperlink references,
879 by appending a "_" (named hyperlink reference) or "__" (anonymous
880 hyperlink reference) suffix to the substitution reference. This
881 allows us to click on an image-link::
883 The |biohazard|_ symbol...
885 .. |biohazard| image:: biohazard.png
887 .. _biohazard: http://www.cdc.gov/
889 There have been several suggestions for the naming of these
890 constructs, originally called "substitution references" and
893 1. Candidate names for the reference construct:
895 (a) substitution reference
896 (b) tagging reference
897 (c) inline directive reference
898 (d) directive reference
899 (e) indirect inline directive reference
900 (f) inline directive placeholder
901 (g) inline directive insertion reference
902 (h) directive insertion reference
903 (i) insertion reference
904 (j) directive macro reference
906 (l) substitution directive reference
908 2. Candidate names for the definition construct:
911 (b) substitution directive
916 (g) inline directive definition
917 (h) referenced directive
918 (i) indirect directive
919 (j) indirect directive definition
920 (k) directive definition
921 (l) indirect inline directive
922 (m) named directive definition
923 (n) inline directive insertion definition
924 (o) directive insertion definition
925 (p) insertion definition
926 (q) insertion directive
927 (r) substitution definition
928 (s) directive macro definition
930 (u) substitution directive definition
931 (v) substitution definition
933 "Inline directive reference" (1c) seems to be an appropriate term at
934 first, but the term "inline" is redundant in the case of the
935 reference. Its counterpart "inline directive definition" (2g) is
936 awkward, because the directive definition itself is not inline.
938 "Directive reference" (1d) and "directive definition" (2k) are too
939 vague. "Directive definition" could be used to refer to any
940 directive, not just those used for inline substitutions.
942 One meaning of the term "macro" (1k, 2s, 2t) is too
943 programming-language-specific. Also, macros are typically simple text
944 substitution mechanisms: the text is substituted first and evaluated
945 later. reStructuredText substitution definitions are evaluated in
946 place at parse time and substituted afterwards.
948 "Insertion" (1h, 1i, 2n-2q) is almost right, but it implies that
949 something new is getting added rather than one construct being
952 Which brings us back to "substitution". The overall best names are
953 "substitution reference" (1a) and "substitution definition" (2v). A
954 long way to go to add one word!
960 As a further wrinkle (see `Reworking Explicit Markup`_ above), in the
961 wee hours of 2002-02-28 I posted several ideas for changes to footnote
964 - Change footnote syntax from ``.. [1]`` to ``_[1]``? ...
965 - Differentiate (with new DTD elements) author-date "citations"
966 (``[GVR2002]``) from numbered footnotes? ...
967 - Render footnote references as superscripts without "[]"? ...
969 These ideas are all related, and suggest changes in the
970 reStructuredText syntax as well as the docutils tree model.
972 The footnote has been used for both true footnotes (asides expanding
973 on points or defining terms) and for citations (references to external
974 works). Rather than dealing with one amalgam construct, we could
975 separate the current footnote concept into strict footnotes and
976 citations. Citations could be interpreted and treated differently
977 from footnotes. Footnotes would be limited to numerical labels:
978 manual ("1") and auto-numbered (anonymous "#", named "#label").
980 The footnote is the only explicit markup construct (starts with ".. ")
981 that directly translates to a visible body element. I've always been
982 a little bit uncomfortable with the ".. " marker for footnotes because
983 of this; ".. " has a connotation of "special", but footnotes aren't
984 especially "special". Printed texts often put footnotes at the bottom
985 of the page where the reference occurs (thus "foot note"). Some HTML
986 designs would leave footnotes to be rendered the same positions where
987 they're defined. Other online and printed designs will gather
988 footnotes into a section near the end of the document, converting them
989 to "endnotes" (perhaps using a directive in our case); but this
990 "special processing" is not an intrinsic property of the footnote
991 itself, but a decision made by the document author or processing
994 Citations are almost invariably collected in a section at the end of a
995 document or section. Citations "disappear" from where they are
996 defined and are magically reinserted at some well-defined point.
997 There's more of a connection to the "special" connotation of the ".. "
998 syntax. The point at which the list of citations is inserted could be
999 defined manually by a directive (e.g., ".. citations::"), and/or have
1000 default behavior (e.g., a section automatically inserted at the end of
1001 the document) that might be influenced by options to the Writer.
1010 .. [#] Auto-numbered footnote.
1011 .. [#label] Auto-labeled footnote.
1013 - The syntax proposed in the original 2002-02-28 Doc-SIG post:
1014 remove the ".. ", prefix a "_"::
1017 _[#] Auto-numbered footnote.
1018 _[#label] Auto-labeled footnote.
1020 The leading underscore syntax (earlier dropped because
1021 ``.. _[1]:`` was too verbose) is a useful reminder that footnotes
1022 are hyperlink targets.
1024 - Minimal syntax: remove the ".. [" and "]", prefix a "_", and
1028 _#. Auto-numbered footnote.
1029 _#label. Auto-labeled footnote.
1031 ``_1.``, ``_#.``, and ``_#label.`` are markers,
1034 Footnotes could be rendered something like this in HTML
1036 | 1. This is a footnote. The brackets could be dropped
1037 | from the label, and a vertical bar could set them
1038 | off from the rest of the document in the HTML.
1040 Two-way hyperlinks on the footnote marker ("1." above) would also
1041 help to differentiate footnotes from enumerated lists.
1043 If converted to endnotes (by a directive/transform), a horizontal
1044 half-line might be used instead. Page-oriented output formats
1045 would typically use the horizontal line for true footnotes.
1047 + Footnote references:
1051 [1]_, [#]_, [#label]_
1053 - Minimal syntax to match the minimal footnote syntax above::
1057 As a consequence, pure-numeric hyperlink references would not be
1058 possible; they'd be interpreted as footnote references.
1060 + Citation references: no change is proposed from the current footnote
1067 - Current syntax (footnote syntax)::
1069 .. [GVR2001] Python Documentation; van Rossum, Drake, et al.;
1070 http://www.python.org/doc/
1072 - Possible new syntax::
1074 _[GVR2001] Python Documentation; van Rossum, Drake, et al.;
1075 http://www.python.org/doc/
1078 Docutils: Python Documentation Utilities project; Goodger
1079 et al.; http://docutils.sourceforge.net/
1081 Without the ".. " marker, subsequent lines would either have to
1082 align as in one of the above, or we'd have to allow loose
1083 alignment (I'd rather not)::
1085 _[GVR2001] Python Documentation; van Rossum, Drake, et al.;
1086 http://www.python.org/doc/
1088 I proposed adopting the "minimal" syntax for footnotes and footnote
1089 references, and adding citations and citation references to
1090 reStructuredText's repertoire. The current footnote syntax for
1091 citations is better than the alternatives given.
1093 From a reply by Tony Ibbs on 2002-03-01:
1095 However, I think easier with examples, so let's create one::
1097 Fans of Terry Pratchett are perhaps more likely to use
1098 footnotes [1]_ in their own writings than other people
1099 [2]_. Of course, in *general*, one only sees footnotes
1100 in academic or technical writing - it's use in fiction
1101 and letter writing is not normally considered good
1102 style [4]_, particularly in emails (not a medium that
1103 lends itself to footnotes).
1105 .. [1] That is, little bits of referenced text at the
1107 .. [2] Because Terry himself does, of course [3]_.
1108 .. [3] Although he has the distinction of being
1109 *funny* when he does it, and his fans don't always
1111 .. [4] Presumably because it detracts from linear
1112 reading of the text - this is, of course, the point.
1114 and look at it with the second syntax proposal::
1116 Fans of Terry Pratchett are perhaps more likely to use
1117 footnotes [1]_ in their own writings than other people
1118 [2]_. Of course, in *general*, one only sees footnotes
1119 in academic or technical writing - it's use in fiction
1120 and letter writing is not normally considered good
1121 style [4]_, particularly in emails (not a medium that
1122 lends itself to footnotes).
1124 _[1] That is, little bits of referenced text at the
1126 _[2] Because Terry himself does, of course [3]_.
1127 _[3] Although he has the distinction of being
1128 *funny* when he does it, and his fans don't always
1130 _[4] Presumably because it detracts from linear
1131 reading of the text - this is, of course, the point.
1133 (I note here that if I have gotten the indentation of the
1134 footnotes themselves correct, this is clearly not as nice. And if
1135 the indentation should be to the left margin instead, I like that
1138 and the third (new) proposal::
1140 Fans of Terry Pratchett are perhaps more likely to use
1141 footnotes 1_ in their own writings than other people
1142 2_. Of course, in *general*, one only sees footnotes
1143 in academic or technical writing - it's use in fiction
1144 and letter writing is not normally considered good
1145 style 4_, particularly in emails (not a medium that
1146 lends itself to footnotes).
1148 _1. That is, little bits of referenced text at the
1150 _2. Because Terry himself does, of course 3_.
1151 _3. Although he has the distinction of being
1152 *funny* when he does it, and his fans don't always
1154 _4. Presumably because it detracts from linear
1155 reading of the text - this is, of course, the point.
1157 I think I don't, in practice, mind the targets too much (the use
1158 of a dot after the number helps a lot here), but I do have a
1159 problem with the body text, in that I don't naturally separate out
1160 the footnotes as different than the rest of the text - instead I
1161 keep wondering why there are numbers interspered in the text. The
1162 use of brackets around the numbers ([ and ]) made me somehow parse
1163 the footnote references as "odd" - i.e., not part of the body text
1164 - and thus both easier to skip, and also (paradoxically) easier to
1165 pick out so that I could follow them.
1167 Thus, for the moment (and as always susceptable to argument), I'd
1168 say -1 on the new form of footnote reference (i.e., I much prefer
1169 the existing ``[1]_`` over the proposed ``1_``), and ambivalent
1170 over the proposed target change.
1172 That leaves David's problem of wanting to distinguish footnotes
1173 and citations - and the only thing I can propose there is that
1174 footnotes are numeric or # and citations are not (which, as a
1175 human being, I can probably cope with!).
1177 From a reply by Paul Moore on 2002-03-01:
1179 I think the current footnote syntax ``[1]_`` is *exactly* the
1180 right balance of distinctness vs unobtrusiveness. I very
1181 definitely don't think this should change.
1183 On the target change, it doesn't matter much to me.
1185 From a further reply by Tony Ibbs on 2002-03-01, referring to the
1186 "[1]" form and actual usage in email:
1188 Clearly this is a form people are used to, and thus we should
1189 consider it strongly (in the same way that the usage of ``*..*``
1190 to mean emphasis was taken partly from email practise).
1192 Equally clearly, there is something "magical" for people in the
1193 use of a similar form (i.e., ``[1]``) for both footnote reference
1194 and footnote target - it seems natural to keep them similar.
1198 I think that this established plaintext usage leads me to strongly
1199 believe we should retain square brackets at both ends of a
1200 footnote. The markup of the reference end (a single trailing
1201 underscore) seems about as minimal as we can get away with. The
1202 markup of the target end depends on how one envisages the thing -
1203 if ".." means "I am a target" (as I tend to see it), then that's
1204 good, but one can also argue that the "_[1]" syntax has a neat
1205 symmetry with the footnote reference itself, if one wishes (in
1206 which case ".." presumably means "hidden/special" as David seems
1207 to think, which is why one needs a ".." *and* a leading underline
1208 for hyperlink targets.
1210 Given the persuading arguments voiced, we'll leave footnote & footnote
1211 reference syntax alone. Except that these discussions gave rise to
1212 the "auto-symbol footnote" concept, which has been added. Citations
1213 and citation references have also been added.
1216 Auto-Enumerated Lists
1217 =====================
1219 The advantage of auto-numbered enumerated lists would be similar to
1220 that of auto-numbered footnotes: lists could be written and rearranged
1221 without having to manually renumber them. The disadvantages are also
1222 the same: input and output wouldn't match exactly; the markup may be
1223 ugly or confusing (depending on which alternative is chosen).
1225 1. Use the "#" symbol. Example::
1231 Advantages: simple, explicit. Disadvantage: enumeration sequence
1232 cannot be specified (limited to arabic numerals); ugly.
1234 2. As a variation on #1, first initialize the enumeration sequence?
1241 Advantages: simple, explicit, any enumeration sequence possible.
1242 Disadvantages: ugly; perhaps confusing with mixed concrete/abstract
1245 3. Alternative suggested by Fred Bremmer, from experience with MoinMoin::
1251 Advantages: enumeration sequence is explicit (could be multiple
1252 "a." or "(I)" tokens). Disadvantages: perhaps confusing; otherwise
1253 erroneous input (e.g., a duplicate item "1.") would pass silently,
1254 either causing a problem later in the list (if no blank lines
1255 between items) or creating two lists (with blanks).
1257 Take this input for example::
1261 1. Unintentional duplicate of item 1.
1265 Currently the parser will produce two list, "1" and "1,2" (no
1266 warnings, because of the presence of blank lines). Using Fred's
1267 notation, the current behavior is "1,1,2 -> 1 1,2" (without blank
1268 lines between items, it would be "1,1,2 -> 1 [WARNING] 1,2"). What
1269 should the behavior be with auto-numbering?
1271 Fred has produced a patch__, whose initial behavior is as follows::
1276 1,2,2,3 -> 1,2,3 [WARNING] 3
1277 1,1,2 -> 1,2 [WARNING] 2
1279 (After the "[WARNING]", the "3" would begin a new list.)
1281 I have mixed feelings about adding this functionality to the spec &
1282 parser. It would certainly be useful to some users (myself
1283 included; I often have to renumber lists). Perhaps it's too
1284 clever, asking the parser to guess too much. What if you *do* want
1285 three one-item lists in a row, each beginning with "1."? You'd
1286 have to use empty comments to force breaks. Also, I question
1287 whether "1,2,2 -> 1,2,3" is optimal behavior.
1289 In response, Fred came up with "a stricter and more explicit rule
1290 [which] would be to only auto-number silently if *all* the
1291 enumerators of a list were identical". In that case::
1294 1,2,2 -> 1,2 [WARNING] 2
1296 1,2,2,3 -> 1,2 [WARNING] 2,3
1297 1,1,2 -> 1,2 [WARNING] 2
1299 Should any start-value be allowed ("3,3,3"), or should
1300 auto-numbered lists be limited to begin with ordinal-1 ("1", "A",
1303 __ http://sourceforge.net/tracker/index.php?func=detail&aid=548802
1304 &group_id=38414&atid=422032
1306 4. Alternative proposed by Tony Ibbs::
1309 #3. Aha - I edited this in later.
1312 The initial proposal required unique enumerators within a list, but
1313 this limits the convenience of a feature of already limited
1314 applicability and convenience. Not a useful requirement; dropped.
1316 Instead, simply prepend a "#" to a standard list enumerator to
1317 indicate auto-enumeration. The numbers (or letters) of the
1318 enumerators themselves are not significant, except:
1320 - as a sequence indicator (arabic, roman, alphabetic; upper/lower),
1322 - and perhaps as a start value (first list item).
1324 Advantages: explicit, any enumeration sequence possible.
1325 Disadvantages: a bit ugly.
1328 Inline External Targets
1329 =======================
1331 Currently reStructuredText has two hyperlink syntax variations:
1333 * Named hyperlinks::
1335 This is a named reference_ of one word ("reference"). Here is
1336 a `phrase reference`_. Phrase references may even cross `line
1339 .. _reference: http://www.example.org/reference/
1340 .. _phrase reference: http://www.example.org/phrase_reference/
1341 .. _line boundaries: http://www.example.org/line_boundaries/
1345 - The plaintext is readable.
1346 - Each target may be reused multiple times (e.g., just write
1347 ``"reference_"`` again).
1348 - No syncronized ordering of references and targets is necessary.
1352 - The reference text must be repeated as target names; could lead
1354 - The target URLs may be located far from the references, and hard
1355 to find in the plaintext.
1357 * Anonymous hyperlinks (in current reStructuredText)::
1359 This is an anonymous reference__. Here is an anonymous
1360 `phrase reference`__. Phrase references may even cross `line
1363 __ http://www.example.org/reference/
1364 __ http://www.example.org/phrase_reference/
1365 __ http://www.example.org/line_boundaries/
1369 - The plaintext is readable.
1370 - The reference text does not have to be repeated.
1374 - References and targets must be kept in sync.
1375 - Targets cannot be reused.
1376 - The target URLs may be located far from the references.
1378 For comparison and historical background, StructuredText also has two
1379 syntaxes for hyperlinks:
1381 * First, ``"reference text":URL``::
1383 This is a "reference":http://www.example.org/reference/
1384 of one word ("reference"). Here is a "phrase
1385 reference":http://www.example.org/phrase_reference/.
1387 * Second, ``"reference text", http://example.com/absolute_URL``::
1389 This is a "reference", http://www.example.org/reference/
1390 of one word ("reference"). Here is a "phrase reference",
1391 http://www.example.org/phrase_reference/.
1393 Both syntaxes share advantages and disadvantages:
1397 - The target is specified immediately adjacent to the reference.
1401 - Poor plaintext readability.
1402 - Targets cannot be reused.
1403 - Both syntaxes use double quotes, common in ordinary text.
1404 - In the first syntax, the URL and the last word are stuck
1405 together, exacerbating the line wrap problem.
1406 - The second syntax is too magical; text could easily be written
1407 that way by accident (although only absolute URLs are recognized
1408 here, perhaps because of the potential for ambiguity).
1410 A new type of "inline external hyperlink" has been proposed.
1412 1. On 2002-06-28, Simon Budig proposed__ a new syntax for
1413 reStructuredText hyperlinks::
1415 This is a reference_(http://www.example.org/reference/) of one
1416 word ("reference"). Here is a `phrase
1417 reference`_(http://www.example.org/phrase_reference/). Are
1418 these examples, (single-underscore), named? If so, `anonymous
1419 references`__(http://www.example.org/anonymous/) using two
1420 underscores would probably be preferable.
1422 __ http://mail.python.org/pipermail/doc-sig/2002-June/002648.html
1424 The syntax, advantages, and disadvantages are similar to those of
1429 - The target is specified immediately adjacent to the reference.
1433 - Poor plaintext readability.
1434 - Targets cannot be reused (unless named, but the semantics are
1439 - The ``"`ref`_(URL)"`` syntax forces the last word of the
1440 reference text to be joined to the URL, making a potentially
1441 very long word that can't be wrapped (URLs can be very long).
1442 The reference and the URL should be separate. This is a
1443 symptom of the following point:
1445 - The syntax produces a single compound construct made up of two
1446 equally important parts, *with syntax in the middle*, *between*
1447 the reference and the target. This is unprecedented in
1450 - The "inline hyperlink" text is *not* a named reference (there's
1451 no lookup by name), so it shouldn't look like one.
1453 - According to the IETF standards RFC 2396 and RFC 2732,
1454 parentheses are legal URI characters and curly braces are legal
1455 email characters, making their use prohibitively difficult.
1457 - The named/anonymous semantics are unclear.
1459 2. After an analysis__ of the syntax of (1) above, we came up with the
1460 following compromise syntax::
1462 This is an anonymous reference__
1463 __<http://www.example.org/reference/> of one word
1464 ("reference"). Here is a `phrase reference`__
1465 __<http://www.example.org/phrase_reference/>. `Named
1466 references`_ _<http://www.example.org/anonymous/> use single
1469 __ http://mail.python.org/pipermail/doc-sig/2002-July/002670.html
1471 The syntax builds on that of the existing "inline internal
1472 targets": ``an _`inline internal target`.``
1476 - The target is specified immediately adjacent to the reference,
1477 improving maintainability:
1479 - References and targets are easily kept in sync.
1480 - The reference text does not have to be repeated.
1482 - The construct is executed in two parts: references identical to
1483 existing references, and targets that are new but not too big a
1484 stretch from current syntax.
1486 - There's overwhelming precedent for quoting URLs with angle
1491 - Poor plaintext readability.
1492 - Lots of "line noise".
1493 - Targets cannot be reused (unless named; see below).
1495 To alleviate the readability issue slightly, we could allow the
1496 target to appear later, such as after the end of the sentence::
1498 This is a named reference__ of one word ("reference").
1499 __<http://www.example.org/reference/> Here is a `phrase
1500 reference`__. __<http://www.example.org/phrase_reference/>
1502 Problem: this could only work for one reference at a time
1503 (reference/target pairs must be proximate [refA trgA refB trgB],
1504 not interleaved [refA refB trgA trgB] or nested [refA refB trgB
1505 trgA]). This variation is too problematic; references and inline
1506 external targets will have to be kept imediately adjacent (see (3)
1509 The ``"reference__ __<target>"`` syntax is actually for "anonymous
1510 inline external targets", emphasized by the double underscores. It
1511 follows that single trailing and leading underscores would lead to
1512 *implicitly named* inline external targets. This would allow the
1513 reuse of targets by name. So after ``"reference_ _<target>"``,
1514 another ``"reference_"`` would point to the same target.
1517 From RFC 2396 (URI syntax):
1519 The angle-bracket "<" and ">" and double-quote (")
1520 characters are excluded [from URIs] because they are often
1521 used as the delimiters around URI in text documents and
1524 Using <> angle brackets around each URI is especially
1525 recommended as a delimiting style for URI that contain
1528 From RFC 822 (email headers):
1530 Angle brackets ("<" and ">") are generally used to indicate
1531 the presence of a one machine-usable reference (e.g.,
1532 delimiting mailboxes), possibly including source-routing to
1535 3. If it is best for references and inline external targets to be
1536 immediately adjacent, then they might as well be integrated.
1537 Here's an alternative syntax embedding the target URL in the
1540 This is an anonymous `reference <http://www.example.org
1541 /reference/>`__ of one word ("reference"). Here is a `phrase
1542 reference <http://www.example.org/phrase_reference/>`__.
1544 Advantages and disadvantages are similar to those in (2).
1545 Readability is still an issue, but the syntax is a bit less
1546 heavyweight (reduced line noise). Backquotes are required, even
1547 for one-word references; the target URL is included within the
1548 reference text, forcing a phrase context.
1550 We'll call this variant "embedded URIs".
1552 Problem: how to refer to a title like "HTML Anchors: <a>" (which
1553 ends with an HTML/SGML/XML tag)? We could either require more
1554 syntax on the target (like ``"`reference text
1555 __<http://example.com/>`__"``), or require the odd conflicting
1556 title to be escaped (like ``"`HTML Anchors: \<a>`__"``). The
1557 latter seems preferable, and not too onerous.
1559 Similarly to (2) above, a single trailing underscore would convert
1560 the reference & inline external target from anonymous to implicitly
1561 named, allowing reuse of targets by name.
1563 I think this is the least objectionable of the syntax alternatives.
1565 Other syntax variations have been proposed (by Brett Cannon and Benja
1568 `phrase reference`->http://www.example.com
1570 `phrase reference`@http://www.example.com
1572 `phrase reference`__ ->http://www.example.com
1574 `phrase reference` [-> http://www.example.com]
1576 `phrase reference`__ [-> http://www.example.com]
1578 `phrase reference` <http://www.example.com>_
1580 None of these variations are clearly superior to #3 above. Some have
1581 problems that exclude their use.
1583 With any kind of inline external target syntax it comes down to the
1584 conflict between maintainability and plaintext readability. I don't
1585 see a major problem with reStructuredText's maintainability, and I
1586 don't want to sacrifice plaintext readability to "improve" it.
1588 The proponents of inline external targets want them for easily
1589 maintainable web pages. The arguments go something like this:
1591 - Named hyperlinks are difficult to maintain because the reference
1592 text is duplicated as the target name.
1594 To which I said, "So use anonymous hyperlinks."
1596 - Anonymous hyperlinks are difficult to maintain becuase the
1597 references and targets have to be kept in sync.
1599 "So keep the targets close to the references, grouped after each
1600 paragraph. Maintenance is trivial."
1602 - But targets grouped after paragraphs break the flow of text.
1604 "Surely less than URLs embedded in the text! And if the intent is
1605 to produce web pages, not readable plaintext, then who cares about
1608 Many participants have voiced their objections to the proposed syntax:
1610 Garth Kidd: "I strongly prefer the current way of doing it.
1611 Inline is spectactularly messy, IMHO."
1613 Tony Ibbs: "I vehemently agree... that the inline alternatives
1614 being suggested look messy - there are/were good reasons they've
1615 been taken out... I don't believe I would gain from the new
1618 Paul Moore: "I agree as well. The proposed syntax is far too
1619 punctuation-heavy, and any of the alternatives discussed are
1620 ambiguous or too subtle."
1622 Others have voiced their support:
1624 fantasai: "I agree with Simon. In many cases, though certainly
1625 not in all, I find parenthesizing the url in plain text flows
1626 better than relegating it to a footnote."
1628 Ken Manheimer: "I'd like to weigh in requesting some kind of easy,
1629 direct inline reference link."
1631 (Interesting that those *against* the proposal have been using
1632 reStructuredText for a while, and those *for* the proposal are either
1633 new to the list ["fantasai", background unknown] or longtime
1634 StructuredText users [Ken Manheimer].)
1636 I was initially ambivalent/against the proposed "inline external
1637 targets". I value reStructuredText's readability very highly, and
1638 although the proposed syntax offers convenience, I don't know if the
1639 convenience is worth the cost in ugliness. Does the proposed syntax
1640 compromise readability too much, or should the choice be left up to
1641 the author? Perhaps if the syntax is *allowed* but its use strongly
1642 *discouraged*, for aesthetic/readability reasons?
1644 After a great deal of thought and much input from users, I've decided
1645 that there are reasonable use cases for this construct. The
1646 documentation should strongly caution against its use in most
1647 situations, recommending independent block-level targets instead.
1648 Syntax #3 above ("embedded URIs") will be used.
1651 Doctree Representation of Transitions
1652 =====================================
1654 (Although not reStructuredText-specific, this section fits best in
1657 Having added the "horizontal rule" construct to the `reStructuredText
1658 Markup Specification`_, a decision had to be made as to how to reflect
1659 the construct in the implementation of the document tree. Given this
1671 The horizontal rule indicates a "transition" (in prose terms) or the
1672 start of a new "division". Before implementation, the parsed document
1676 <section name="document">
1681 -------- <--- error here
1685 There are several possibilities for the implementation:
1687 1. Implement horizontal rules as "divisions" or segments. A
1688 "division" is a title-less, non-hierarchical section. The first
1689 try at an implementation looked like this::
1692 <section name="document">
1701 But the two paragraphs are really at the same level; they shouldn't
1702 appear to be at different levels. There's really an invisible
1703 "first division". The horizontal rule splits the document body
1704 into two segments, which should be treated uniformly.
1706 2. Treating "divisions" uniformly brings us to the second
1710 <section name="document">
1720 With this change, documents and sections will directly contain
1721 divisions and sections, but not body elements. Only divisions will
1722 directly contain body elements. Even without a horizontal rule
1723 anywhere, the body elements of a document or section would be
1724 contained within a division element. This makes the document tree
1725 deeper. This is similar to the way HTML_ treats document contents:
1726 grouped within a ``<body>`` element.
1728 3. Implement them as "transitions", empty elements::
1731 <section name="document">
1740 A transition would be a "point element", not containing anything,
1741 only identifying a point within the document structure. This keeps
1742 the document tree flatter, but the idea of a "point element" like
1743 "transition" smells bad. A transition isn't a thing itself, it's
1744 the space between two divisions. However, transitions are a
1747 Solution 3 was chosen for incorporation into the document tree model.
1749 .. _HTML: http://www.w3.org/MarkUp/
1755 indent-tabs-mode: nil
1756 sentence-end-double-space: t