This commit is contained in:
2024-12-25 11:44:17 +01:00
parent 27ef87f9c7
commit fbae8eeb2a
38 changed files with 1021 additions and 35 deletions

31
doc.vsh
View File

@@ -9,21 +9,26 @@ println('Formatting code...')
if os.system('v fmt -w ${abs_dir_of_script}/examples') != 0 {
eprintln('Warning: Failed to format examples')
}
if os.system('v fmt -w ${abs_dir_of_script}/herolib') != 0 {
if os.system('v fmt -w ${abs_dir_of_script}/lib') != 0 {
eprintln('Warning: Failed to format herolib')
}
// Clean existing docs
println('Cleaning existing documentation...')
os.rmdir_all('${abs_dir_of_script}/docs') or {}
herolib_path := os.join_path(abs_dir_of_script, 'herolib')
os.rmdir_all('_docs') or {}
os.rmdir_all('docs') or {}
os.rmdir_all('vdocs') or {}
herolib_path := os.join_path(abs_dir_of_script, 'lib')
os.chdir(herolib_path) or {
panic('Failed to change directory to herolib: ${err}')
}
os.rmdir_all('_docs') or {}
os.rmdir_all('docs') or {}
os.rmdir_all('vdocs') or {}
// Generate HTML documentation
println('Generating HTML documentation...')
@@ -36,20 +41,20 @@ os.rename('_docs', '${abs_dir_of_script}/docs') or {
panic('Failed to move documentation to parent directory: ${err}')
}
os.chdir(abs_dir_of_script) or {
panic('Failed to change directory to abs_dir_of_script: ${err}')
}
// Generate Markdown documentation
println('Generating Markdown documentation...')
os.rmdir_all('vdocs') or {}
os.mkdir_all('vdocs/v') or {
panic('Failed to create v docs directory: ${err}')
}
os.mkdir_all('vdocs/crystal') or {
panic('Failed to create crystal docs directory: ${err}')
}
if os.system('v doc -m -no-color -f md -o vdocs/v/') != 0 {
panic('Failed to generate V markdown documentation')
}
if os.system('v doc -m -no-color -f md -o vdocs/crystal/') != 0 {
// if os.system('v doc -m -no-color -f md -o ../vdocs/v/') != 0 {
// panic('Failed to generate V markdown documentation')
// }
if os.system('v doc -m -no-color -f md -o vdocs/herolib/') != 0 {
panic('Failed to generate Crystal markdown documentation')
}