Skip to content

Commit

Permalink
Fix rustdoc getting hung up over code blocks in Quantity doc comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnavion committed Aug 13, 2024
1 parent f33d49e commit 01bbc51
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 15 deletions.
4 changes: 3 additions & 1 deletion k8s-openapi-codegen-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,8 @@ fn get_comment_text<'a>(s: &'a str, indent: &'a str) -> impl Iterator<Item = std
.replace(']', r"\]")
.replace('<', r"\<")
.replace('>', r"\>")
.replace('\t', " ");
.replace('\t', " ")
.replace("```", "");

let line =
if *previous_line_was_empty && line.starts_with(" ") {
Expand All @@ -1103,6 +1104,7 @@ fn get_comment_text<'a>(s: &'a str, indent: &'a str) -> impl Iterator<Item = std
else {
line
};
let line = line.trim_end();

*previous_line_was_empty = false;

Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
#![allow(
clippy::default_trait_access,
clippy::derive_partial_eq_without_eq,
clippy::doc_lazy_continuation,
clippy::doc_markdown,
clippy::large_enum_variant,
clippy::match_single_binding,
clippy::missing_errors_doc,
clippy::module_name_repetitions,
clippy::must_use_candidate,
clippy::similar_names,
clippy::single_match_else,
clippy::too_many_lines,
clippy::type_complexity,
Expand Down
4 changes: 2 additions & 2 deletions src/v1_25/apimachinery/pkg/api/resource/quantity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
///
/// The serialization format is:
///
/// ``` \<quantity\> ::= \<signedNumber\>\<suffix\>
/// \<quantity\> ::= \<signedNumber\>\<suffix\>
///
/// (Note that \<suffix\> may be empty, from the "" case in \<decimalSI\>.)
///
Expand All @@ -16,7 +16,7 @@
///
/// (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)
///
/// \<decimalExponent\> ::= "e" \<signedNumber\> | "E" \<signedNumber\> ```
/// \<decimalExponent\> ::= "e" \<signedNumber\> | "E" \<signedNumber\>
///
/// No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities.
///
Expand Down
4 changes: 2 additions & 2 deletions src/v1_26/apimachinery/pkg/api/resource/quantity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
///
/// The serialization format is:
///
/// ``` \<quantity\> ::= \<signedNumber\>\<suffix\>
/// \<quantity\> ::= \<signedNumber\>\<suffix\>
///
/// (Note that \<suffix\> may be empty, from the "" case in \<decimalSI\>.)
///
Expand All @@ -16,7 +16,7 @@
///
/// (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)
///
/// \<decimalExponent\> ::= "e" \<signedNumber\> | "E" \<signedNumber\> ```
/// \<decimalExponent\> ::= "e" \<signedNumber\> | "E" \<signedNumber\>
///
/// No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities.
///
Expand Down
4 changes: 2 additions & 2 deletions src/v1_27/apimachinery/pkg/api/resource/quantity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
///
/// The serialization format is:
///
/// ``` \<quantity\> ::= \<signedNumber\>\<suffix\>
/// \<quantity\> ::= \<signedNumber\>\<suffix\>
///
/// (Note that \<suffix\> may be empty, from the "" case in \<decimalSI\>.)
///
Expand All @@ -16,7 +16,7 @@
///
/// (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)
///
/// \<decimalExponent\> ::= "e" \<signedNumber\> | "E" \<signedNumber\> ```
/// \<decimalExponent\> ::= "e" \<signedNumber\> | "E" \<signedNumber\>
///
/// No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities.
///
Expand Down
4 changes: 2 additions & 2 deletions src/v1_28/apimachinery/pkg/api/resource/quantity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
///
/// The serialization format is:
///
/// ``` \<quantity\> ::= \<signedNumber\>\<suffix\>
/// \<quantity\> ::= \<signedNumber\>\<suffix\>
///
/// (Note that \<suffix\> may be empty, from the "" case in \<decimalSI\>.)
///
Expand All @@ -16,7 +16,7 @@
///
/// (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)
///
/// \<decimalExponent\> ::= "e" \<signedNumber\> | "E" \<signedNumber\> ```
/// \<decimalExponent\> ::= "e" \<signedNumber\> | "E" \<signedNumber\>
///
/// No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities.
///
Expand Down
4 changes: 2 additions & 2 deletions src/v1_29/apimachinery/pkg/api/resource/quantity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
///
/// The serialization format is:
///
/// ``` \<quantity\> ::= \<signedNumber\>\<suffix\>
/// \<quantity\> ::= \<signedNumber\>\<suffix\>
///
/// (Note that \<suffix\> may be empty, from the "" case in \<decimalSI\>.)
///
Expand All @@ -16,7 +16,7 @@
///
/// (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)
///
/// \<decimalExponent\> ::= "e" \<signedNumber\> | "E" \<signedNumber\> ```
/// \<decimalExponent\> ::= "e" \<signedNumber\> | "E" \<signedNumber\>
///
/// No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities.
///
Expand Down
4 changes: 2 additions & 2 deletions src/v1_30/apimachinery/pkg/api/resource/quantity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
///
/// The serialization format is:
///
/// ``` \<quantity\> ::= \<signedNumber\>\<suffix\>
/// \<quantity\> ::= \<signedNumber\>\<suffix\>
///
/// (Note that \<suffix\> may be empty, from the "" case in \<decimalSI\>.)
///
Expand All @@ -16,7 +16,7 @@
///
/// (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)
///
/// \<decimalExponent\> ::= "e" \<signedNumber\> | "E" \<signedNumber\> ```
/// \<decimalExponent\> ::= "e" \<signedNumber\> | "E" \<signedNumber\>
///
/// No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities.
///
Expand Down
4 changes: 2 additions & 2 deletions src/v1_31/apimachinery/pkg/api/resource/quantity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
///
/// The serialization format is:
///
/// ``` \<quantity\> ::= \<signedNumber\>\<suffix\>
/// \<quantity\> ::= \<signedNumber\>\<suffix\>
///
/// (Note that \<suffix\> may be empty, from the "" case in \<decimalSI\>.)
///
Expand All @@ -16,7 +16,7 @@
///
/// (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)
///
/// \<decimalExponent\> ::= "e" \<signedNumber\> | "E" \<signedNumber\> ```
/// \<decimalExponent\> ::= "e" \<signedNumber\> | "E" \<signedNumber\>
///
/// No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities.
///
Expand Down

0 comments on commit 01bbc51

Please sign in to comment.