Skip to content

Commit d64c77a

Browse files
authored
Rollup merge of #54989 - Munksgaard:fix-htmldocck-typos, r=tmandry
Fix spelling in the documentation to htmldocck.py I was reading through htmldocck.py, and decided to attempt to clean it up a little bit. Let me know if you disagree with my edits.
2 parents 9eae552 + 1de8f51 commit d64c77a

File tree

3 files changed

+30
-28
lines changed

3 files changed

+30
-28
lines changed

src/etc/htmldocck.py

+27-25
Original file line numberDiff line numberDiff line change
@@ -15,65 +15,66 @@
1515
1616
The principle is simple: This script receives a path to generated HTML
1717
documentation and a "template" script, which has a series of check
18-
commands like `@has` or `@matches`. Each command can be used to check if
18+
commands like `@has` or `@matches`. Each command is used to check if
1919
some pattern is present or not present in the particular file or in
20-
the particular node of HTML tree. In many cases, the template script
21-
happens to be a source code given to rustdoc.
20+
a particular node of the HTML tree. In many cases, the template script
21+
happens to be the source code given to rustdoc.
2222
2323
While it indeed is possible to test in smaller portions, it has been
2424
hard to construct tests in this fashion and major rendering errors were
25-
discovered much later. This script is designed for making the black-box
26-
and regression testing of Rustdoc easy. This does not preclude the needs
27-
for unit testing, but can be used to complement related tests by quickly
25+
discovered much later. This script is designed to make black-box and
26+
regression testing of Rustdoc easy. This does not preclude the needs for
27+
unit testing, but can be used to complement related tests by quickly
2828
showing the expected renderings.
2929
3030
In order to avoid one-off dependencies for this task, this script uses
3131
a reasonably working HTML parser and the existing XPath implementation
32-
from Python's standard library. Hopefully we won't render
32+
from Python's standard library. Hopefully, we won't render
3333
non-well-formed HTML.
3434
3535
# Commands
3636
3737
Commands start with an `@` followed by a command name (letters and
3838
hyphens), and zero or more arguments separated by one or more whitespace
39-
and optionally delimited with single or double quotes. The `@` mark
40-
cannot be preceded by a non-whitespace character. Other lines (including
41-
every text up to the first `@`) are ignored, but it is recommended to
42-
avoid the use of `@` in the template file.
39+
characters and optionally delimited with single or double quotes. The `@`
40+
mark cannot be preceded by a non-whitespace character. Other lines
41+
(including every text up to the first `@`) are ignored, but it is
42+
recommended to avoid the use of `@` in the template file.
4343
4444
There are a number of supported commands:
4545
46-
* `@has PATH` checks for the existence of given file.
46+
* `@has PATH` checks for the existence of the given file.
4747
4848
`PATH` is relative to the output directory. It can be given as `-`
4949
which repeats the most recently used `PATH`.
5050
5151
* `@has PATH PATTERN` and `@matches PATH PATTERN` checks for
52-
the occurrence of given `PATTERN` in the given file. Only one
53-
occurrence of given pattern is enough.
52+
the occurrence of the given pattern `PATTERN` in the specified file.
53+
Only one occurrence of the pattern is enough.
5454
5555
For `@has`, `PATTERN` is a whitespace-normalized (every consecutive
5656
whitespace being replaced by one single space character) string.
5757
The entire file is also whitespace-normalized including newlines.
5858
5959
For `@matches`, `PATTERN` is a Python-supported regular expression.
60-
The file remains intact but the regexp is matched with no `MULTILINE`
61-
and `IGNORECASE` option. You can still use a prefix `(?m)` or `(?i)`
60+
The file remains intact but the regexp is matched without the `MULTILINE`
61+
and `IGNORECASE` options. You can still use a prefix `(?m)` or `(?i)`
6262
to override them, and `\A` and `\Z` for definitely matching
6363
the beginning and end of the file.
6464
6565
(The same distinction goes to other variants of these commands.)
6666
6767
* `@has PATH XPATH PATTERN` and `@matches PATH XPATH PATTERN` checks for
68-
the presence of given `XPATH` in the given HTML file, and also
69-
the occurrence of given `PATTERN` in the matching node or attribute.
70-
Only one occurrence of given pattern in the match is enough.
68+
the presence of the given XPath `XPATH` in the specified HTML file,
69+
and also the occurrence of the given pattern `PATTERN` in the matching
70+
node or attribute. Only one occurrence of the pattern in the match
71+
is enough.
7172
7273
`PATH` should be a valid and well-formed HTML file. It does *not*
7374
accept arbitrary HTML5; it should have matching open and close tags
7475
and correct entity references at least.
7576
76-
`XPATH` is an XPath expression to match. This is fairly limited:
77+
`XPATH` is an XPath expression to match. The XPath is fairly limited:
7778
`tag`, `*`, `.`, `//`, `..`, `[@attr]`, `[@attr='value']`, `[tag]`,
7879
`[POS]` (element located in given `POS`), `[last()-POS]`, `text()`
7980
and `@attr` (both as the last segment) are supported. Some examples:
@@ -85,19 +86,20 @@
8586
- `//h1[@class="fqn"]/span[1]/a[last()]/@class` matches a value of
8687
`class` attribute in the last `a` element (can be followed by more
8788
elements that are not `a`) inside the first `span` in the `h1` with
88-
a class of `fqn`. Note that there cannot be no additional elements
89+
a class of `fqn`. Note that there cannot be any additional elements
8990
between them due to the use of `/` instead of `//`.
9091
9192
Do not try to use non-absolute paths, it won't work due to the flawed
9293
ElementTree implementation. The script rejects them.
9394
9495
For the text matches (i.e. paths not ending with `@attr`), any
9596
subelements are flattened into one string; this is handy for ignoring
96-
highlights for example. If you want to simply check the presence of
97-
given node or attribute, use an empty string (`""`) as a `PATTERN`.
97+
highlights for example. If you want to simply check for the presence of
98+
a given node or attribute, use an empty string (`""`) as a `PATTERN`.
9899
99-
* `@count PATH XPATH COUNT' checks for the occurrence of given XPath
100-
in the given file. The number of occurrences must match the given count.
100+
* `@count PATH XPATH COUNT' checks for the occurrence of the given XPath
101+
in the specified file. The number of occurrences must match the given
102+
count.
101103
102104
* `@has-dir PATH` checks for the existence of the given directory.
103105

src/test/rustdoc/inline_cross/issue-31948-1.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ extern crate rustdoc_nonreachable_impls;
2222
pub use rustdoc_nonreachable_impls::hidden::Wobble;
2323

2424
// @has issue_31948_1/trait.Bark.html
25-
// FIXME(33025): has - '//code' 'for Foo'
25+
// @has - '//code' 'for Foo'
2626
// @has - '//code' 'for Wobble'
2727
// @!has - '//code' 'for Wibble'
2828
pub use rustdoc_nonreachable_impls::Bark;
2929

3030
// @has issue_31948_1/trait.Woof.html
31-
// FIXME(33025): has - '//code' 'for Foo'
31+
// @has - '//code' 'for Foo'
3232
// @has - '//code' 'for Wobble'
3333
// @!has - '//code' 'for Wibble'
3434
pub use rustdoc_nonreachable_impls::Woof;

src/test/rustdoc/inline_cross/issue-31948-2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extern crate rustdoc_nonreachable_impls;
2222
pub use rustdoc_nonreachable_impls::hidden::Wobble;
2323

2424
// @has issue_31948_2/trait.Qux.html
25-
// FIXME(33025): has - '//code' 'for Foo'
25+
// @has - '//code' 'for Foo'
2626
// @has - '//code' 'for Wobble'
2727
pub use rustdoc_nonreachable_impls::hidden::Qux;
2828

0 commit comments

Comments
 (0)