mirror of
https://github.com/cosinekitty/astronomy.git
synced 2026-08-02 10:57:13 -04:00
Generate documentation in Windows. Fix line ending problems.
This commit is contained in:
32
generate/eol_hack.js
Normal file
32
generate/eol_hack.js
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
eol_hack.js - Don Cross
|
||||
|
||||
Fixes line endings in a text file to be CR LF pairs.
|
||||
This is a hack so that there is no diff noise
|
||||
caused by running jsdoc2md from Windows.
|
||||
|
||||
See open bug at:
|
||||
https://github.com/jsdoc2md/jsdoc-to-markdown/issues/112
|
||||
*/
|
||||
'use strict';
|
||||
const fs = require('fs');
|
||||
|
||||
function FixFile(filename) {
|
||||
const inText = fs.readFileSync(filename, 'utf8');
|
||||
const outText = inText.replace(/\r?\n|\r\n?/g, '\r\n');
|
||||
|
||||
if (inText === outText) {
|
||||
console.log(`eol_hack.js: Leaving file as-is: ${filename}`);
|
||||
} else {
|
||||
fs.writeFileSync(filename, outText, 'utf8');
|
||||
console.log(`eol_hack.js: Rewrote line endings: ${filename}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (process.argv.length !== 3) {
|
||||
console.log('USAGE: eol_hack.js filename');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
FixFile(process.argv[2]);
|
||||
process.exit(0);
|
||||
10
generate/makedocs.bat
Normal file
10
generate/makedocs.bat
Normal file
@@ -0,0 +1,10 @@
|
||||
@echo off
|
||||
echo.
|
||||
echo.Making documentation files.
|
||||
call jsdoc2md --template ../jsdoc2md/js.hbs --files ..\source\js\astronomy.js > ..\source\js\README.md
|
||||
if errorlevel 1 (
|
||||
echo.FATAL: error in jsdoc2md
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
exit /b 0
|
||||
@@ -85,7 +85,7 @@ if not exist !EPHFILE! (
|
||||
)
|
||||
|
||||
echo.
|
||||
echo.Running the target code generator.
|
||||
echo.Cleaning output directories.
|
||||
for %%d in (output temp) do (
|
||||
if not exist %%d (
|
||||
md %%d
|
||||
@@ -95,12 +95,27 @@ for %%d in (output temp) do (
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if exist output\vsop_*.txt (del /q output\vsop_*.txt)
|
||||
if exist temp\* (del /q temp\*)
|
||||
!GENEXE! planets
|
||||
if errorlevel 1 (exit /b 1)
|
||||
|
||||
echo.
|
||||
echo.Generating planet models.
|
||||
!GENEXE! planets
|
||||
if errorlevel 1 (
|
||||
echo.FATAL: !GENEXE! planets
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo.
|
||||
echo.Generating target code.
|
||||
!GENEXE! source
|
||||
if errorlevel 1 (
|
||||
echo.FATAL: !GENEXE! source
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
call makedocs.bat
|
||||
if errorlevel 1 (exit /b 1)
|
||||
|
||||
echo.
|
||||
|
||||
Reference in New Issue
Block a user