Patchwork doc: show short description of each commands in generated documents

login
register
mail settings
Submitter Katsunori FUJIWARA
Date March 11, 2014, 8:48 a.m.
Message ID <82dab6da07c377efe340.1394527726@feefifofum>
Download mbox | patch
Permalink /patch/3907/
State Accepted
Commit 401f9b661a2d90dd6c933034addd5a9a5253c734
Headers show

Comments

Katsunori FUJIWARA - March 11, 2014, 8:48 a.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1394516200 -32400
#      Tue Mar 11 14:36:40 2014 +0900
# Node ID 82dab6da07c377efe3402d01c92868dd9837780b
# Parent  19e9478c1a2245b6b5b4b2882efee5261d7df963
doc: show short description of each commands in generated documents

Before this patch, short description of each commands is not shown in
generated documents (HTML file and UNIX man page). This omitting may
prevent users from understanding about commands.

This patch show it as the 1st paragraph in the help section of each
commands. This style is chosen because:

  - showing it as the section title in "command - short desc" style
    disallows referencing by "#command" in HTML file: in "en" locale,
    hyphen concatenated title is used as the section ID in HTML file
    for this style

  - showing it as the 1st paragraph in "command - short desc" style
    seems to be redundant: "command" appears also just before as the
    section title

  - showing it just after synopsis like "hg help command" seems not to
    be reasonable in UNIX man page

This patch just writes short description ("d['desc'][0]") before "::",
because it should be already "strip()"-ed in "get_desc()", or empty
string for the command without description.
Matt Mackall - March 11, 2014, 9:36 p.m.
On Tue, 2014-03-11 at 17:48 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> # Date 1394516200 -32400
> #      Tue Mar 11 14:36:40 2014 +0900
> # Node ID 82dab6da07c377efe3402d01c92868dd9837780b
> # Parent  19e9478c1a2245b6b5b4b2882efee5261d7df963
> doc: show short description of each commands in generated documents

Queued for default, thanks.

Patch

diff --git a/doc/gendoc.py b/doc/gendoc.py
--- a/doc/gendoc.py
+++ b/doc/gendoc.py
@@ -156,6 +156,8 @@ 
             continue
         d = get_cmd(h[f], cmdtable)
         ui.write(sectionfunc(d['cmd']))
+        # short description
+        ui.write(d['desc'][0])
         # synopsis
         ui.write("::\n\n")
         synopsislines = d['synopsis'].splitlines()