/[webpac]/trunk/openisis/tcl/miki
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/openisis/tcl/miki

Parent Directory Parent Directory | Revision Log Revision Log


Revision 239 - (show annotations)
Mon Mar 8 17:49:13 2004 UTC (17 years, 4 months ago) by dpavlin
File size: 4256 byte(s)
including openisis 0.9.0 into webpac tree

1 #!/opt/openisis/tcl/bin/tspr print
2 <%--
3 mikidoc Tcl server page
4 $Id: miki,v 1.5 2003/06/10 11:02:11 kripke Exp $
5 --%><%!
6
7 proc mikidoc file {
8 set fid [open $file]
9 set notes ""
10 set in 0
11 set eol "\n"
12 set code 0
13 while 1 {
14 set len [gets $fid line]
15 set is 0
16 set c [string index $line 0]
17 set tab [expr {"\t" == [string index $line 1] ? 2 : 1}]
18 if {$code && "$" != $c} {
19 set line [::openIsis::2html $line]
20 } else {
21 switch -- $c "" { # empty
22 set line "<br/>"
23 } {$} { # toggle code
24 if $code {
25 set line "</pre>"; set code 0
26 } else {
27 set line "<pre>"; set code 1
28 }
29 } * { # head
30 set anchor ""
31 if { 1==$tab && 2<$len && " " != [string index $line 1]} {
32 set i [string first "\t" $line]
33 if {1 < $i} {
34 set tab [expr $i+1]
35 set anchor "<a name=\"\
36 [string range $line 1 [expr $i-1]]\">&nbsp;</a>"
37 }
38 }
39 set line "</td></tr><tr><td bgcolor=\"#CCCCCC\"><b>\
40 [string range $line $tab end]\
41 </b>$anchor</td></tr><tr><td align=\"justify\">"
42 } - {
43 if [string match ---* $line] {
44 set line "<hr>"
45 } else {
46 set line "[expr {1 == $in ? "</li>" : "<ul>"}]<li>\
47 [string range $line $tab end]"
48 if {40 > $len} { append line "<br/>" }
49 set is 1
50 }
51 } | {
52 set is 2
53 if {2 != $in} {
54 set l "<table>\n<tr bgcolor=\"#EEEEEE\">"
55 set td th
56 } else {
57 set l <tr>
58 set td td
59 }
60 foreach cell [split [string range $line $tab end] "|\t"] {
61 append l "<$td>$cell</$td>"
62 }
63 append l </tr>
64 set line $l
65 } "\t" {
66 set is $in
67 if {"\t" == $line} { append line "<br/>" }
68 } > {
69 set is $in
70 foreach {ref name} [split [string range $line $tab end] "\t"] break
71 if {"" == $name} { set name $ref }
72 set line "<a href=\"$ref\">$name</a>"
73 } . {
74 if [string match ...* $line] {
75 set notes [string trim [string range $line 3 end]]
76 continue
77 }
78 } ! {
79 set eol "<br/>\n"
80 continue
81 } ";" {
82 continue
83 }
84 }
85 if {$in != $is} { # close where we
86 switch $in \
87 1 { puts "</ul>\n" } \
88 2 { puts "</table>\n" } \
89 }
90 if {0 > $len} break
91 append line $eol
92 puts $line
93 set in $is
94 }
95 close $fid
96 return $notes
97 }
98
99 %><%
100 # request standard tags
101 # -10 SCRIPT_NAME
102 # -11 PATH_INFO
103 # -12 REMOTE_USER
104 #
105 # request parameters
106 # 1 print
107 #
108 global env
109 # foreach e [array names env] { ::puts stderr "$e\t$env($e)" }
110 # ::puts stderr [request serialize]
111
112 set script [lindex [request get -10] 0]
113 set name /OverView
114 catch {set name [lindex [request get -11] 0]}
115 set sides 0
116 if [catch {request get 1}] { set sides 1 }
117 set name [string map {/ "" . ""} $name]
118
119 cd /opt/openisis/doc
120 if ![file isfile $name.txt] { set name OverView }
121 set right ""
122
123 %><html>
124 <head>
125 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
126 <title>OpenIsis - <%=name%></title>
127 <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
128 </head>
129 <body bgcolor="#FFFFFF"
130 marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
131 <% if $sides { %>
132 <table width="100%" cellpadding="0" cellspacing="0"
133 marginwidth="0" marginheight="0" topmargin="0" leftmargin="0" border="0">
134 <tr>
135 <%-- left: the index --%>
136 <td valign="top" width="160">
137 <table border="0" cellspacing="5" width="100%" cols="1">
138 <tr>
139 <td valign="top">
140 <% mikidoc ".index" %>
141 <hr>
142 <a href="<%=name%>?print=">print</a><br>
143 <a href="/doc/<%=$name.txt%>">plaintext</a>
144 </td>
145 </tr>
146 </table>
147 </td>
148 <%-- middle: the content --%>
149 <td valign="top">
150 <% } ;# sides %>
151 <table border="0" cellspacing="5" width="100%" cols="1">
152 <tr>
153 <td valign="top" bgcolor="#000000"><font color="#FFFFFF"><b>
154 <%=name%>
155 </b></font></td>
156 </tr>
157 <tr>
158 <td align="justify">
159 <% set right [mikidoc $name.txt] %>
160 </td>
161 </tr>
162 </table>
163 <% if $sides { %>
164 <%
165 if {"" != $right} {
166 %>
167 <%-- right: notes --%>
168 </td>
169 <td valign="top" width="25%">
170 <table border="0" cellspacing="5" width="100%" cols="1">
171 <tr>
172 <td valign="top" bgcolor="#000000"><font color="#FFFFFF"><b>
173 <%=right%>
174 </b></font></td>
175 </tr>
176 <tr>
177 <td align="justify">
178 <% mikidoc $right.txt %>
179 </td>
180 </tr>
181 </table>
182 <%
183 }
184 %>
185 </td>
186 </tr>
187 </table>
188 <% } ;# sides %>
189 <!--
190 $Revision: 1.5 $
191 -->
192 </body>
193 </html>

Properties

Name Value
svn:executable

  ViewVC Help
Powered by ViewVC 1.1.26