Skip to content

Commit d52bd29

Browse files
committed
Update documentation formatting
1 parent 32c5a5b commit d52bd29

File tree

11 files changed

+685
-593
lines changed

11 files changed

+685
-593
lines changed

docs/src/markdown/about/changelog.md

Lines changed: 243 additions & 239 deletions
Large diffs are not rendered by default.

docs/src/markdown/about/contributing.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ any tier you feel comfortable with. No amount is too little. We also accept one
1010

1111
## Bug Reports
1212

13-
1. Please **read the documentation** and **search the issue tracker** to try and find the answer to your question
14-
**before** posting an issue.
13+
1. Please **read the documentation** and **search the issue tracker** to try and find the answer to your question
14+
**before** posting an issue.
1515

16-
2. When creating an issue on the repository, please provide as much info as possible:
16+
2. When creating an issue on the repository, please provide as much info as possible:
1717

18-
- Version being used.
19-
- Operating system.
20-
- Version of Python.
21-
- Errors in console.
22-
- Detailed description of the problem.
23-
- Examples for reproducing the error. You can post pictures, but if specific text or code is required to reproduce
24-
the issue, please provide the text in a plain text format for easy copy/paste.
18+
- Version being used.
19+
- Operating system.
20+
- Version of Python.
21+
- Errors in console.
22+
- Detailed description of the problem.
23+
- Examples for reproducing the error. You can post pictures, but if specific text or code is required to
24+
reproduce the issue, please provide the text in a plain text format for easy copy/paste.
2525

2626
The more info provided, the greater the chance someone will take the time to answer, implement, or fix the issue.
2727

28-
3. Be prepared to answer questions and provide additional information if required. Issues in which the creator refuses
29-
to respond to follow up questions will be marked as stale and closed.
28+
3. Be prepared to answer questions and provide additional information if required. Issues in which the creator refuses
29+
to respond to follow up questions will be marked as stale and closed.
3030

3131
## Reviewing Code
3232

docs/src/markdown/about/release.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -114,22 +114,22 @@ If we want to modify the pattern matcher, and not just the the directory scanner
114114

115115
These changes were done for a couple of reasons:
116116

117-
1. Generally, it is rare to specifically want `.` and `..`, so often when people glob with something like `**/.*`, they
118-
are just trying to get hidden files. While we generally model our behavior off Bash, there are many alternative
119-
shells (such as Zsh) that do not return or match `.` and `..` with magic patterns by design, regardless of what
120-
directory scanner returns.
121-
122-
2. Many people who come to use our library are probably coming from having experience with Python's glob. By mirroring
123-
this behavior out of the box, it may help people adapt to the library easier.
124-
125-
3. Python's `pathlib`, which Wildcard Match's `pathlib` is derived from, normalizes paths by stripping out `.`
126-
directories and trimming off trailing slashes. This means patterns such as `**/.*`, which would normally match both
127-
`.hidden` and `.hidden/.`, would normalize those results to return two `.hidden` results. Mirroring this behavior
128-
helps provide more sane results and prevent confusing duplicates when using `pathlib`.
129-
130-
4. This is not unique behavior to Python's glob and our implementation. For example, let's take a look at
131-
[`node-glob`](https://github.com/isaacs/node-glob) and its underlying match library called
132-
[`minimatch`](https://github.com/isaacs/minimatch).
117+
1. Generally, it is rare to specifically want `.` and `..`, so often when people glob with something like `**/.*`, they
118+
are just trying to get hidden files. While we generally model our behavior off Bash, there are many alternative
119+
shells (such as Zsh) that do not return or match `.` and `..` with magic patterns by design, regardless of what
120+
directory scanner returns.
121+
122+
2. Many people who come to use our library are probably coming from having experience with Python's glob. By mirroring
123+
this behavior out of the box, it may help people adapt to the library easier.
124+
125+
3. Python's `pathlib`, which Wildcard Match's `pathlib` is derived from, normalizes paths by stripping out `.`
126+
directories and trimming off trailing slashes. This means patterns such as `**/.*`, which would normally match both
127+
`.hidden` and `.hidden/.`, would normalize those results to return two `.hidden` results. Mirroring this behavior
128+
helps provide more sane results and prevent confusing duplicates when using `pathlib`.
129+
130+
4. This is not unique behavior to Python's glob and our implementation. For example, let's take a look at
131+
[`node-glob`](https://github.com/isaacs/node-glob) and its underlying match library called
132+
[`minimatch`](https://github.com/isaacs/minimatch).
133133

134134
```js
135135
> glob('.*', {}, function (er, files) {

docs/src/markdown/fnmatch.md

Lines changed: 54 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ It is mainly used for matching filenames with glob patterns. For path names, Wil
1111
[`globmatch`](./glob.md#globmatch) is a more appropriate choice. Not all of the features listed below are enabled by
1212
default. See [flags](#flags) for more information.
1313

14-
!!! tip "Backslashes"
15-
When using backslashes, it is helpful to use raw strings. In a raw string, a single backslash is used to escape a
16-
character `#!py3 r'\?'`. If you want to represent a literal backslash, you must use two: `#!py3 r'some\\path'`.
14+
/// tip | Backslashes
15+
When using backslashes, it is helpful to use raw strings. In a raw string, a single backslash is used to escape a
16+
character `#!py3 r'\?'`. If you want to represent a literal backslash, you must use two: `#!py3 r'some\\path'`.
17+
///
1718

1819
Pattern | Meaning
1920
----------------- | -------
@@ -31,11 +32,11 @@ Pattern | Meaning
3132
`!(pattern_list)` | The pattern matches if the input string cannot be matched with any of the patterns in the `pattern_list`. Requires the [`EXTMATCH`](#extmatch) flag.
3233
`{}` | Bash style brace expansions. This is applied to patterns before anything else. Requires the [`BRACE`](#brace) flag.
3334

34-
- Slashes are generally treated as normal characters, but on windows they are normalized. On Windows, `/` will match
35-
both `/` and `\\`. There is no need to explicitly use `\\` in patterns on Windows, but if you do, they must be escaped
36-
to specify a literal `\\`. If a backslash is escaped, it will match all valid windows separators, just like `/` does.
37-
- By default, `.` is *not* matched by `*`, `?`, and `[]`. See the [`DOTMATCH`](#dotmatch) flag to match `.` at
38-
the start of a filename without a literal `.`.
35+
- Slashes are generally treated as normal characters, but on windows they are normalized. On Windows, `/` will match
36+
both `/` and `\\`. There is no need to explicitly use `\\` in patterns on Windows, but if you do, they must be escaped
37+
to specify a literal `\\`. If a backslash is escaped, it will match all valid windows separators, just like `/` does.
38+
- By default, `.` is *not* matched by `*`, `?`, and `[]`. See the [`DOTMATCH`](#dotmatch) flag to match `.` at
39+
the start of a filename without a literal `.`.
3940

4041
--8<-- "posix.md"
4142

@@ -46,8 +47,9 @@ Many of the API functions allow passing in multiple patterns or using either [`B
4647
you can raise or lower this limit via the keyword option `limit`. If you set `limit` to `0`, there will
4748
be no limit.
4849

49-
!!! new "New 6.0"
50-
The imposed pattern limit and corresponding `limit` option was introduced in 6.0.
50+
/// new | New 6.0
51+
The imposed pattern limit and corresponding `limit` option was introduced in 6.0.
52+
///
5153

5254
## API
5355

@@ -116,11 +118,13 @@ False
116118
True
117119
```
118120

119-
!!! new "New 6.0"
120-
`limit` was added in 6.0.
121+
/// new | New 6.0
122+
`limit` was added in 6.0.
123+
///
121124

122-
!!! new "New 8.4"
123-
`exclude` parameter was added.
125+
/// new | New 8.4
126+
`exclude` parameter was added.
127+
///
124128

125129
#### `fnmatch.filter` {: #filter}
126130

@@ -139,11 +143,13 @@ pattern or a list of patterns.It returns a list of all files that matched the pa
139143
['a.txt', 'b.txt']
140144
```
141145

142-
!!! new "New 6.0"
143-
`limit` was added in 6.0.
146+
/// new | New 6.0
147+
`limit` was added in 6.0.
148+
///
144149

145-
!!! new "New 8.4"
146-
`exclude` parameter was added.
150+
/// new | New 8.4
151+
`exclude` parameter was added.
152+
///
147153

148154
#### `fnmatch.translate` {: #translate}
149155

@@ -179,14 +185,17 @@ we wrap the entire group to be captured: `#!py3 '+(a)'` --> `#!py3 r'((a)+)'`.
179185
('file', '33', '.test.txt')
180186
```
181187

182-
!!! new "New 6.0"
183-
`limit` was added in 6.0.
188+
/// new | New 6.0
189+
`limit` was added in 6.0.
190+
///
184191

185-
!!! new "New 7.1"
186-
Translate patterns now provide capturing groups for [`EXTMATCH`](#extmatch) groups.
192+
/// new | New 7.1
193+
Translate patterns now provide capturing groups for [`EXTMATCH`](#extmatch) groups.
194+
///
187195

188-
!!! new "New 8.4"
189-
`exclude` parameter was added.
196+
/// new | New 8.4
197+
`exclude` parameter was added.
198+
///
190199

191200
#### `fnmatch.escape` {: #escape}
192201

@@ -205,8 +214,9 @@ backslashes, regardless of what feature is or is not enabled. It is meant to esc
205214
True
206215
```
207216

208-
!!! new "New 8.1"
209-
An `escape` variant for `fnmatch` was made available in 8.1.
217+
/// new | New 8.1
218+
An `escape` variant for `fnmatch` was made available in 8.1.
219+
///
210220

211221
### `fnmatch.is_magic` {: #is_magic}
212222

@@ -241,8 +251,9 @@ Default | `?*[]\`
241251
[`MINUSNEGATE`](#minusnegate) | `-`
242252
[`SPLIT`](#split) | `|`
243253

244-
!!! new "New 8.1"
245-
Added `is_magic` in 8.1.
254+
/// new | New 8.1
255+
Added `is_magic` in 8.1.
256+
///
246257

247258
## Flags
248259

@@ -299,11 +310,11 @@ other character. Dots will not be matched in `[]`, `*`, or `?`.
299310
`EXTMATCH` enables extended pattern matching. This includes special pattern lists such as `+(...)`, `*(...)`, `?(...)`,
300311
etc. See the [syntax overview](#syntax) for more information.
301312

302-
!!! tip "EXTMATCH and NEGATE"
303-
304-
When using `EXTMATCH` and [`NEGATE`](#negate) together, if a pattern starts with `!(`, the pattern will not
305-
be treated as a [`NEGATE`](#negate) pattern (even if `!(` doesn't yield a valid `EXTMATCH` pattern). To
306-
negate a pattern that starts with a literal `(`, you must escape the bracket: `!\(`.
313+
/// tip | EXTMATCH and NEGATE
314+
When using `EXTMATCH` and [`NEGATE`](#negate) together, if a pattern starts with `!(`, the pattern will not
315+
be treated as a [`NEGATE`](#negate) pattern (even if `!(` doesn't yield a valid `EXTMATCH` pattern). To
316+
negate a pattern that starts with a literal `(`, you must escape the bracket: `!\(`.
317+
///
307318

308319
#### `fnmatch.BRACE, fnmatch.B` {: #brace}
309320

@@ -314,20 +325,21 @@ Redundant, identical patterns are discarded[^1] by default.
314325
For simple patterns, it may make more sense to use [`EXTMATCH`](#extmatch) which will only generate a single
315326
pattern which will perform much better: `@(ab|ac|ad)`.
316327

317-
!!! warning "Massive Expansion Risk"
318-
1. It is important to note that each pattern is matched separately, so patterns such as `{1..100}` would generate
328+
/// warning | Massive Expansion Risk
329+
1. It is important to note that each pattern is matched separately, so patterns such as `{1..100}` would generate
319330
**one hundred** patterns. Sometimes patterns like this are needed, so construct patterns thoughtfully and carefully.
320331

321-
2. `BRACE` and [`SPLIT`](#split) both expand patterns into multiple patterns. Using these two syntaxes
332+
2. `BRACE` and [`SPLIT`](#split) both expand patterns into multiple patterns. Using these two syntaxes
322333
simultaneously can exponential increase in duplicate patterns:
323334

324-
```pycon3
325-
>>> expand('test@(this{|that,|other})|*.py', BRACE | SPLIT | EXTMATCH)
326-
['test@(this|that)', 'test@(this|other)', '*.py', '*.py']
327-
```
335+
```pycon3
336+
>>> expand('test@(this{|that,|other})|*.py', BRACE | SPLIT | EXTMATCH)
337+
['test@(this|that)', 'test@(this|other)', '*.py', '*.py']
338+
```
328339
329-
This effect is reduced as redundant, identical patterns are optimized away[^1]. But it is useful to know if
330-
trying to construct efficient patterns.
340+
This effect is reduced as redundant, identical patterns are optimized away[^1]. But it is useful to know if
341+
trying to construct efficient patterns.
342+
///
331343
332344
[^1]: Identical patterns are only reduced by comparing case sensitively as POSIX character classes are case sensitive:
333345
`[[:alnum:]]` =/= `[[:ALNUM:]]`.

0 commit comments

Comments
 (0)