File size: 2,792 Bytes
1ceda33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
@echo off
setlocal EnableExtensions EnableDelayedExpansion
REM Render Paper 03: Semantic Orbital Mechanics
REM Usage: render.bat [format]
REM   format: pdf (default), html, typst, all

set FORMAT=%1
REM Default to "all" so PDF + HTML + deploy happens in one run
if "%FORMAT%"=="" set FORMAT=all

echo ============================================================
echo  PAPER 03: Semantic Orbital Mechanics
echo  Format: %FORMAT%
echo ============================================================
echo.

cd /d "%~dp0"

REM Clear Quarto cache to ensure fresh figures
echo [1/4] Clearing cache...
if exist ".quarto" rmdir /s /q ".quarto"
if exist "_freeze" rmdir /s /q "_freeze"
if exist "S64-orbital-paper_files" rmdir /s /q "S64-orbital-paper_files"
echo.

REM Handle "all" format - render both PDF and HTML
if /I "%FORMAT%"=="all" (
    echo [2/4] Rendering PDF...
    quarto render S64-orbital-paper.md --to pdf
    if !ERRORLEVEL! NEQ 0 goto :error
    
    echo.
    echo [3/4] Rendering HTML...
    quarto render S64-orbital-paper.md --to html
    if !ERRORLEVEL! NEQ 0 goto :error
    
    goto :deploy_html
)

echo [2/4] Rendering to %FORMAT%...
quarto render S64-orbital-paper.md --to %FORMAT%

if !ERRORLEVEL! NEQ 0 goto :error

echo.
echo [OK] Render complete! Output in _output/

if "%FORMAT%"=="pdf" (
    start "" "_output\S64-orbital-paper.pdf"
    goto :done
)

:deploy_html
REM If rendering HTML (or all), copy outputs into the website public folder
if /I "%FORMAT%"=="html" goto :do_deploy
if /I "%FORMAT%"=="all" goto :do_deploy
goto :done

:do_deploy
echo.
echo [4/4] Deploying to website...

REM Resolve absolute destination path
for %%I in ("%~dp0..\..\..\apps\website\public\_output") do set "DEST=%%~fI"
if not exist "!DEST!" mkdir "!DEST!"

REM Copy main HTML file
copy /Y "_output\S64-orbital-paper.html" "!DEST!\S64-orbital-paper.html" >nul
echo   - Copied S64-orbital-paper.html

REM Copy Quarto assets
if exist "_output\S64-orbital-paper_files" (
    if exist "!DEST!\S64-orbital-paper_files" rmdir /s /q "!DEST!\S64-orbital-paper_files"
    xcopy "_output\S64-orbital-paper_files" "!DEST!\S64-orbital-paper_files" /e /i /q >nul
    echo   - Copied S64-orbital-paper_files/
)

REM Copy figures with P03_ prefix (Paper 03 namespace)
if exist "_output\figures" (
    if not exist "!DEST!\figures" mkdir "!DEST!\figures"
    xcopy "_output\figures\P03_*.*" "!DEST!\figures\" /y /q >nul
    echo   - Copied figures/P03_*
)

echo.
echo [OK] Deployed to: !DEST!
echo     Website path: /_output/S64-orbital-paper.html
goto :done

:error
echo.
echo [ERROR] Render failed. Check errors above.
goto :end

:done
echo.
echo ============================================================
echo  COMPLETE
echo ============================================================

:end
pause