Subversion Repositories Koakuma

Rev

Rev 37 | Rev 39 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 37 Rev 38
Line 1... Line 1...
1
#!/usr/bin/env tclsh
1
#!/usr/bin/env tclsh
2
# $Id: koakuma.cgi.in 37 2024-10-02 09:44:50Z nishi $
2
# $Id: koakuma.cgi.in 38 2024-10-02 09:55:14Z nishi $
3
 
3
 
4
set KOAKUMA_VERSION "1.00"
4
set KOAKUMA_VERSION "1.00"
5
set components ""
5
set components ""
6
 
6
 
7
chan configure stdout -buffering none
7
chan configure stdout -buffering none
Line 237... Line 237...
237
	file delete "@@PREFIX@@/lib/koakuma/db/projects.lock"
237
	file delete "@@PREFIX@@/lib/koakuma/db/projects.lock"
238
}
238
}
239
 
239
 
240
set what ""
240
set what ""
241
 
241
 
-
 
242
proc sanitize {data} {
-
 
243
	set tmp "[regsub -all { } "$data" "-"]"
-
 
244
	set br "[regsub -all {\(|\)} "$tmp" "_"]"
-
 
245
	return "$br"
-
 
246
}
-
 
247
 
242
proc start_html {title has_toc} {
248
proc start_html {title has_toc} {
243
	global toc env koakuma_png css what
249
	global toc env koakuma_png css what
244
	rputs	"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">"
250
	rputs	"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">"
245
	rputs	"<html>"
251
	rputs	"<html>"
246
	rputs	"	<head>"
252
	rputs	"	<head>"
Line 273... Line 279...
273
		rputs	"		<div id=\"toc\">"
279
		rputs	"		<div id=\"toc\">"
274
		rputs	"			<div id=\"tocinside\">"
280
		rputs	"			<div id=\"tocinside\">"
275
		rputs	"				<span id=\"toctitle\">TOC</span><hr>"
281
		rputs	"				<span id=\"toctitle\">TOC</span><hr>"
276
		foreach sect $toc {
282
		foreach sect $toc {
277
			if { "[string range "[regsub -all { } "$sect" "-"]" 0 0]" == "-" } {
283
			if { "[string range "[regsub -all { } "$sect" "-"]" 0 0]" == "-" } {
278
				rputs "<a class=\"shiftlink\" href=\"#TOC-[regsub {^-} "[regsub -all { } "$sect" "-"]" ""]\">[regsub {^-} "$sect" ""]</a><br>"
284
				rputs "<a class=\"shiftlink\" href=\"#TOC-[sanitize "[regsub {^-} "$sect" ""]"]\">[regsub {^-} "$sect" ""]</a><br>"
279
			} else {
285
			} else {
280
				rputs "<a href=\"#TOC-[regsub -all { } "$sect" "-"]\">$sect</a><br>"
286
				rputs "<a href=\"#TOC-[sanitize "$sect"]\">$sect</a><br>"
281
			}
287
			}
282
		}
288
		}
283
		rputs	"			</div>"
289
		rputs	"			</div>"
284
		rputs	"		</div>"
290
		rputs	"		</div>"
285
	}
291
	}
Line 300... Line 306...
300
	rputs	"</html>"
306
	rputs	"</html>"
301
}
307
}
302
 
308
 
303
proc add_toc {data} {
309
proc add_toc {data} {
304
	global toc
310
	global toc
305
	tputs	"<h2 id=\"TOC-[regsub -all { } "$data" "-"]\"><a href=\"#TOC-[regsub -all { } "$data" "-"]\">#</a> $data</h2>"
311
	tputs	"<h2 id=\"TOC-[sanitize "$data"]\"><a href=\"#TOC-[sanitize "$data" "-"]\">#</a> $data</h2>"
306
	lappend toc "$data"
312
	lappend toc "$data"
307
}
313
}
308
 
314
 
309
proc add_toc2 {data} {
315
proc add_toc2 {data} {
310
	global toc
316
	global toc
311
	tputs	"<h3 id=\"TOC-[regsub -all { } "$data" "-"]\"><a href=\"#TOC-[regsub -all { } "$data" "-"]\">#</a> $data</h3>"
317
	tputs	"<h3 id=\"TOC-[sanitize "$data"]\"><a href=\"#TOC-[sanitize "$data"]\">#</a> $data</h3>"
312
	lappend toc "-$data"
318
	lappend toc "-$data"
313
}
319
}
314
 
320
 
315
if { [catch {
321
if { [catch {
316
	set path "[regsub -all {/+} "$env(PATH_INFO)" "/"]"
322
	set path "[regsub -all {/+} "$env(PATH_INFO)" "/"]"