Debian Codegraph @

reports/html.ll

raw
1 /*
2 * @progname html.ll
3 * @version 1.0
4 * @author Dave Close, <[email protected]>
5 * @category
6 * @output HTML
7 * @description
8 *
9 * Produces a set of interlinked HTML files, one for each
10 * person in the data base, and a master name index file.
11
12 Here is a report program I've been using to
13 generate HTML to allow browsing of my data base. It produces one HTML
14 file for each person in the data base, and a master index file with
15 links to each of the other files. Each person's file is hyperlinked
16 to all his direct relatives. I believe the output is standard HTML and
17 does not use any peculiar extensions, so it should be viewable with
18 nearly any browser.
19 Permission is granted to anyone to use this code for any purpose.
20
21 It does call the divorce() function which I added to my copy of
22 Lifelines and posted to this list 2002 November 12.
23
24 See:
25 http://listserv.nodak.edu/cgi-bin/wa.exe?A2=ind0211b&L=lines-l&T=0&F=&S=&P=356
26 */
27
28 global ( page_width )
29 global ( left_margin )
30
31 proc main ()
32 {
33 set ( page_width, 500 )
34 set ( left_margin, 0 )
35 indiset ( iset )
36
37 forindi ( indi, ni )
38 {
39 addtoset ( iset, indi, 1 )
40
41 newfile ( concat ( key ( indi ), ".html" ), 0 )
42 "<html>" nl () "<head>" nl ()
43 "<title>" name ( indi ) "</title>" nl ()
44 "</head>" nl () "<body bgcolor=white>" nl ()
45 "<h1>" name ( indi ) "</h1>" nl ()
46
47 /* person */
48 if ( male ( indi ) )
49 {
50 "Male<br>" nl ()
51 }
52 else
53 {
54 "Female<br>" nl ()
55 }
56 dayformat ( 1 ) monthformat ( 1 ) dateformat ( 11 )
57 set ( dat, atoi ( stddate ( birth ( indi ) ) ) )
58 if ( ne ( dat, 0 ) )
59 {
60 dayformat ( 2 ) monthformat ( 4 ) dateformat ( 8 )
61 "Born: " stddate ( birth ( indi ) ) ", "
62 place ( birth ( indi ) ) "<br>" nl ()
63 }
64 else
65 {
66 "<font color=red> Birth information missing </font><br>" nl ()
67 }
68 dayformat ( 1 ) monthformat ( 1 ) dateformat ( 11 )
69 set ( dat, atoi ( stddate ( death ( indi ) ) ) )
70 if ( ne ( dat, 0 ) )
71 {
72 dayformat ( 2 ) monthformat ( 4 ) dateformat ( 8 )
73 "Died: " stddate ( death ( indi ) ) ", "
74 place ( death ( indi ) ) "<br>" nl ()
75 }
76 "<br>" nl ()
77
78 /* parents */
79 set ( pa, father ( indi ) )
80 set ( ma, mother ( indi ) )
81 if ( eqstr ( key ( pa ), "" ) )
82 {
83 "<font color=red> Father unknown </font><br>" nl ()
84 }
85 else
86 {
87 "Father: <a href=" key ( pa ) ".html>" name ( pa ) "</a><br>" nl ()
88 }
89 if ( eqstr ( key ( ma ), "" ) )
90 {
91 "<font color=red> Mother unknown </font><br>" nl ()
92 }
93 else
94 {
95 "Mother: <a href=" key ( ma ) ".html>" name ( ma ) "</a><br>" nl ()
96 }
97 "<br>" nl ()
98
99 /* families */
100 if ( gt ( nfamilies ( indi ), 0 ) )
101 {
102 if ( eq ( nfamilies ( indi ), 1 ) )
103 {
104 "Family:"
105 }
106 else
107 {
108 "Families:"
109 }
110 "<table border=1>" nl ()
111 families ( indi, fam, sp, num )
112 {
113 "<tr><td valign=top>Spouse: <a href=" key ( sp ) ".html>"
114 name ( sp ) "</a><br>" nl ()
115 if ( marriage ( fam ) )
116 {
117 "Married: "
118 dayformat ( 1 ) monthformat ( 1 ) dateformat ( 11 )
119 set ( dat, atoi ( stddate ( marriage ( fam ) ) ) )
120 if ( ne ( dat, 0 ) )
121 {
122 dayformat ( 2 ) monthformat ( 4 ) dateformat ( 8 )
123 stddate ( marriage ( fam ) ) ", "
124 }
125 else
126 {
127 "<font color=red>Date unknown, </font>"
128 }
129 if ( eqstr ( place ( marriage ( fam ) ), "" ) )
130 {
131 "<font color=red>Place unknown</font><br>" nl ()
132 }
133 else
134 {
135 place ( marriage ( fam ) ) "<br>" nl ()
136 }
137 }
138 if ( divorce ( fam ) )
139 {
140 "Divorced: "
141 dayformat ( 1 ) monthformat ( 1 ) dateformat ( 11 )
142 set ( dat, atoi ( stddate ( divorce ( fam ) ) ) )
143 if ( ne ( dat, 0 ) )
144 {
145 dayformat ( 2 ) monthformat ( 4 ) dateformat ( 8 )
146 stddate ( divorce ( fam ) ) ", "
147 }
148 else
149 {
150 "<font color=red>Date unknown, </font>"
151 }
152 if ( eqstr ( place ( divorce ( fam ) ), "" ) )
153 {
154 "<font color=red>Place unknown</font><br>" nl ()
155 }
156 else
157 {
158 place ( divorce ( fam ) ) "<br>" nl ()
159 }
160 }
161 dayformat ( 1 ) monthformat ( 1 ) dateformat ( 11 )
162 set ( dsp, atoi ( stddate ( death ( sp ) ) ) )
163 set ( din, atoi ( stddate ( death ( indi ) ) ) )
164 set ( ddv, atoi ( stddate ( divorce ( fam ) ) ) )
165 if ( ne ( dsp, 0 ) )
166 {
167 if ( lt ( dsp, din ) )
168 {
169 dayformat ( 2 ) monthformat ( 4 ) dateformat ( 8 )
170 "Widowed: " stddate ( death ( sp ) ) "<br>" nl ()
171 }
172 }
173 "</td><td valign=top>"
174 if ( eq ( nchildren ( fam ), 0 ) )
175 {
176 "No children" nl ()
177 }
178 else
179 {
180 "Children:<br>" nl () children ( fam, child, no )
181 {
182 "<a href=" key ( child ) ".html>" name ( child ) "</a><br>" nl ()
183 }
184 }
185 "</td></tr>" nl ()
186 }
187 "</table>" nl ()
188 }
189 else
190 {
191 "<font color=red>No family information known</font><br>" nl ()
192 }
193 "<br><a href=tree.html> Return to complete list of persons </a>" nl ()
194 "</body>" nl () "</html>" nl ()
195 }
196
197 newfile ( "tree.html", 0 )
198 "<html>" nl () "<head>" nl ()
199 "<title> Persons </title>" nl ()
200 "</head>" nl () "<body bgcolor=white>" nl ()
201 "<p>The following persons are recorded in this data base." nl ()
202 "After selecting any one of them, you may proceed directly to their" nl ()
203 "direct relatives through additional links, or return to this page.</p>" nl ()
204 "<table valign=top><tr><td valign=top>" nl ()
205 namesort ( iset )
206 set ( n1, lengthset ( iset ) )
207 incr ( n1 ) incr ( n1 )
208 set ( n2, div ( n1, 3 ) )
209 forindiset ( iset, indi, a, b )
210 {
211 "<a href=" key ( indi ) ".html>"
212 surname ( indi ) ", " givens ( indi ) "</a><br>" nl ()
213 if ( eq ( mod ( b, n2 ), 0 ) )
214 {
215 "</td><td valign=top>" nl ()
216 }
217 }
218 "</td></tr></table></body></html>" nl ()
219 }