change up docs format (#1711)

* change up docs format

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* change up docs format

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* change up docs format

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* workflow to push docs

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix[

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* initial commit

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* initial commit

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* initial commit

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2024-03-13 14:22:22 -07:00
committed by GitHub
parent a60bdd4cc3
commit 4be9f70965
77 changed files with 12727 additions and 12351 deletions

View File

@ -835,14 +835,25 @@ mod tests {
let combined = stdlib.combined();
let mut buf = String::new();
buf.push_str("<!--- DO NOT EDIT THIS FILE. IT IS AUTOMATICALLY GENERATED. -->\n\n");
buf.push_str(
r#"---
title: "KCL Standard Library"
excerpt: "Documentation for the KCL standard library for the Zoo Modeling App."
layout: manual
---
"#,
);
buf.push_str("# KCL Standard Library\n\n");
buf.push_str("## Types\n\n");
// Generate a table of contents.
buf.push_str("## Table of Contents\n\n");
buf.push_str("* [Functions](#functions)\n");
buf.push_str("* [Types](types.md)\n");
buf.push_str("* [Known Issues](KNOWN-ISSUES.md)\n");
for key in combined.keys().sorted() {
let internal_fn = combined.get(key).unwrap();
@ -850,14 +861,14 @@ mod tests {
continue;
}
buf.push_str(&format!("\t* [`{}`](#{})\n", internal_fn.name(), internal_fn.name()));
buf.push_str(&format!("* [`{}`]({}.md)\n", internal_fn.name(), internal_fn.name()));
}
buf.push_str("\n\n");
buf.push_str("## Functions\n\n");
// Write the index.
expectorate::assert_contents("../../../docs/kcl/index.md", &buf);
for key in combined.keys().sorted() {
let mut buf = String::new();
let internal_fn = combined.get(key).unwrap();
if internal_fn.unpublished() {
continue;
@ -865,10 +876,20 @@ mod tests {
let mut fn_docs = String::new();
fn_docs.push_str(&format!(
r#"---
title: "{}"
excerpt: "{}"
layout: manual
---
"#,
internal_fn.name(),
internal_fn.summary()
));
if internal_fn.deprecated() {
fn_docs.push_str(&format!("### {} DEPRECATED\n\n", internal_fn.name()));
} else {
fn_docs.push_str(&format!("### {}\n\n", internal_fn.name()));
fn_docs.push_str("**WARNING:** This function is deprecated.\n\n");
}
fn_docs.push_str(&format!("{}\n\n", internal_fn.summary()));
@ -880,7 +901,7 @@ mod tests {
fn_docs.push_str("\n```\n\n");
if !internal_fn.examples().is_empty() {
fn_docs.push_str("#### Examples\n\n");
fn_docs.push_str("### Examples\n\n");
for example in internal_fn.examples() {
fn_docs.push_str("```kcl\n");
@ -889,7 +910,7 @@ mod tests {
}
}
fn_docs.push_str("#### Arguments\n\n");
fn_docs.push_str("### Arguments\n\n");
for arg in internal_fn.args() {
let (format, should_be_indented) = arg.get_type_string().unwrap();
let optional_string = if arg.required { " (REQUIRED)" } else { " (OPTIONAL)" }.to_string();
@ -908,11 +929,11 @@ mod tests {
}
if let Some(return_type) = internal_fn.return_value() {
fn_docs.push_str("\n#### Returns\n\n");
fn_docs.push_str("\n### Returns\n\n");
if let Some(description) = return_type.description() {
fn_docs.push_str(&format!("* `{}` - {}\n", return_type.type_, description));
fn_docs.push_str(&format!("`{}` - {}\n", return_type.type_, description));
} else {
fn_docs.push_str(&format!("* `{}`\n", return_type.type_));
fn_docs.push_str(&format!("`{}`\n", return_type.type_));
}
let (format, should_be_indented) = return_type.get_type_string().unwrap();
@ -924,9 +945,10 @@ mod tests {
fn_docs.push_str("\n\n\n");
buf.push_str(&fn_docs);
}
expectorate::assert_contents("../../../docs/kcl/std.md", &buf);
// Write the file.
expectorate::assert_contents(&format!("../../../docs/kcl/{}.md", internal_fn.name()), &buf);
}
}
#[test]