Commit Graph

530 Commits

Author SHA1 Message Date
FUJIWARA Katsunori
8e59a858bd doc: translate from :hg:help config.SECTION to a valid link to hgrc.5.html
Before this patch, ":hg:`help config.SECTION`" in online help text is
translated to a link to "hg.1.html#config.SECTION" in HTML
unintentionally.

This patch translates from :hg:`help config.SECTION` in online help
text to a valid link to "hgrc.5.html#SECTION" in HTML.

This patch ignores element(s) under "SECTION" (e.g. "ITEM" of
":hg:`help config.SECTION.ITEM`"), because there is no way to refer
directly to it in HTML, yet.
2016-02-11 23:15:34 +09:00
FUJIWARA Katsunori
4436dba238 doc: translate from :hg:help config to a valid link to hgrc.5.html
Before this patch, ":hg:`help config`" in online help text is
translated to a link to "hg.1.html#config" in HTML, even though actual
"hg help config" shows not help for "hg config" command but "config"
help topic, and all of current ":hg:`help config`" expects the latter.

This patch translates from ":hg:`help config`" in online help text to
a link to "hgrc.5.html" in HTML as expected.

This patch also allows ":hg:`help -c COMMAND`" style to link
"hg.1.html#COMMAND" for readability.
2016-02-11 23:15:34 +09:00
FUJIWARA Katsunori
357c04e06b docchecker: use indentation of 4 spaces
This is fixing for 'must indent 4 spaces' check-code rule.

check-code has overlooked this, because a file isn't recognized as one
to be checked (this problem is fixed by subsequent patch).
2016-02-10 22:44:29 +09:00
FUJIWARA Katsunori
c26e9ad792 docchecker: remove naked except clause
This is fixing for 'naked except clause' check-code rule.

check-code has overlooked this, because a file isn't recognized as one
to be checked (this problem is fixed by subsequent patch).
2016-02-10 22:44:29 +09:00
Bryan O'Sullivan
425505f93a check-seclevel: use a context manager for file I/O 2016-01-12 14:28:16 -08:00
timeless
81962ef57d docchecker: scan for missing space before :hg: 2016-01-06 20:05:18 +00:00
timeless
70bec9473a docchecker: introduce a way to check for poor markup
Specifically, :hg:`foo 'bar baz'` when rendered by `hg help`
results in:

  'hg foo 'bar baz''

... which is hard to read.

We encourage :hg:`foo "bar baz"` instead.
2016-01-06 19:47:14 +00:00
Jun Wu
ea41b32b83 mercurial: pass ui to extensions.load (issue5007)
extensions.load does need ui argument to print error if an extension
fails to load.
2015-12-17 10:30:17 +00:00
Bryan O'Sullivan
d7b0a811b8 check-seclevel: pass a ui to the extension loader
Without this, if an import error occurs (as with pypy), the attempt to
report it fails since ui is None.
2015-12-22 21:38:06 -08:00
Bryan O'Sullivan
b75f25ac1e check-seclevel: add a --debug option
This will make it possible to get semi-meaningful tracebacks if an import
error occurs.

Why care? Trying to run this script under pypy currently fails, but the
true error is obscured.
2015-12-22 21:38:05 -08:00
timeless
b7fa6a1a27 doc: add execute bit and fix shbang line for gendoc.py 2015-12-22 07:59:14 +00:00
Gregory Szorc
b6d0b58fa7 doc: make gendoc.py module import policy aware
Without this, running gendoc.py during an install without C modules
available (via `make local`) will result in an import failure because
the default module load policy insists on C modules.

We also remove the sys.path adjustment because it is no longer needed
since our magic importer handles things.
2015-12-12 13:23:29 -05:00
Gregory Szorc
ec18b44ca2 check-seclevel: set module load policy to Python only
If we don't change this, the upcoming change to make the module
loading policy only load C modules will cause this script to fail if
run with CPython against an unbuilt source checkout.
2015-11-24 22:53:55 -08:00
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
Yuya Nishihara
2f746aa9d3 help: pass around ui to doc loader (API)
This is necessary to hide DEPRECATED items conditionally.

Flagged as API change because it will break "hg help git|subversion".
2015-09-26 12:06:30 +09:00
Yuya Nishihara
958a6389af gendoc: use real ui in place of stdout
ui attributes will be required by a help function, so a file object can't be
used as a fake ui.
2015-09-27 23:34:37 +09:00
Yuya Nishihara
f3df68f405 check-seclevel: use ui to show status and error messages
Future patches will require ui module to be passed to a help function, so
let's use it where appropriate.

Additional parens are necessary to silence a check-code warning.
2015-09-27 22:29:07 +09:00
Yuya Nishihara
4b52e9276e check-seclevel: wrap entry point by function
This is intended to narrow scope of local variables. The global _verbose
flag will be replaced later by ui.verbose.
2015-09-27 22:19:54 +09:00
Yuya Nishihara
a63986f458 check-seclevel: set executable bit as it has shebang 2015-09-27 22:16:24 +09:00
timeless@mozdev.org
96eb7ea38c hgmanpage: fix grammar
remove 's's from places where they don't belong
insert the preposition 'in'
2015-09-08 13:22:01 -04:00
timeless@mozdev.org
52f5c5239d check-seclevel: fix file description grammar 2015-09-08 12:54:39 -04:00
Mads Kiilerich
b2b60414f6 spelling: fixes from proofreading of spell checker issues 2015-01-18 02:38:57 +01:00
Augie Fackler
9f565e54cb gendoc: restore use of callable() since it was readded in Python 3.2 2014-06-23 09:23:57 -04:00
Augie Fackler
4b15479b96 check-seclevel: restore use of callable() since it was readded in Python 3.2 2014-06-23 09:23:47 -04:00
FUJIWARA Katsunori
138416bff7 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.
2014-03-11 14:36:40 +09:00
Simon Heimberg
ff9aaaba6b doc: gendoc.py creates valid output for option descriptions with newlines
gendoc.py did not handle the hanging indentation for descriptions. Work around
this by joining all in one single line (same as in minirst since previous
patch).

This problem occurred when translations of option lines were very long. Do not
bother the translators with this detail.

On a long option description, the translator continued on a new line as usual.
gendoc.py created invalid rst syntax like this:

-o, --option
    Description line 1
description line 2

The new output is:

-o, --option
    Description line 1 description line 2

The lines could theoretically become very long, but line breaking is handled
when generating the final documentation.
2014-02-20 09:17:22 +01:00
FUJIWARA Katsunori
8c1c74a873 doc: show details of command options in pages generated by docutils
Before this patch, HTML/man pages generated by docutils don't show
details of each command options, whether it should take argument or
not for example, even though "hg help" does.

This patch shows details of command options as same as "hg help"
shows.

This patch uses "--option <VALUE[+]>" style instead of "--option
<VALUE> [+]" used in output of "hg help", because docutils requires
that option argument strings starts with "<" and ends with ">".
2013-11-08 14:42:09 +09:00
Takumi IINO
c57d1116da doc: make i18n man and html
Allow overwrite LANGUAGE and LC_ALL make variables, for make i18n man and html.
After this patch, we can make i18n man and html by following command:

  $ make clean all LANGUAGE=ja
2013-07-03 21:50:20 +09:00
Takumi IINO
2d38f7b9dd doc: make man and html from translated documents
Before this patch, man and html are english only, and there sources are not
translatable.
This patch make translatable all documents.
2013-07-03 21:49:43 +09:00
Takumi IINO
4e9e5e1a97 gendoc: dispatch print document content by commandline arguments
Before this patch, gendoc.py only prints hg.1.gendoc.txt content.
This adds any content print function.
2013-07-03 21:49:41 +09:00
Takumi IINO
aa35bddf6e gendoc: add showtopic
This function prints any topic.
2013-07-03 21:49:39 +09:00
Takumi IINO
6a0123c5c5 gendoc: rename to showdoc from show_doc
This function prints hg.1.gendoc.txt content.
2013-07-03 21:49:37 +09:00
Simon Heimberg
6059e06d0f cleanup: drop unused variables and an unused import 2013-07-01 20:48:56 +02:00
Matt Mackall
db1209d4bd merge with stable 2013-06-21 15:31:40 -05:00
Matt Mackall
ea11ead369 docs: change description to synopsis in hgrc.5
Spotted by Eric S. Raymond.
2013-06-20 14:06:11 -05:00
Simon Heimberg
8a32578a00 cleanup: remove unused imports
detected by pyflakes
2013-06-13 01:36:58 +02:00
Takumi IINO
b0aea72ba7 gendoc: extract print help topics into a dedicated function
This will be used in an upcoming patch.
2013-05-15 15:44:59 +09:00
Takumi IINO
9b959d84eb gendoc: make commnd __doc__ and extension __doc__ as translatable
Before this patch, commnd __doc__ and extension __doc__ are not translatable.
But other messages, like doc of helptalbe, section headers, are translatable.

This patch makes commnd __doc__ and extension __doc__ translatable.
2013-05-15 15:44:55 +09:00
Mads Kiilerich
3f5dd3e256 codingstyle: remove trailing spaces in various text files
Better do it once than see random changes in diffs later.
2013-04-17 03:40:18 +02:00
Mads Kiilerich
eeb6ef563e check-code: check txt files for trailing whitespace 2013-04-15 01:37:23 +02: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
ac8e1fc147 check-code: there must also be whitespace between ')' and operator
The check pattern only checked for whitespace between keyword and operator.

Now it also warns:
 >     x = f(),7
 missing whitespace after ,
 >     x = f()+7
 missing whitespace in expression
2012-12-09 23:33:16 +01:00
FUJIWARA Katsunori
807a8f6caa doc: add the tool to check section marks in help documents
This patch adds "doc/check-seclevel.py" which checks below in help
documents:

  - whether unknown or unavailable section marks are used or not
  - whether appropriate section mark is used at sub-sectioning

It should be invoked in "doc" directory.

It checks all help documents of Mercurial (topics, commands,
extensions), if no file is specified by --file option.

With --file option, it checks contents of the specified file as help
document, for self testing purpose: -t/-c/-e/-C are used to specify
what kind of help document contents of the specified file is.

This checking is related to changeset 8d980034517b.
2012-08-13 21:25:48 +09:00
timeless@mozdev.org
faad4fb533 spelling: Structured 2012-08-17 13:58:19 -07:00
timeless@mozdev.org
5e8f508211 spelling: don't/do not 2012-08-17 13:58:18 -07:00
FUJIWARA Katsunori
0cf97588a4 doc: unify section level between help topics
Some help topics use "-" for the top level underlining section mark,
but "-" is used also for the top level categorization in generated
documents: "hg.1.html", for example.

So, TOC in such documents contain "sections in each topics", too.

This patch changes underlining section mark in some help topics to
unify section level in generated documents.

After this patching, levels of each section marks are:

  level0
  """"""
    level1
    ======
      level2
      ------
        level3
        ......
          level4
          ######

And use of section markers in each documents are:

  - mercurial/help/*.txt can use level1 or more
    (now these use level1 and level2)

  - help for core commands can use level2 or more
    (now these use no section marker)

  - descriptions of extensions can use level2 or more
    (now hgext/acl uses level2)

  - help for commands defined in extension can use level4 or more
    (now "convert" of hgext/convert uses level4)

"Level0" is used as top level categorization only in "doc/hg.1.txt"
and the intermediate file generated by "doc/gendoc.py", so end users
don't see it in "hg help" outoput and so on.
2012-07-25 16:40:38 +09:00
Brodie Rao
a7ef0a0cc5 cleanup: "not x in y" -> "x not in y" 2012-05-12 16:00:57 +02:00
Brodie Rao
d6a6abf2b0 cleanup: eradicate long lines 2012-05-12 15:54:54 +02:00
Nikolaj Sjujskij
4640646cf7 build: fix hgrc manpage building with docutils 0.9
Since docutils 0.9, `roman` module has been moved from module directory root
(i.e. `site-packages/roman.py`) to `docutils.utils` module. Therefore `import
roman` statement should be wrapped in `try: ... except ImportError: ...` block
to handle importing correctly.
2012-05-08 23:59:39 +04:00