Run automatically format code blocks with Black (#3191)

This commit is contained in:
Jonathan Plasse 2023-02-27 16:14:05 +01:00 committed by GitHub
parent 386ca7c9a1
commit d285f5c90a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
66 changed files with 420 additions and 394 deletions

View file

@ -78,7 +78,7 @@ fn process_documentation(documentation: &str, out: &mut String) {
if line.starts_with("## ") {
in_options = line == "## Options\n";
} else if in_options {
if let Some(rest) = line.strip_prefix("* `") {
if let Some(rest) = line.strip_prefix("- `") {
let option = rest.trim_end().trim_end_matches('`');
assert!(
@ -87,7 +87,7 @@ fn process_documentation(documentation: &str, out: &mut String) {
);
let anchor = option.rsplit('.').next().unwrap();
out.push_str(&format!("* [`{option}`][{option}]\n"));
out.push_str(&format!("- [`{option}`][{option}]\n"));
after.push_str(&format!("[{option}]: ../../settings#{anchor}"));
continue;
@ -100,6 +100,7 @@ fn process_documentation(documentation: &str, out: &mut String) {
out.push_str("\n\n");
out.push_str(&after);
}
out.push('\n');
}
#[cfg(test)]
@ -116,7 +117,7 @@ Something [`else`][other].
## Options
* `mccabe.max-complexity`
- `mccabe.max-complexity`
[other]: http://example.com.",
&mut out,
@ -129,11 +130,11 @@ Something [`else`][other].
## Options
* [`mccabe.max-complexity`][mccabe.max-complexity]
- [`mccabe.max-complexity`][mccabe.max-complexity]
[other]: http://example.com.
[mccabe.max-complexity]: ../../settings#max-complexity"
[mccabe.max-complexity]: ../../settings#max-complexity\n"
);
}
}