mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
Delete commented out docs code
This commit is contained in:
parent
547ec2756d
commit
e38823b52a
2 changed files with 29 additions and 83 deletions
|
@ -91,22 +91,7 @@ pub fn build_app<'a>() -> App<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn docs(files: Vec<PathBuf>) {
|
pub fn docs(files: Vec<PathBuf>) {
|
||||||
roc_docs::generate(
|
roc_docs::generate(files, roc_builtins::std::standard_stdlib(), Path::new("./"))
|
||||||
files,
|
|
||||||
// vec![
|
|
||||||
// PathBuf::from(r"./compiler/builtins/docs/Bool.roc"),
|
|
||||||
// // PathBuf::from(r"../compiler/builtins/docs/Dict.roc"),
|
|
||||||
// // Not working
|
|
||||||
// // PathBuf::from(r"../compiler/builtins/docs/List.roc"),
|
|
||||||
// // Not working
|
|
||||||
// // PathBuf::from(r"../compiler/builtins/docs/Num.roc"),
|
|
||||||
// // PathBuf::from(r"../compiler/builtins/docs/Set.roc"),
|
|
||||||
// // PathBuf::from(r"../compiler/builtins/docs/Str.roc"),
|
|
||||||
// ],
|
|
||||||
roc_builtins::std::standard_stdlib(),
|
|
||||||
Path::new("./"),
|
|
||||||
// Path::new("./build"),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build(target: &Triple, matches: &ArgMatches, run_after_build: bool) -> io::Result<()> {
|
pub fn build(target: &Triple, matches: &ArgMatches, run_after_build: bool) -> io::Result<()> {
|
||||||
|
|
|
@ -45,76 +45,37 @@ pub struct TemplateLinkEntry {
|
||||||
name: String,
|
name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
// fn main() {
|
|
||||||
// generate(
|
|
||||||
// vec![
|
|
||||||
// PathBuf::from(r"../compiler/builtins/docs/Bool.roc"),
|
|
||||||
// // PathBuf::from(r"../compiler/builtins/docs/Dict.roc"),
|
|
||||||
// // Not working
|
|
||||||
// // PathBuf::from(r"../compiler/builtins/docs/List.roc"),
|
|
||||||
// // Not working
|
|
||||||
// // PathBuf::from(r"../compiler/builtins/docs/Num.roc"),
|
|
||||||
// // PathBuf::from(r"../compiler/builtins/docs/Set.roc"),
|
|
||||||
// // PathBuf::from(r"../compiler/builtins/docs/Str.roc"),
|
|
||||||
// ],
|
|
||||||
// roc_builtins::std::standard_stdlib(),
|
|
||||||
// Path::new("../compiler/builtins/docs"),
|
|
||||||
// // Path::new("./build"),
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
|
|
||||||
pub fn generate(filenames: Vec<PathBuf>, std_lib: StdLib, build_dir: &Path) {
|
pub fn generate(filenames: Vec<PathBuf>, std_lib: StdLib, build_dir: &Path) {
|
||||||
// let files_docs = files_to_documentations(filenames, std_lib);
|
let files_docs = files_to_documentations(filenames, std_lib);
|
||||||
//
|
//
|
||||||
// // TODO: get info from a file like "elm.json"
|
// TODO: get info from a file like "elm.json"
|
||||||
// let package = roc_load::docs::Documentation {
|
let package = roc_load::docs::Documentation {
|
||||||
// name: "roc/builtins".to_string(),
|
name: "roc/builtins".to_string(),
|
||||||
// version: "1.0.0".to_string(),
|
version: "1.0.0".to_string(),
|
||||||
// docs: "Package introduction or README.".to_string(),
|
docs: "Package introduction or README.".to_string(),
|
||||||
// modules: files_docs,
|
modules: files_docs,
|
||||||
// };
|
};
|
||||||
//
|
|
||||||
// let version_folder = build_dir
|
|
||||||
// .join(package.name.clone())
|
|
||||||
// .join(package.version.clone());
|
|
||||||
//
|
|
||||||
// println!("{}", version_folder.display());
|
|
||||||
|
|
||||||
// // Make sure the output directories exists
|
// Register handlebars template
|
||||||
// fs::create_dir_all(&version_folder)
|
let mut handlebars = handlebars::Handlebars::new();
|
||||||
// .expect("TODO gracefully handle creating directories failing");
|
handlebars
|
||||||
//
|
.register_template_file("page", "./docs/src/templates/page.hbs")
|
||||||
// // Register handlebars template
|
.expect("TODO gracefully handle registering template failing");
|
||||||
// let mut handlebars = handlebars::Handlebars::new();
|
|
||||||
// handlebars
|
// Write each package's module docs html file
|
||||||
// .register_template_file("page", "./docs/src/templates/page.hbs")
|
for module in &package.modules {
|
||||||
// .expect("TODO gracefully handle registering template failing");
|
let template = documentation_to_template_data(&package, module);
|
||||||
//
|
|
||||||
// // Write each package's module docs html file
|
let handlebars_data = handlebars::to_json(&template);
|
||||||
// for module in &package.modules {
|
let filepath = build_dir.join(format!("{}.html", module.name));
|
||||||
// let template = documentation_to_template_data(&package, module);
|
let mut output_file =
|
||||||
//
|
fs::File::create(filepath).expect("TODO gracefully handle creating file failing");
|
||||||
// let handlebars_data = handlebars::to_json(&template);
|
handlebars
|
||||||
// let filepath = version_folder.join(format!("{}.html", module.name));
|
.render_to_write("page", &handlebars_data, &mut output_file)
|
||||||
// let mut output_file =
|
.expect("TODO gracefully handle writing file failing");
|
||||||
// fs::File::create(filepath).expect("TODO gracefully handle creating file failing");
|
}
|
||||||
// handlebars
|
|
||||||
// .render_to_write("page", &handlebars_data, &mut output_file)
|
println!("Docs generated at {}", build_dir.display());
|
||||||
// .expect("TODO gracefully handle writing file failing");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // Copy /static folder content to /build
|
|
||||||
// let copy_options = fs_extra::dir::CopyOptions {
|
|
||||||
// overwrite: true,
|
|
||||||
// skip_exist: false,
|
|
||||||
// buffer_size: 64000, //64kb
|
|
||||||
// copy_inside: false,
|
|
||||||
// content_only: true,
|
|
||||||
// depth: 0,
|
|
||||||
// };
|
|
||||||
// fs_extra::dir::copy("./docs/src/static/", &build_dir, ©_options)
|
|
||||||
// .expect("TODO gracefully handle copying static content failing");
|
|
||||||
// println!("Docs generated at {}", build_dir.display());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn files_to_documentations(
|
pub fn files_to_documentations(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue