changeset 9291:cd5b6a11b607

minirst: indent literal blocks with two spaces The vast majority* of them are formatted like this in the source, so this basically reverts the output to how it looked before we got the minirst parser. *: the help on templating use four spaces for some examples and will now shown with an indentation of just two spaces.
author Martin Geisler <mg@lazybytes.net>
date Sun, 02 Aug 2009 17:17:17 +0200
parents 26fb5b0a4424
children 01e580143423
files mercurial/minirst.py tests/test-convert.out tests/test-dispatch.out tests/test-extension.out tests/test-help.out tests/test-keyword.out tests/test-minirst.py tests/test-minirst.py.out tests/test-mq.out tests/test-notify.out tests/test-record.out
diffstat 11 files changed, 110 insertions(+), 104 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/minirst.py	Sun Aug 02 16:34:25 2009 +0200
+++ b/mercurial/minirst.py	Sun Aug 02 17:17:17 2009 +0200
@@ -243,7 +243,10 @@
     indent = ' ' * block['indent']
     if block['type'] == 'margin':
         return ''
-    elif block['type'] in ('literal', 'section'):
+    elif block['type'] == 'literal':
+        indent += '  '
+        return indent + ('\n' + indent).join(block['lines'])
+    elif block['type'] == 'section':
         return indent + ('\n' + indent).join(block['lines'])
     elif block['type'] == 'definition':
         term = indent + block['lines'][0]
--- a/tests/test-convert.out	Sun Aug 02 16:34:25 2009 +0200
+++ b/tests/test-convert.out	Sun Aug 02 17:17:17 2009 +0200
@@ -45,7 +45,7 @@
     maps each source commit ID to the destination ID for that revision, like
     so:
 
-    <source ID> <destination ID>
+      <source ID> <destination ID>
 
     If the file doesn't exist, it's automatically created. It's updated on
     each commit copied, so convert-repo can be interrupted and can be run
@@ -60,11 +60,11 @@
     directories. Comment lines start with '#'. Each line can contain one of
     the following directives:
 
-    include path/to/file
+      include path/to/file
 
-    exclude path/to/file
+      exclude path/to/file
 
-    rename from/file to/file
+      rename from/file to/file
 
     The 'include' directive causes a file, or all files under a directory, to
     be included in the destination repository, and the exclusion of all other
@@ -122,7 +122,7 @@
     its internal changeset merging code by default but can be configured to
     call the external 'cvsps' program by setting:
 
-    --config convert.cvsps='cvsps -A -u --cvs-direct -q'
+      --config convert.cvsps='cvsps -A -u --cvs-direct -q'
 
     This option is deprecated and will be removed in Mercurial 1.4.
 
@@ -130,7 +130,7 @@
 
     Internal cvsps is selected by setting
 
-    --config convert.cvsps=builtin
+      --config convert.cvsps=builtin
 
     and has a few more configurable options:
 
--- a/tests/test-dispatch.out	Sun Aug 02 16:34:25 2009 +0200
+++ b/tests/test-dispatch.out	Sun Aug 02 17:17:17 2009 +0200
@@ -13,9 +13,9 @@
     a format string. The formatting rules are the same as for the export
     command, with the following additions:
 
-    %s   basename of file being printed
-    %d   dirname of file being printed, or '.' if in repository root
-    %p   root-relative path name of file being printed
+      %s   basename of file being printed
+      %d   dirname of file being printed, or '.' if in repository root
+      %p   root-relative path name of file being printed
 
 options:
 
--- a/tests/test-extension.out	Sun Aug 02 16:34:25 2009 +0200
+++ b/tests/test-extension.out	Sun Aug 02 17:17:17 2009 +0200
@@ -33,7 +33,7 @@
 
 enabled extensions:
 
- debugextension   only debugcommands
+   debugextension   only debugcommands
 
 global options:
  -R --repository      repository root directory or symbolic path name
@@ -63,7 +63,7 @@
 
 enabled extensions:
 
- debugextension   only debugcommands
+   debugextension   only debugcommands
 
 global options:
  -R --repository      repository root directory or symbolic path name
--- a/tests/test-help.out	Sun Aug 02 16:34:25 2009 +0200
+++ b/tests/test-help.out	Sun Aug 02 17:17:17 2009 +0200
@@ -268,14 +268,14 @@
 
     The codes used to show the status of files are:
 
-    M = modified
-    A = added
-    R = removed
-    C = clean
-    ! = missing (deleted by non-hg command, but still tracked)
-    ? = not tracked
-    I = ignored
-      = origin of the previous file listed as A (added)
+      M = modified
+      A = added
+      R = removed
+      C = clean
+      ! = missing (deleted by non-hg command, but still tracked)
+      ? = not tracked
+      I = ignored
+        = origin of the previous file listed as A (added)
 
 options:
 
--- a/tests/test-keyword.out	Sun Aug 02 16:34:25 2009 +0200
+++ b/tests/test-keyword.out	Sun Aug 02 17:17:17 2009 +0200
@@ -13,10 +13,10 @@
 
 Example:
 
-[keyword]
-# expand keywords in every python file except those matching "x*"
-**.py =
-x*    = ignore
+  [keyword]
+  # expand keywords in every python file except those matching "x*"
+  **.py =
+  x*    = ignore
 
 NOTE: the more specific you are in your filename patterns the less you lose
 speed in huge repositories.
@@ -54,9 +54,9 @@
 
 enabled extensions:
 
- keyword   expand keywords in tracked files
- mq        manage a stack of patches
- notify    hooks for sending email notifications at commit/push time
+   keyword   expand keywords in tracked files
+   mq        manage a stack of patches
+   notify    hooks for sending email notifications at commit/push time
 
 use "hg -v help keyword" to show aliases and global options
 % hg kwdemo
--- a/tests/test-minirst.py	Sun Aug 02 16:34:25 2009 +0200
+++ b/tests/test-minirst.py	Sun Aug 02 17:17:17 2009 +0200
@@ -106,7 +106,8 @@
 
 ::
 
-  Literal block with no indentation.
+  Literal block with no indentation (apart from
+  the two spaces added to all literal blocks).
 """
 
 debugformat('lists', lists, 60)
--- a/tests/test-minirst.py.out	Sun Aug 02 16:34:25 2009 +0200
+++ b/tests/test-minirst.py.out	Sun Aug 02 17:17:17 2009 +0200
@@ -66,20 +66,20 @@
 ----------------------------------------------------------------------
 The fully minimized form is the most convenient form:
 
-Hello
-  literal
-    world
+  Hello
+    literal
+      world
 
 In the partially minimized form a paragraph simply ends with
 space-double-colon.
 
-////////////////////////////////////////
-long un-wrapped line in a literal block
-\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
+  ////////////////////////////////////////
+  long un-wrapped line in a literal block
+  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
 
-This literal block is started with '::',
-  the so-called expanded form. The paragraph
-    with '::' disappears in the final output.
+  This literal block is started with '::',
+    the so-called expanded form. The paragraph
+      with '::' disappears in the final output.
 ----------------------------------------------------------------------
 
 literals formatted to fit within 30 characters:
@@ -87,21 +87,21 @@
 The fully minimized form is
 the most convenient form:
 
-Hello
-  literal
-    world
+  Hello
+    literal
+      world
 
 In the partially minimized
 form a paragraph simply ends
 with space-double-colon.
 
-////////////////////////////////////////
-long un-wrapped line in a literal block
-\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
+  ////////////////////////////////////////
+  long un-wrapped line in a literal block
+  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
 
-This literal block is started with '::',
-  the so-called expanded form. The paragraph
-    with '::' disappears in the final output.
+  This literal block is started with '::',
+    the so-called expanded form. The paragraph
+      with '::' disappears in the final output.
 ----------------------------------------------------------------------
 
 lists formatted to fit within 60 characters:
@@ -118,12 +118,13 @@
   - This is an indented list item
   - Another indented list item:
 
-    - A literal block in the middle
-          of an indented list.
+      - A literal block in the middle
+            of an indented list.
 
-    (The above is not a list item since we are in the literal block.)
+      (The above is not a list item since we are in the literal block.)
 
-Literal block with no indentation.
+  Literal block with no indentation (apart from
+  the two spaces added to all literal blocks).
 ----------------------------------------------------------------------
 
 lists formatted to fit within 30 characters:
@@ -145,12 +146,13 @@
   - Another indented list
     item:
 
-    - A literal block in the middle
-          of an indented list.
+      - A literal block in the middle
+            of an indented list.
 
-    (The above is not a list item since we are in the literal block.)
+      (The above is not a list item since we are in the literal block.)
 
-Literal block with no indentation.
+  Literal block with no indentation (apart from
+  the two spaces added to all literal blocks).
 ----------------------------------------------------------------------
 
 options formatted to fit within 60 characters:
--- a/tests/test-mq.out	Sun Aug 02 16:34:25 2009 +0200
+++ b/tests/test-mq.out	Sun Aug 02 17:17:17 2009 +0200
@@ -10,17 +10,17 @@
 
 Common tasks (use "hg help command" for more details):
 
-prepare repository to work with patches   qinit
-create new patch                          qnew
-import existing patch                     qimport
+  prepare repository to work with patches   qinit
+  create new patch                          qnew
+  import existing patch                     qimport
 
-print patch series                        qseries
-print applied patches                     qapplied
-print name of top applied patch           qtop
+  print patch series                        qseries
+  print applied patches                     qapplied
+  print name of top applied patch           qtop
 
-add known patch to applied stack          qpush
-remove patch from applied stack           qpop
-refresh contents of top applied patch     qrefresh
+  add known patch to applied stack          qpush
+  remove patch from applied stack           qpop
+  refresh contents of top applied patch     qrefresh
 
 list of commands:
 
@@ -53,7 +53,7 @@
 
 enabled extensions:
 
- mq   manage a stack of patches
+   mq   manage a stack of patches
 
 use "hg -v help mq" to show aliases and global options
 adding a
--- a/tests/test-notify.out	Sun Aug 02 16:34:25 2009 +0200
+++ b/tests/test-notify.out	Sun Aug 02 17:17:17 2009 +0200
@@ -5,51 +5,51 @@
 
 To use, configure the notify extension and enable it in hgrc like this:
 
-[extensions]
-hgext.notify =
+  [extensions]
+  hgext.notify =
 
-[hooks]
-# one email for each incoming changeset
-incoming.notify = python:hgext.notify.hook
-# batch emails when many changesets incoming at one time
-changegroup.notify = python:hgext.notify.hook
+  [hooks]
+  # one email for each incoming changeset
+  incoming.notify = python:hgext.notify.hook
+  # batch emails when many changesets incoming at one time
+  changegroup.notify = python:hgext.notify.hook
 
-[notify]
-# config items go here
+  [notify]
+  # config items go here
 
 Required configuration items:
 
-config = /path/to/file # file containing subscriptions
+  config = /path/to/file # file containing subscriptions
 
 Optional configuration items:
 
-test = True            # print messages to stdout for testing
-strip = 3              # number of slashes to strip for url paths
-domain = example.com   # domain to use if committer missing domain
-style = ...            # style file to use when formatting email
-template = ...         # template to use when formatting email
-incoming = ...         # template to use when run as incoming hook
-changegroup = ...      # template when run as changegroup hook
-maxdiff = 300          # max lines of diffs to include (0=none, -1=all)
-maxsubject = 67        # truncate subject line longer than this
-diffstat = True        # add a diffstat before the diff content
-sources = serve        # notify if source of incoming changes in this list
-                       # (serve == ssh or http, push, pull, bundle)
-[email]
-from = user@host.com   # email address to send as if none given
-[web]
-baseurl = http://hgserver/... # root of hg web site for browsing commits
+  test = True            # print messages to stdout for testing
+  strip = 3              # number of slashes to strip for url paths
+  domain = example.com   # domain to use if committer missing domain
+  style = ...            # style file to use when formatting email
+  template = ...         # template to use when formatting email
+  incoming = ...         # template to use when run as incoming hook
+  changegroup = ...      # template when run as changegroup hook
+  maxdiff = 300          # max lines of diffs to include (0=none, -1=all)
+  maxsubject = 67        # truncate subject line longer than this
+  diffstat = True        # add a diffstat before the diff content
+  sources = serve        # notify if source of incoming changes in this list
+                         # (serve == ssh or http, push, pull, bundle)
+  [email]
+  from = user@host.com   # email address to send as if none given
+  [web]
+  baseurl = http://hgserver/... # root of hg web site for browsing commits
 
 The notify config file has same format as a regular hgrc file. It has two
 sections so you can express subscriptions in whatever way is handier for you.
 
-[usersubs]
-# key is subscriber email, value is ","-separated list of glob patterns
-user@host = pattern
+  [usersubs]
+  # key is subscriber email, value is ","-separated list of glob patterns
+  user@host = pattern
 
-[reposubs]
-# key is glob pattern, value is ","-separated list of subscriber emails
-pattern = user@host
+  [reposubs]
+  # key is glob pattern, value is ","-separated list of subscriber emails
+  pattern = user@host
 
 Glob patterns are matched against path to repository root.
 
--- a/tests/test-record.out	Sun Aug 02 16:34:25 2009 +0200
+++ b/tests/test-record.out	Sun Aug 02 17:17:17 2009 +0200
@@ -12,17 +12,17 @@
     and for files with multiple changes, for each change to use. For each
     query, the following responses are possible:
 
-    y - record this change
-    n - skip this change
+      y - record this change
+      n - skip this change
 
-    s - skip remaining changes to this file
-    f - record remaining changes to this file
+      s - skip remaining changes to this file
+      f - record remaining changes to this file
 
-    d - done, skip remaining changes and files
-    a - record all changes to all remaining files
-    q - quit, recording no changes
+      d - done, skip remaining changes and files
+      a - record all changes to all remaining files
+      q - quit, recording no changes
 
-    ? - display help
+      ? - display help
 
 options: