/usr/share/lifelines/extract_html.ll is in lifelines-reports 3.0.61-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 | /*
* @progname extract_html.ll
* @version 1.4
* @author Scott McGee (smcgee@microware.com)
* @category
* @output HTML
* @description
This program allows the user to select a group of individuals from a database
and generate a set of HTML files for them. It allows writing multiple people
per HTML file, and will create an index file and a GENWEB.txt file for genweb
indexing of the resulting data.
Before running this program, you will want to customize some global values
for your site. In the original release, they are set as follow:
set(db_owner, getproperty("user.fullname"))
set(owner_addr, getproperty("user.email"))
set(use_image, 1)
set(genweb_image, "../../pics/genweb.gif")
set(use_page, 1)
set(genweb_page, "../genweb.html")
set(page_name, "genweb page")
set(html_index, 0)
The first two sets will get your fullname and email address from the
corresponding user properties. They do not require editing this file.
The other customizations require editing of this file.
It also says to put an image at the top of each HTML file and specifies
that the image is called genweb.gif. Next, it specifies that a link to my
base page be added to each HTML file, that the location of the base page is
genweb.html, and that the text for the link be "genweb page". It also says
not to use and <ISINDEX> tag in the INDEX.html file.
The program, when run, will request a person to start with. It then allows
selection of additional people by following family links. It then allows
addition of all ancestors of the selected set or of the first individual,
and then all descendants of the selected set or of the orignal individual.
It also allows addition of all persons with a specified number of relations
to any individual in any of the groups added above.
For each person asked about, you will be given some information on them to
aid in deciding if they are the one you want or not. This is similar to a
person display when browsing with LifeLines.
Note: This program will assume that you have a directory called genweb in your
output directory (as specified by LL_REPORTS) and will write all output files
in that directory. If the genweb directory does NOT exist (at least, with
LL302) you will be prompted for the name of each output file. Be aware that
if you use this to name the files diffently, the references within the files
will NOT be changed to reflect the new file name!
Future Enhancements (Let me know if you want to do one of these for me!):
A hierarchical index would be a nice option.
Need to add descendant and ancestor (pedigree) charts.
Add seperate page(s) for sources and generate hyperlinks to them.
Thanks to Tom Wetmore for many small routines that have been addapted for
use in this program as well as LifeLines itself.
Scott McGee
@(#)extract_html.ll 1.4 10/1/95
*/
include("extract_set.li")
include("tools.li")
/* customization globals - customize values assigned in main */
global(db_owner) /* name of database owner */
global(owner_addr) /* url of database owner (mailto or homepage) */
global(use_image) /* flag to indicate whether to use genweb image */
global(genweb_image) /* name of genweb image to place on each page */
global(use_page) /* flag to add link to genweb page or homepage */
global(genweb_page) /* URL of base genweb (or homepage) web page */
global(page_name) /* name of base genweb (or homepage) web page */
global(LDS) /* display LDS Ordinances? (1=yes 0=no) */
global(html_index) /* add <ISINDEX> tag to INDEX.html file (1=yes 0=no) */
/* other globals */
global(found) /* external file to inline image found flag */
global(per_file) /* number of people per file to write */
global(first) /* first person shouldn't be asked about */
global(RVAL) /* ?? (part of borrowed code) */
global(last_surname) /* last surname in index - used for anchors */
global(first_indi) /* starting person */
proc main () {
indiset(out_set)
/* customize these globals to customize the output to your site */
set(db_owner, getproperty("user.fullname"))
set(owner_addr, getproperty("user.email"))
set(use_image, 1) /* 1 to use image, 0 to not use image */
set(genweb_image, "../../pics/genweb.gif")
set(use_page, 1) /* 1 to use link to page, 0 if not */
set(genweb_page, "../genweb.html")
set(page_name, "genweb page") /* might change to "my homepage" */
set(LDS, 1)
set(html_index, 0) /* 1 to use <ISINDEX>, 0 if not */
set(per_file, 1)
getindi(indi)
if (indi) {
set(first_indi, indi)
set(out, extract_set(indi))
call html_out(out)
}
else {
print("No one identified -- terminating\n")
}
}
proc html_out (o) {
set(s, concat("There are ", d(lengthset(o)),
" people in your list, how many per file?"))
getstr(a,s)
set(per_file, atoi(a))
if(not(per_file)) {
set(per_file, 1)
}
set(loop_count, 0)
set(file_count, 0)
set(href_table, init_href(o))
forindiset(o, i, j, n) {
set(indi, i)
if(eq(loop_count, 0)) {
incr(file_count)
call write_head(file_count)
}
incr(loop_count)
call genhtml(indi, o, href_table)
if(or(eq(loop_count, per_file), eq(n, lengthset(o)))) {
call write_tail()
set(loop_count, 0)
}
}
call do_index(o, href_table)
}
proc write_head(count) {
set(filename, concat("genweb/", database(), "/genweb_", d(count), ".html"))
print("Writing ", filename, "\n")
newfile(filename, 0)
"<HTML><HEAD>\n"
"<TITLE> genweb_"
d(count)
".html </TITLE>\n" "</HEAD><BODY>\n"
if(use_image) {
"<IMG SRC=\""
genweb_image
"\" ALT = \"\"><BR><BR>\n"
}
}
proc write_tail() {
"<BR><HR><ADDRESS>\n"
date(gettoday())
"<BR>\n"
"Database maintained by "
"<A HREF=\"" owner_addr "\">\n"
db_owner
"</A></ADDRESS>\n"
"</BODY></HTML>\n"
}
proc genhtml (i, o, href_table) {
/* print(" ", fullname(i,0,1,300), "\n") */
"<A NAME=\""
key(i)
"\"></A>\n"
"<H1>"
set(vn,givens(i))
set(vn1,save(vn))
givens(i)
" "
set(nn,surname(i))
set(nn1,save(nn))
nn1
"</H1>\n"
set(path, get_picture(i))
if (found) {
"<IMG SRC =\""
if(nestr(lower(trim(path, 4)), "http")) {
if(nestr(lower(trim(path, 3)), "ftp")) {
if(nestr(lower(trim(path, 5)), "file:")) {
if(nestr(lower(trim(path, 6)), "gopher")) {
"../"
}
}
}
}
path
"\" ALT = \"\"><BR><BR>\n"
}
call afn(i)
if (e, birth(i)) {
"<EM>Born</EM> : " long(e) "<BR>\n"
}
if (e, baptism(i)) {
"<EM>Baptised</EM> : " long(e) "<BR>\n"
}
elsif (e, bapt(i)) {
"<EM>Baptised</EM> : " long(e) "<BR>\n"
}
if (e, death(i)) {
"<EM>Died</EM> : " long(e) "<BR>\n"
}
if (e, burial(i)) {
"<EM>Buried</EM> : " long(e) "<BR> \n"
}
if(LDS) {
/* LDS ordinances */
set(started, 0)
fornodes(inode(i), node) {
if (eq(0, strcmp(tag(node), "BAPL"))) {
if(not(started)) {
set(started, 1)
"<BR>LDS Ordinances: B "
}
}
/* determine if endowed */
if (eq(0, strcmp(tag(node), "ENDL"))) {
if(not(started)) {
set(started, 1)
"<BR>LDS Ordinances: "
}
"E "
}
}
/* determine if sealed to parents */
set(fam, fnode(parents(i)))
set(ind, inode(i))
if(fam) {
fornodes(fam, node) {
if(and(eqstr("CHIL", tag(node)), eqstr(xref(ind), value(node)))) {
fornodes(node, next) {
if(eqstr(tag(next), "SLGC")) {
if(not(started)) {
set(started, 1)
"<BR>LDS Ordinances: "
}
"SC "
}
}
}
}
}
if(started){
"<BR>\n"
}
}
/* "<BR>" */
call othernames(i)
call print_html(i)
"<HR>\n"
if (p, father(i)) {
"<EM>" "Father</EM> : "
set (path, get_href(p, href_table))
if(found) {
"<A HREF=\""
path
"#"
key(p)
"\">"
}
if (t,title(p)) {t " "}
fullname(p,0,1,300)
if(found) {"</A>"}
do_info(p)
"<BR>\n"
}
if (p, mother(i)) {
"<EM>" "Mother</EM> : "
set (path, get_href(p, href_table))
if(found) {
"<A HREF=\""
path
"#"
key(p)
"\">"
}
if (t,title(p)) {t " "}
fullname(p,0,1,300)
if(found) {"</A>"}
do_info(p)
"<BR>\n"
}
families(i, f, s, n) {
"<P><EM>" "Spouse"
if (gt(nfamilies(i), 1)) {
" "
d(n)
}
"</EM> : \n"
if (s) { /* family has a spouse */
set (path, get_href(s, href_table))
if(found) {
"<A HREF=\""
path
"#"
key(s)
"\">"
}
if (t,title(s)) {t " "}
fullname(s,0,1,300)
if(found) {"</A>"}
do_info(s)
"<BR>\n"
}
if (e, marriage(f)) {
"<EM>Married</EM> "
long(e)
"<BR>\n"
}
if (e, divorced(f)) {
"<EM>Divorced</EM> "
long(e)
"<BR>\n"
}
if(LDS) {
fornodes(fnode(f), node) {
if (eq(0, strcmp(tag(node), "SLGS"))) {
"<BR>LDS Ordinances: SS\n"
}
}
}
"<OL>\n"
children(f, c, nn) {
"<LI>"
set (path, get_href(c, href_table))
if(found) {
"<A HREF=\""
path
"#"
key(c)
"\">"
}
if (t,title(c)) {t " "}
fullname(c,0,1,300)
if(found) {"</A>"}
do_info(c)
"</LI>\n"
}
"</OL>\n"
}
call print_notes(i)
"<HR>\n"
/* Insert code here for Pedigree and Descendant charts
if(parents(i)) {
"Pedigree Chart<BR>\n"
}
if(nfamilies(i)) {
set(hasChildren, 0)
families(i, f, s, n) {
if(nchildren(f)) {
set(hasChildren, 1)
}
}
if(hasChildren) {
"Descendant Chart\n"
}
}
"<HR>\n"
*/
"<BR>\n"
"[<A HREF=\"INDEX.html\">"
"Index to database</A>]<BR>\n"
if(use_page) {
"[<A HREF=\"" genweb_page "\">"
"Return to "
page_name
" </A>]<BR> \n"
}
"<BR><HR><BR>\n"
}
func init_href(outset){
table(href_table)
forindiset(outset, indi, j, number) {
insert(href_table, save(key(indi)), number)
}
return(href_table)
}
func get_href(indi, href_table) {
set(path, "")
set(found, 0)
set(value, lookup(href_table, key(indi)))
if(value){
set(number, add(div(sub(value, 1), per_file), 1))
set(path, concat("genweb_", d(number), ".html"))
set(found, 1)
}
return(path)
}
proc print_notes(indi){
set(first, 1)
traverse(inode(indi), node, l) {
if (not(strcmp("NOTE", tag(node)))) {
if(first) {
"<EM>Notes</EM> : <BR>\n"
set(first, 0)
}
"<P>"
call show_path(node)
value(node)
"\n"
fornodes(node, next) {
value(next)
"\n"
}
"</P>\n"
}
}
}
proc show_path (node){
list(path)
while (node) {
push(path, tag(node))
set(node, parent(node))
}
"("
while (s, pop(path)) {
if(eqstr(lower(s), "indi")){
"Individual "
}elsif(eqstr(lower(s), "fam")){
"Family "
}elsif(eqstr(lower(s), "famc")){
"family "
}elsif(eqstr(lower(s), "fams")){
"family "
}elsif(eqstr(lower(s), "note")){
"note"
}elsif(eqstr(lower(s), "birt")){
"birth "
}elsif(eqstr(lower(s), "deat")){
"death "
}elsif(eqstr(lower(s), "buri")){
"burial "
}elsif(eqstr(lower(s), "plac")){
"place "
}else{
lower(s)
" "
}
}
")\n"
}
proc do_index(indi_set, href_table) {
set(last_surname, "ZZ")
list(RVAL)
indiset(index)
set(index, indi_set)
namesort(index)
print("Writing INDEX.html\n")
call create_index_file(index, href_table)
print("Writing GENDEX.txt\n")
call create_gendex_file(index, href_table)
}
proc create_gendex_file(index, href_table) {
set(fn, save(concat("genweb/", database(), "/GENDEX.txt")))
newfile(fn, 0)
forindiset(index, me, v, n)
{
set(path, concat(save(get_href(me, href_table)), "#", key(me)))
path
"|"
surname(me)
"|"
givens(me) " /"
surname(me) "/"
"|"
if (evt, birth(me)) {
date(evt)
}
"|"
if (evt, birth(me)) {
place(evt)
}
"|"
if (evt, death(me)) {
date(evt)
}
"|"
if (evt, death(me)) {
place(evt)
}
"|\n"
}
}
proc create_index_file(index, href_table) {
set(fn, save(concat("genweb/", database(), "/INDEX.html")))
newfile(fn, 0)
call html_header("Interactive Genealogical Server Index", html_index)
"<BODY>\n"
if(use_image) {
"<IMG SRC=\""
genweb_image
"\" ALT = \"\"><BR><BR>\n"
}
"<H1> INDEX </H1>\n"
"<UL>\n"
forindiset(index, me, v, n)
{
call href(me, href_table)
"\n"
}
"</UL>\n"
call write_tail()
}
proc href(me, href_table) {
if(me) {
call print_name(me, 1)
if(ne(strcmp(upper(surname(me)), last_surname), 0)) {
print(" ", upper(surname(me)), "\n")
set(last_surname, save(upper(surname(me))))
"<A NAME=" qt() last_surname qt() "></A>\n"
}
"<LI>"
set (path, get_href(me, href_table))
if(found) {
"<A HREF=\""
path
"#"
key(me)
"\">\n"
}
pop(RVAL)
if(found) {
"</A>"
}
do_info(me)
}
}
proc html_header(str, isindex) {
"<HTML>\n"
"<HEAD>\n"
if(isindex) {
"<ISINDEX>\n"
}
"<TITLE> "
str
" </TITLE>\n"
"</HEAD>\n"
}
proc print_name (me, last) {
call get_title(me)
set(junk, pop(RVAL))
push(RVAL, save(concat(fullname(me, 1, not(last), 45), junk)))
}
proc get_title (me) {
fornodes(inode(me), node) {
if (not(strcmp("TITL", tag(node)))) {
set(n, node)
}
}
if (n) {
push(RVAL, save(concat(" ", value(n))))
}
else {
push(RVAL, "")
}
}
proc rjt(n, w) {
if (lt(n, 10)) {
set(d, 1)
}
elsif (lt(n, 100)) {
set(d, 2)
}
elsif (lt(n, 1000)) {
set(d, 3)
}
elsif (lt(n, 10000)) {
set(d, 4)
}
else {
set(d, 5)
}
if (lt(d, w)) {
set(pad, save( trim(" ", sub(w, d))))
}
else{
set(pad, "")
}
push(RVAL, save( concat(pad, save(d(n)))))
}
proc othernames(indi){
if(indi){
set(count, 0)
fornodes(inode(indi), subnode){
if(eqstr(tag(subnode), "NAME")){
incr(count)
if(eq(count, 2)){
"<BR><EM>Other Names</EM>: \n<UL>"
"<LI>"
call nameval(subnode)
"</LI>"
}elsif(gt(count, 2)){
"<LI>"
call nameval(subnode)
"</LI>\n"
}
}
}
if(gt(count, 1)){
"</UL>\n"
}
}
}
proc afn(indi){
if(indi){
fornodes(inode(indi), subnode){
if(eqstr(tag(subnode), "AFN")){
"AFN "
value(subnode)
"<BR><BR>\n"
}
}
}
}
proc nameval(namenode){
list(np)
extractnames(namenode, np, nc, sc)
forlist(np, v, i){
v
" "
}
}
proc print_html(indi){
fornodes(inode(indi), node) {
if (not(strcmp("REPORT", tag(node)))) {
set(m, child(node))
if (not(strcmp("TYPE", tag(m)))) {
if (not(strcmp("HTML", value(m)))) {
"<BR>\n"
fornodes(m, o) {
if (not(strcmp("DATA", tag(o)))) {
value(o)
"\n"
}
"\n"
}
}
else {
if (eqstr("HTML-STATIC", value(m))) {
"<BR>\n"
fornodes(m, o) {
if (eqstr("DATA", tag(o))) {
value(o)
"\n"
}
"\n"
}
}
}
}
}
}
}
func divorced(fam) {
fornodes(fnode(fam), node) {
if (eq(0, strcmp(tag(node), "DIV"))) {
return(node)
}
}
return(0)
}
|