mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-02 21:03:11 +00:00
Run automatically format code blocks with Black (#3191)
This commit is contained in:
parent
386ca7c9a1
commit
d285f5c90a
66 changed files with 420 additions and 394 deletions
|
|
@ -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"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue