Skip to content

Commit 08afb12

Browse files
committed
Fix an edge case, ty Jon
1 parent 7df252c commit 08afb12

File tree

7 files changed

+21
-8
lines changed

7 files changed

+21
-8
lines changed

docs/kcl-std/functions/std-array-map.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ map(
1414
): [any]
1515
```
1616

17-
Given a list like [`a, b, c`], and a function like `f`, returns
18-
[`f(a), f(b), f(c)`]
17+
Given a list like `[a, b, c]`, and a function like `f`, returns
18+
`[f(a), f(b), f(c)]`
1919

2020
### Arguments
2121

docs/kcl-std/functions/std-gdt-datum.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ gdt::datum(
2828
|----------|------|-------------|----------|
2929
| `face` | [`TaggedFace`](/docs/kcl-std/types/std-types-TaggedFace) | The face to be annotated. | Yes |
3030
| `name` | [`string`](/docs/kcl-std/types/std-types-string) | The name of the datum. | Yes |
31-
| `framePosition` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | The position of the feature control frame relative to the leader arrow. The default is [`100mm, 100mm`]. | No |
31+
| `framePosition` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | The position of the feature control frame relative to the leader arrow. The default is `[100mm, 100mm]`. | No |
3232
| `framePlane` | [`Plane`](/docs/kcl-std/types/std-types-Plane) | The plane in which to display the feature control frame. The default is `XY`. Other standard planes like `XZ` and `YZ` can also be used. The frame may be displayed in a plane parallel to the given plane. | No |
3333
| `fontPointSize` | [`number(_)`](/docs/kcl-std/types/std-types-number) | The font point size to use for the annotation text rendering. The default is `36`. | No |
3434
| `fontScale` | [`number(_)`](/docs/kcl-std/types/std-types-number) | Scale to use for the annotation text after rendering with the point size. The default is `1.0`. Must be greater than `0`. | No |

docs/kcl-std/functions/std-gdt-flatness.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ gdt::flatness(
3030
| `faces` | [[`TaggedFace`](/docs/kcl-std/types/std-types-TaggedFace); 1+] | The faces to be annotated. | Yes |
3131
| `tolerance` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | The amount of deviation from a perfect plane that is acceptable. | Yes |
3232
| `precision` | [`number(_)`](/docs/kcl-std/types/std-types-number) | The number of decimal places to display. The default is `3`. Must be greater than or equal to `0` and less than or equal to `9`. | No |
33-
| `framePosition` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | The position of the feature control frame relative to the leader arrow. The default is [`100mm, 100mm`]. | No |
33+
| `framePosition` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | The position of the feature control frame relative to the leader arrow. The default is `[100mm, 100mm]`. | No |
3434
| `framePlane` | [`Plane`](/docs/kcl-std/types/std-types-Plane) | The plane in which to display the feature control frame. The default is `XY`. Other standard planes like `XZ` and `YZ` can also be used. The frame may be displayed in a plane parallel to the given plane. | No |
3535
| `fontPointSize` | [`number(_)`](/docs/kcl-std/types/std-types-number) | The font point size to use for the annotation text rendering. The default is `36`. | No |
3636
| `fontScale` | [`number(_)`](/docs/kcl-std/types/std-types-number) | Scale to use for the annotation text after rendering with the point size. The default is `1.0`. Must be greater than `0`. | No |

docs/kcl-std/types/std-types-Point2d.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type Point2d = [number(Length); 2]
1212
```
1313

1414
[`Point2d`](/docs/kcl-std/types/std-types-Point2d) is an alias for a two-element array of [number](/docs/kcl-std/types/std-types-number)s. To write a value
15-
with type [`Point2d`](/docs/kcl-std/types/std-types-Point2d), use an array, e.g., [`0, 0`] or [`5.0, 3.14`].
15+
with type [`Point2d`](/docs/kcl-std/types/std-types-Point2d), use an array, e.g., `[0, 0]` or `[5.0, 3.14]`.
1616

1717

1818

docs/kcl-std/types/std-types-Point3d.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type Point3d = [number(Length); 3]
1212
```
1313

1414
[`Point3d`](/docs/kcl-std/types/std-types-Point3d) is an alias for a three-element array of [number](/docs/kcl-std/types/std-types-number)s. To write a value
15-
with type [`Point3d`](/docs/kcl-std/types/std-types-Point3d), use an array, e.g., [`0, 0, 0`] or [`5.0, 3.14, 6.8`].
15+
with type [`Point3d`](/docs/kcl-std/types/std-types-Point3d), use an array, e.g., `[0, 0, 0]` or `[5.0, 3.14, 6.8]`.
1616

1717

1818

rust/kcl-lib/src/docs/gen_std_tests.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,14 +515,22 @@ fn cleanup_types(input: &str, kcl_std: &ModData) -> String {
515515
}
516516

517517
fn cleanup_type_string(input: &str, fmt_for_text: bool, kcl_std: &ModData) -> String {
518+
if input.contains("a, b, c") {
519+
dbg!(input);
520+
}
518521
let type_tree = match type_formatter::parse(input) {
519522
Ok(type_tree) => type_tree,
520523
Err(e) => {
521524
eprintln!("Could not parse: {input} because {e}");
522525
return input.to_owned();
523526
}
524527
};
525-
type_tree.format(fmt_for_text, kcl_std)
528+
let fmtd = type_tree.format(fmt_for_text, kcl_std);
529+
if !fmtd.contains('`') && fmt_for_text {
530+
format!("`{fmtd}`")
531+
} else {
532+
fmtd
533+
}
526534
}
527535

528536
#[test]
@@ -654,6 +662,11 @@ mod tests {
654662
expected_text: "[[`string`](/docs/kcl-std/types/std-types-string) or [`number(mm)`](/docs/kcl-std/types/std-types-number)]",
655663
expected_no_text: "[string | number(mm)]",
656664
},
665+
Test {
666+
input: "[a, b, c]",
667+
expected_text: "`[a, b, c]`",
668+
expected_no_text: "[a, b, c]",
669+
},
657670
];
658671
for test in tests {
659672
let actual_text = cleanup_type_string(test.input, true, &kcl_std);

rust/kcl-lib/src/docs/gen_std_tests/type_formatter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl<'i> KclType<'i> {
4949
} else if matches!(kcl_std.find_by_name(ty), Some(DocData::Ty(_))) && ty != "tag" {
5050
format!("[`{ty}`](/docs/kcl-std/types/std-types-{ty})")
5151
} else {
52-
format!("`{ty}`")
52+
format!("{ty}")
5353
}
5454
} else {
5555
ty.to_string()

0 commit comments

Comments
 (0)