-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path@test_html_build
executable file
·149 lines (129 loc) · 3.42 KB
/
@test_html_build
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/bin/tcsh -f
@global_parse `basename $0` "$*" ; if ($status) exit 0
if ( -f __._thb_tmp_stdin.rst) \rm -f __._thb_tmp_stdin.rst
goto PARSE
RETURN_PARSE:
if ( ! -d ${bdir} ) mkdir ${bdir}
set fo = ()
foreach f ($ff)
set fr = $f:r
sphinx-build -b html -d _build/doctrees/ . ${bdir}/html $f
set fo = ($fo ${bdir}/html/$fr.html)
end
echo ""
echo "Build results"
set cnt = 1
foreach f ($ff)
if ( -f $fo[$cnt] ) then
echo "$ff -> $fo[$cnt]"
if ( $auto_open ) afni_open -b $fo[$cnt]
else
echo "$ff -> :("
endif
@ cnt ++
end
echo ""
goto END
PARSE:
set Narg = $#
set cnt = 1
set fromstd = 0
set bdir = _test_build
set auto_open = 1
set ff = ()
while ($cnt <= $Narg)
if ("$argv[$cnt]" == "-d" || "$argv[$cnt]" == "-echo") then
set verb = 1
set echo
goto CONTINUE
endif
if ("$argv[$cnt]" == '-h' || "$argv[$cnt]" == '-help') then
goto HELP
endif
if ("$argv[$cnt]" == '-f') then
if ($cnt >= $Narg) then
echo "Need file after -f"
goto BEND
endif
@ cnt ++
set ff = ($ff $argv[$cnt])
goto CONTINUE
endif
if ("$argv[$cnt]" == '-bd') then
if ($cnt >= $Narg) then
echo "Need directory name after -bd"
goto BEND
endif
@ cnt ++
set bdir = ($argv[$cnt])
goto CONTINUE
endif
if ("$argv[$cnt]" == "-no_open") then
set auto_open = 0
goto CONTINUE
endif
if ("$argv[$cnt]" == "-") then
set fromstd = 1
goto CONTINUE
endif
echo "Error: Option or parameter '$argv[$cnt]' not understood"
apsearch -popt `basename $0` -word $argv[$cnt]
goto BEND
CONTINUE:
@ cnt ++
end
if ($#ff == 0 && $fromstd == 0) then
echo "No files to process"
goto BEND
endif
if ($fromstd == 1) then
set noglob
set nblank = 0
while ($nblank < 50)
set mm = ($< )
if ("$mm" == "") then
@ nblank ++
else
set nblank = 0
endif
echo "$mm" >> __._thb_tmp_stdin.rst
end
unset noglob
set ff = ($ff __._thb_tmp_stdin.rst)
endif
goto RETURN_PARSE
HELP:
echo ""
echo "A script to build one or more .rst files. This is mostly"
echo "for testing automatically generated output from help strings."
echo ""
echo "For example, to test whether the output of 3dToyProg -h_aspx"
echo "is OK, you can do:"
echo " 3dToyProg -h_aspx > test.rst"
echo " tcsh @test_html_build -f test.rst"
echo " afni_open -b _build/html/test.html"
echo ""
echo "Otherwise, to build everything you just need to run:"
echo ""
echo " make html"
echo "or"
echo " make clean html"
echo ""
echo "To regenerate all the auto-docs in addition to a rebuild,"
echo "see @gen_all"
echo ""
echo "Options:"
echo "-h: This message"
echo "-echo: Yap yap"
echo "-no_open: Don't open browser after build"
echo "-bd BUILD_DIR: Set the build directory to BUILD_DIR"
echo " Default is: $bdir"
echo "- : Expect input from stdin. Stop reading when 50 blanks"
echo " are encountered in a row."
echo ""
goto END
BEND:
echo "Berror!"
goto END
END:
if ( -f __._thb_tmp_stdin.rst) \rm -f __._thb_tmp_stdin.rst