Declare std kwarg functions in KCL and migrate circle (#5955)
* Support calling KCL std KW fns, and move circle to KCL std Signed-off-by: Nick Cameron <nrc@ncameron.org> * Doc comments on parameters Signed-off-by: Nick Cameron <nrc@ncameron.org> * Update grammar Signed-off-by: Nick Cameron <nrc@ncameron.org> * Change use of counterClockWise to ccw Signed-off-by: Nick Cameron <nrc@ncameron.org> --------- Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
@ -467,6 +467,10 @@ fn generate_type_from_kcl(ty: &TyData, file_name: String, example_name: String)
|
||||
});
|
||||
|
||||
let output = hbs.render("kclType", &data)?;
|
||||
let output = cleanup_type_links(
|
||||
&output,
|
||||
ty.referenced_types.iter().filter(|t| !DECLARED_TYPES.contains(&&***t)),
|
||||
);
|
||||
expectorate::assert_contents(format!("../../docs/kcl/{}.md", file_name), &output);
|
||||
|
||||
Ok(())
|
||||
@ -514,6 +518,13 @@ fn generate_function_from_kcl(function: &FnData, file_name: String) -> Result<()
|
||||
});
|
||||
|
||||
let output = hbs.render("function", &data)?;
|
||||
let output = cleanup_type_links(
|
||||
&output,
|
||||
function
|
||||
.referenced_types
|
||||
.iter()
|
||||
.filter(|t| !DECLARED_TYPES.contains(&&***t)),
|
||||
);
|
||||
expectorate::assert_contents(format!("../../docs/kcl/{}.md", file_name), &output);
|
||||
|
||||
Ok(())
|
||||
@ -677,6 +688,12 @@ fn cleanup_type_links<'a>(output: &str, types: impl Iterator<Item = &'a String>)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO handle union types generically rather than special casing them.
|
||||
cleaned_output = cleaned_output.replace(
|
||||
"`Sketch | Plane | Face`",
|
||||
"[`Sketch`](/docs/kcl/types/Sketch) `|` [`Plane`](/docs/kcl/types/Face) `|` [`Plane`](/docs/kcl/types/Face)",
|
||||
);
|
||||
|
||||
cleanup_static_links(&cleaned_output)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user