Commit Graph

90 Commits

Author SHA1 Message Date
Mads Kiilerich
09567db49a spelling: trivial spell checking 2015-10-17 00:58:46 +02:00
Matt Mackall
5e1b4ad958 urls: bulk-change primary website URLs 2015-09-30 15:43:49 -05:00
timeless@mozdev.org
ea3920eaa0 minirst: establish leveling for nested definitions 2015-09-10 10:48:20 -04:00
timeless@mozdev.org
d58a9315b3 minirst: handle edge in hunting for parents
test for "hg help -c config" in help config

``section``
-----------
section text

``def1``
    definition of def1
    $ hg help scope.def1
    should list this paragraph, but not section text below...

section text

``def2``
    definition of def2
    $ hg help scope.def2
    should list this paragraph, but not section text below...

section text
$ hg help scope.section should show everything from the first
section text to this last line.

``section2``
------------
2015-09-03 17:06:27 -04:00
timeless@mozdev.org
f9b3b64087 minirst: don't treat top level item as children of last item (issue4803)
test for "hg help -c config" in help config
2015-09-02 15:12:08 -04:00
timeless@mozdev.org
3a5cdbfaac help: distinguish sections when multiple match (issue4802) 2015-08-30 19:03:38 -04:00
Gregory Szorc
77d714a7aa minirst: use absolute_import 2015-08-08 19:42:16 -07:00
Matt Harbison
1ea0ae2f3c help: support 'hg help template.somekeyword'
Previously the output was simply 'abort: help section not found'.
2015-07-04 23:11:32 -04:00
Jordi Gutiérrez Hermoso
cea41a20fd help: show all nested subsections of a section with hg help foo.section
Used to be that `hg help hgrc.paths` would show

    "paths"
    -------

    Assigns symbolic names to repositories. The left side is the symbolic
    name, and the right gives the directory or URL that is the location of the
    repository. Default paths can be declared by setting the following
    entries.

and stop there. Obviously the result seems better as shown in the
attached test.
2014-10-06 07:35:53 -04:00
Jordi Gutiérrez Hermoso
76e10f34d1 help: fix output of sections in hg help foo.somesection
There was a bug in df3ceb2fbb4d. The block that added definitions to
getsections should have been an elif, not an if. Otherwise section
titles get added twice, since the else clause would always get
executed for section titles.
2014-10-06 07:29:38 -04:00
Matt Mackall
e5c9cc0aaf help: basic support for showing only specified topic sections
For instance, 'hg help config.files' will show only the Files section.
2014-09-30 16:40:10 -05:00
Matt Mackall
0b131abaec minirst: allow multiple container types for prune
If we have a container of type x.y, then we can preserve it by
keeping x or y.
2014-09-30 15:48:43 -05:00
Matt Mackall
ceb82a6112 minirst: explicitly decode substitutions
Caught by Augie and sys.setdefaultencoding("undefined")
2014-06-13 14:14:02 -05:00
Augie Fackler
7457cb9d81 minirst: move from dict() construction to {} literals
The latter are both faster and more consistent across Python 2 and 3.
2014-03-12 13:20:24 -04:00
Simon Heimberg
0aad267371 minirst: create valid output when table data contains a newline
When table data contained a newline, the result of minirst.maketable
did not look nice plus it was not recognised by minirst.format:
  == === ====
  l1 1   one
  l2 2   2
22
  l3
  == === ====

This problem occurred when the description of options had a very long
translation which was split by newlines. Do not bother a translator with
this detail.

The multiline translations for option descriptions have been fixed in
7a88a81d5d9e in it.po, de.po and ro.po. I manually did the same as this patch
does, I removed the newlines.

When a newline was in the description, this created unusable help output:
  $ hg help somecommand
  hg somecommand [option]...

  with somecommand, you can...

  options:

  == =================== =======================================================
  =================================== --longdesc VALUE    xxxxxxxxxxxxxxxxxxxxxx
  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -n --norm
  normal desc --newline VALUE line1 line2 == =================== ===============
  ===========================================================================

now this looks much nicer:
  ...
  options:

      --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                       xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
   -n --norm           normal desc
      --newline VALUE  line1 line2
2014-02-19 17:32:21 +01:00
Mads Kiilerich
92dc407d90 comments: fix minor spelling issues found with spell checker 2014-02-20 02:39:01 +01:00
Simon Heimberg
386dcc916f minirst: do not add a 2nd empty paragraph
This does not add a separating block after a separated note directive.

.. note::

    text

is formatted to

Note:
    text
2013-11-04 10:23:06 +01:00
Simon Heimberg
664e8c41fe minirst: find admonitions before pruning comments and adding margins
Lines with only a directive are not deleted anymore because they are detected
before comments are deleted by prunecomments().
addmargins() will be adapted later.
2013-11-04 10:23:06 +01:00
Simon Heimberg
c5557c2259 minirst: do not fail on an empty admonition block 2013-11-04 10:23:06 +01:00
Simon Heimberg
0e05d277a4 minirst: do not interpret a directive as a literal block
When a directive was on its own line, it was interpreted as a literal block.

Example of problematic input:

.. note::

    a note text
2013-11-04 10:23:06 +01:00
Dan Villiom Podlaski Christiansen
17ccef70f8 minirst: optimize HTML table generation a bit
avoid a couple of array copies and string interpolations
2013-02-09 21:51:21 +00:00
Dan Villiom Podlaski Christiansen
e6781fbadb minirst: HTML formatter tweaks
output table rows on distinct lines
don't make the first row a table header
2013-02-09 21:51:21 +00:00
Dan Villiom Podlaski Christiansen
5ff9149ead minirst: CGI escape strings prior to embedding it in the HTML 2013-02-09 17:44:25 -05:00
Dan Villiom Podlaski Christiansen
768b2c3969 minirst: don't generate TH elements for the first row in table
We mainly use them for option tables -- browsers bolding and centering
them looks wrong.
2013-02-09 21:51:21 +00:00
Dan Villiom Podlaski Christiansen
d045d03b91 help: use a full header for topic titles
...for prettier HTML!
2013-02-10 12:58:57 +01:00
Mads Kiilerich
2f4504e446 fix trivial spelling errors 2012-08-15 22:38:42 +02:00
Olav Reinert
70c42374e2 minirst: generate tables as a list of joined lines 2012-06-01 11:58:23 +02:00
Olav Reinert
cfc7a5074e minirst: simplify and standardize field list formatting
The default width of field lists is changed from 12 to 14 to align minirst with
the rst2html tool. Shrinking the width of the left column to fit the content is
removed, to keep formatting simple and uniform.
2012-01-11 18:08:25 +01:00
FUJIWARA Katsunori
f6b7a91d98 minirst: use unicode string as intermediate form for replacement
# this change redones part of e0051068893a, backed out by 38c00c035629

Some character encodings use ASCII characters other than
control/alphabet/digit as a part of multi-bytes characters, so direct
replacing with such characters on strings in local encoding causes
invalid byte sequences.

[mpm: test changed to simple doctest]
2011-10-31 21:06:18 +09:00
Matt Mackall
7791d14df5 minirst: add style flag to format 2011-10-15 00:39:04 -05:00
Matt Mackall
cdd258d4fd minirst: add basic HTML formatting support 2011-10-15 00:39:01 -05:00
Matt Mackall
2a412dcdd8 rst: fix detection of single-row tables
This fixes option lists for commands with only an --mq option.
2011-10-02 13:13:46 -05:00
Matt Mackall
4204f3ffa5 help: use RST to format option lists 2011-09-21 13:00:48 -05:00
Matt Mackall
52b9791173 minirst: fix column handling for simple tables 2011-09-21 13:00:47 -05:00
Matt Mackall
cca20e5611 minirst: end all blocks with newlines
Formerly RST blocks were formatted without a trailing newline, which
wasn't particularly helpful. Now everything that comes back from the
formatter has a trailing newline so remove all the extra ones added by
users.
2011-09-17 14:17:09 -05:00
Matt Mackall
35cdad6929 minirst: don't choke on empty text 2011-09-17 13:42:11 -05:00
Matt Mackall
5195ef177c minirst: remove some whitespace 2011-09-17 13:37:50 -05:00
Matt Mackall
39b5b8b931 minirst: remove pointless transcoding 2011-09-17 13:37:49 -05:00
Matt Mackall
f48ca50b08 minirst: fix container stripping logic 2011-09-16 14:37:53 -05:00
Matt Mackall
a2ffbae5a5 minirst: add a helper function to build an RST table from an array 2011-08-11 22:40:43 -05:00
Matt Mackall
08834d9ea2 minirst: drop debug code
This standalone mode no longer works due to the mechanics of import
and util. When run not as part of a package, the import of util causes
an import of the built-in posix module, which doesn't contain the
expected symbols. This is difficult to fix in Py2.4.
2011-08-11 22:40:41 -05:00
Matt Mackall
4f50548371 minirst: add simple table support
This adds a subset of the 'simple table' support from RST to allow
formatting of options lists through RST. Table columns are
automatically sized based on contents, with line wrapping in the last
column.
2011-08-11 22:05:57 -05:00
Matt Mackall
b9b0379815 minirst: only strip leading newlines, not indentation 2011-08-11 22:05:31 -05:00
Matt Mackall
5fb24e4d76 minirst: add decorateblocks search helper 2011-08-02 17:43:20 -05:00
Matt Mackall
4cee9b4b85 minirst: add getsections helper 2011-08-02 17:43:18 -05:00
Matt Mackall
9b6295af46 minirst: add formatblocks helper 2011-08-02 17:41:45 -05:00
Matt Mackall
8a607bdb6b minirst: add parse method to get document structure 2011-08-02 14:54:38 -05:00
Martin Geisler
ce8ced9777 minirst: read test input from stdin 2011-05-26 10:46:34 +02:00
Dan Villiom Podlaski Christiansen
511c941422 prevent transient leaks of file handle by using new helper functions
These leaks may occur in environments that don't employ a reference
counting GC, i.e. PyPy.

This implies:
 - changing opener(...).read() calls to opener.read(...)
 - changing opener(...).write() calls to opener.write(...)
 - changing open(...).read(...) to util.readfile(...)
 - changing open(...).write(...) to util.writefile(...)
2011-05-02 10:11:18 +02:00
Erik Zielke
cd95a50630 minirst: improved support for option lists.
This enables minirst to parse and print option lists which have both
long and short options. Before, we could only parse option lists with
long options.
2010-11-02 17:44:19 +01:00