This repository has been archived by the owner on Sep 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathxquerydoc.bat
57 lines (51 loc) · 1.74 KB
/
xquerydoc.bat
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
@echo off
:: usage: xquerydoc [-x xquery directory] [-o output directory ] [-f output format ]
:: formats: raw,(raw2), xqdoc, html, markdown
:: absolute paths for x and o should be prefixed by / e.g /c:/...
setlocal enableDelayedExpansion
Set CURRENTDIR=%CD%
set BATPATH=%~dp0
set "options=-x:"%CURRENTDIR%" -o:"%CURRENTDIR%\xqdoc" -f:html"
:: based on http://stackoverflow.com/questions/3973824/windows-bat-file-optional-argument-parsing
:: Set the default option values
for %%O in (%options%) do for /f "tokens=1,* delims=:" %%A in ("%%O") do set "%%A=%%~B"
:loop
if not "%~1"=="" (
set "test=!options:*%~1:=! "
if "!test!"=="!options! " (
echo Error: Invalid option %~1
) else if "!test:~0,1!"==" " (
set "%~1=1"
) else (
set "%~1=%~2"
shift /1
)
shift /1
goto :loop
)
:: add leading slash if drive for calabash
set "OUTPUT=%-o%"
if "%OUTPUT:~1,1%"==":" (
set "OUTPUT=/%OUTPUT%"
)
set "XQUERY=%-x%"
if "%XQUERY:~1,1%"==":" (
set "XQUERY=/%XQUERY%"
)
echo xquerydoc [-x xquery directory] [-o output directory ] [-f output format ]
echo xquerydoc 0.1, generates xquery api documentation
echo Copyright (c) 2011, 2012 Jim Fuller, John Snelson
echo see https://github.com/xquery/xquerydoc
set -
echo generating documentation ...
java -Xmx1024m -jar "%BATPATH%deps\xmlcalabash\calabash.jar" -oresult="%-o%/index.html" "%BATPATH%xquerydoc.xpl" "xquery=%XQUERY%" "currentdir=/%CURRENTDIR%" "output=%OUTPUT%" "format=%-f%"
:: IF NOT EXIST "%-o%\lib" GOTO notestdir
:: GOTO endif2
:notestdir
echo Creating lib directory at "%-o%" ...
mkdir "%-o%\lib"
copy "%BATPATH%\src\lib\prettify.js" "%-o%\lib\prettify.js"
copy "%BATPATH%\src\lib\prettify.css" "%-o%\lib\prettify.css"
copy "%BATPATH%\src\lib\lang-xq.js" "%-o%\lib\lang-xq.js"
echo.
:endif2