-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgedcomToHTML.pl
More file actions
executable file
·1524 lines (1433 loc) · 54.4 KB
/
Copy pathgedcomToHTML.pl
File metadata and controls
executable file
·1524 lines (1433 loc) · 54.4 KB
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
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/perl
# gedcomToHTML.pl 1.5.6 -- Dan Pidcock 22 Feb 2007
$version = "1.5.6"; # version number
# Danio@bigfoot.com - www.pidcock.co.uk/gth
# Copyright (c) Dan Pidcock, 1997-2007.
# This program is freely distributable without licensing fees
# and is provided without guarantee or warrantee expressed or
# implied. This program is NOT in the public domain.
# translate gedcom files to html
# based on the gedcom 5.5 standard and a sample gedcom 5.3 file
# doesn't handle all gedcom elements
# Feel free to use this program, but please keep the authorship the
# same. If you have any changes you have made, I would be happy to
# incorporate them and put your name on the credits. - Dan
# Credits for contributions:
# Baptism, sealing, repository info added - Jay North
# Group by letter in surnames file - Jay North
# Trailing slash removed from surnames for sorting - Jay North
# Make a statistics file - Jay North
# HTML made 4.0 standard - Jay North
# Christening (1.5.3) - John ffitch
# Children > 8 bug (1.5.1) - Richard Ball, WebbedGed author (Dick Purnell??)
# Source and titles, better comma code in v1.5 by David Moore
# Surnames beginning with same letter on same line in v1.5 by jpb
# Photo thumbnails (1.5) - anonymouse contributor
# Multiple marriage code of 1.22b based on that by Dale DePriest
# Improvements proposed by Graham Lawrence 18 Nov 1997 changes and
# incorporated in v1.2.
# The preferences file name
$prefsFile = "gedcomToHTML.prefs";
# The strings that are printed into files - change for different
# languages
$str_birth="Birth:";
$str_chr="Christened:";
$str_baptism="LDS Baptism:";
$str_endowment="LDS Endowment:";
$str_sealing_children="LDS Sealing to Children:";
$str_sealing_spouse="LDS Sealing to Spouse:";
$str_death="Death:";
$str_burial="Burial:";
$str_occupation="Occupation:";
$str_private="(Private)";
$str_father="Father:";
$str_mother="Mother:";
$str_child="Child";
$str_notes="Notes:";
$str_title="Title:";
$str_author="Author:";
$str_pub_info="Publication Info:";
$str_abbr="Abbreviation:";
$str_call_num="Call Number:";
$str_comments="Comments:";
$str_text="Text:";
$str_source="Source";
$str_all_surnames="All surnames in the tree";
$str_people="People";
$str_surnames="Surnames";
$str_married="Married";
$str_divorced="Divorced";
$str_on="on ";
$str_at="at ";
$str_list_of="List of";
$str_lpeople="List of people";
$str_lsurnames="List of surnames";
$str_people_and="people and";
$str_unique_names="unique names";
$str_m="m.";
# Characters to ignore when sorting surnames
$ignoreSurnameSort = " '";
# Leave the rest alone unless you know what's happenin'
$in = 0; # What is being read.
# 0=nothing, 1=header, 2=family record,
# 3=individual record, 4=note record.
# 5=source record.
$in1 = 0; # What is at level 1 at the mo.
# 0=nothing, 1=birth(indiv), 2=death(indiv),
# 3=burial(indiv), 4=notes(i), 7=christening(indiv)
# 50=marriage(fam),
# 60=note(source),
# 61=comment(source).
print "gedcomToHtml $version (c) Dan Pidcock 1997-2006\n";
if ($#ARGV != 0) {
die "usage: gedcomToHTML.pl <gedcom file>\n";
}
print "Gedcom file @ARGV\n";
#######################################################################
# Get the preferences
# Set defaults
$family_table = 1; # print family tree type table
$print_family = 0; # print detailed family info
$print_notes = 1; # Print an individual's notes
$print_sources = 1; # Print an individual's source references
$make_stats = 0; # Make a statistics file
$add_titles = 1; # Add titles to names
$group_letters = 1; # Group by letter
$check_images = 1; # Check for images in the $out_dir/$photo_dir directory
$extension = "html"; # extension for created files
$private = 1; # Make birth information private
$out_dir = "Html"; # Directory where the HTML files will be stored
$photo_dir = "../Photo"; # Directory where the individual's picture files are
# (relative to $out_dir)
$photoThumbnails = 0;
$treepic_path = "../Pics";
$updateStatus = 1;
if (open(IN_FILE, "<$prefsFile")) {
while (<IN_FILE>) {
# match anything except space or = then space = space anything except or # anything
# e.g. variable = value # comment
if (/([^\s=]*)\s*=\s([^#\s]*).*\n/) {
# There must be a better way of doing this...
if ($1 eq "family_table") {
$family_table = $2; }
elsif ($1 eq "print_family") {
$print_family = $2; }
elsif ($1 eq "print_notes") {
$print_notes = $2; }
elsif ($1 eq "print_sources") {
$print_sources = $2; }
elsif ($1 eq "make_stats") {
$make_stats = $2; }
elsif ($1 eq "add_titles") {
$add_titles = $2; }
elsif ($1 eq "group_letters") {
$group_letters = $2; }
elsif ($1 eq "check_images") {
$check_images = $2; }
elsif ($1 eq "extension") {
$extension = $2; }
elsif ($1 eq "private") {
$private = $2; }
elsif ($1 eq "out_dir") {
$out_dir = $2; }
elsif ($1 eq "photo_dir") {
$photo_dir = $2; }
elsif ($1 eq "photo_thumbnails") {
$photoThumbnails = $2; }
elsif ($1 eq "treepic_path") {
$treepic_path = $2; }
elsif ($1 eq "update_status") {
$updateStatus = $2; }
}
}
}
else {
print "Cannot find preferences file $prefsFile - using defaults\n";
}
# Get this year in 4 figure format
$curr_year = 1900 + (localtime(time))[5];
#######################################################################
# Make the directory and chdir to it
if (!-e $out_dir) {
unless (mkdir($out_dir,0755)) {
die "Couldn't create $out_dir directory\n";
}
}
#################################################################
# Read the gedcom file in and created the individual and family
# data structures.
print "Reading information\n";
$| = 1; # flushing for progress report.
$num_indivs = 0;
$num_families = 0;
$num_source = 0;
$num_repository = 0;
while (<>) {
if (/^\s*0.*/) { # a 0 line
if ($in1 != 0) # reset in1
{$in1 = 0;}
if (/^\s*0\s*HEAD/) { # header
$in = 1;
#print "Header $_";
}
elsif (/^\s*0\s@(.*)@\sFAM/) { # family record
$in = 2;
$fam_id = $1;
$fams{$fam_id}++;
$famc_cnt = 1;
$num_families++;
&show_reading_status;
#print "Family $_";
}
elsif (/^\s*0\s@(.*)@\sINDI/) { # individual record
$in = 3;
$indiv_id = $1;
$indivs{$indiv_id}++;
$num_indivs++;
$num_fams = 0; # number of spouses
&show_reading_status;
#print "Individual $_";
}
elsif (/^\s*0\sTRLR/) { # end of file
$in = 0;
}
elsif (/^\s*0\s@(.*)@\sSUBM/) { # submission record - just ignore
$in = 0;
}
elsif (/^\s*0\s@(.*)@\sNOTE/) { # note record - linked to an indi
$note_id = $1;
# Separate notes in separate lines with line break.
$note{$note_id} = $note{$note_id}."<br/>";
$in = 4;
}
elsif (/^\s*0\s@(.*)@\sSOUR/) { # source record - linked to an indi
$sour_id = $1;
$sours{$sour_id}++;
$in = 5;
$num_source++;
&show_reading_status;
}
elsif (/^\s*0\s@(.*)@\sREPO/) { # repository record - linked to a source record
$repo_id = $1;
$repos{$repo_id}++;
$in = 6;
$num_repository++;
&show_reading_status;
}
else {
$in = 0;
print "Don't understand this 0 line: $_";
}
}
elsif (/^\s*1\s(.*)/) { # a 1 line
$rol = $1;
if ($in1 != 0) # reset in1
{$in1 = 0;}
if ($in == 1) {
; # ignore the header
}
elsif ($in == 2) { #family record
#print "\tfamily $fam_id $rol\n";
if ($rol =~ /HUSB\s@(.*)@/) {
$fam_husb{$fam_id} = $1;
}
if ($rol =~ /WIFE\s@(.*)@/) {
$fam_wife{$fam_id} = $1;
}
if ($rol =~ /CHIL\s@(.*)@/) {
#$key = $fam_id."@".$famc_cnt."@".$1;
#$fam_chil{$key} = $1;
if ($famc_cnt == 1) { # First one
$fam_chil{$fam_id} = $1;}
else {
$fam_chil{$fam_id} = $fam_chil{$fam_id}."@".$1;}
$key = $fam_id;
$famc_cnt++;
}
elsif ($rol =~ /MARR.*/) {
$in1 = 50;
}
elsif ($rol =~ /DIV.*/) {
$in1 = 51;
}
}
elsif ($in == 3) { # individual record
#print "\tindividual $indiv_id $rol\n";
if ($rol =~ /NAME\s(.*)/) {
# convert the surname to italics
$name = $1;
$name =~ /(.*)\/(.*)\/(.*)/;
$temp_surname = $2;
$temp_surname =~s/\s$//;
$indiv_surname{$indiv_id} = $temp_surname;
$indiv_forname{$indiv_id} = $1." ".$3;
$_ = $name;
s/\// <i>/;
s/\//<\/i>/;
$indiv_name{$indiv_id} = $_;
$_ = $name;
s/\// /g;
$indiv_name_unformatted{$indiv_id} = $_;
}
elsif ($rol =~ /SEX\s(.)/) {
$indiv_sex{$indiv_id} = $1;
}
elsif ($rol =~ /TITL\s(.*)/) {
$indiv_titl{$indiv_id} = $1;
}
elsif ($rol =~ /BIRT.*/) {
$in1 = 1;
}
elsif ($rol =~ /CHR.*/) {
$in1 = 7;
}
elsif ($rol =~ /DEAT.*/) {
$in1 = 2;
}
elsif ($rol =~ /BURI.*/) {
$in1 = 3;
}
elsif ($rol =~ /OCCU\s(.*)/) {
$indiv_occu{$indiv_id} = $1;
}
#elsif ($rol =~ /NOTE\s@(.*)@/) {
# note with link to level 0 note record
# $indiv_note_link{$indiv_id} = $1;
# $note_indiv_link{$1} = $indiv_id;
# $in1 = 4;
#}
elsif ($rol =~ /NOTE\s(.*)/) {
$indiv_note{$indiv_id} = $1;
$in1 = 4;
}
elsif ($rol =~ /BAPL.*/) {
$in1 = 8;
}
elsif ($rol =~ /ENDL.*/) {
$in1 = 9;
}
elsif ($rol =~ /SLGC.*/) {
$in1 = 10;
}
elsif ($rol =~ /SLGS.*/) {
$in1 = 11;
}
elsif ($rol =~ /SOUR\s@(.*)@/) { # general source for individual
$indiv_sour{$indiv_id} = $1;
}
elsif ($rol =~ /FAMC\s@(.*)@/) { # child to family link
$indiv_famc{$indiv_id} = $1;
}
elsif ($rol =~ /FAMS\s@(.*)@/) { # spouse to family link
if ($num_fams > 0) {
$indiv_fams{$indiv_id} = $indiv_fams{$indiv_id}."@".$1;
}
else {
$indiv_fams{$indiv_id} = $1;
}
$num_fams++;
}
}
elsif ($in == 4) { # note record
# $note_id has the note link code
if ($rol =~ /CONC\s?(.*)/) {
$note{$note_id} = $note{$note_id}." $1";
}
elsif ($rol =~ /CONT\s?(.*)/) {
$note{$note_id} = $note{$note_id} . "<br/>\n$1" ;
}
}
elsif ($in == 5) { # sour record
# Convert any http references so a user jump from the source
# file directly to the source link.
# This assumes the reference is space delimited, could be better.
$rol =~ s/(http:\/\/\S+)/<a href=\"$1\">$1<\/a>/;
if ($rol =~ /TITL\s?(.*)/) {
$sour_titl{$sour_id} = $1;
}
elsif ($rol =~ /AUTH\s?(.*)/) {
$sour_auth{$sour_id} = $1;
}
elsif ($rol =~ /REPO\s@(.*)@/) {
$sour_repo{$sour_id} = $1;
}
elsif ($rol =~ /PUBL\s?(.*)/) {
$sour_publ{$sour_id} = $1;
}
elsif ($rol =~ /ABBR\s?(.*)/) {
$sour_abbr{$sour_id} = $1;
}
elsif ($rol =~ /CALN\s?(.*)/) {
$sour_caln{$sour_id} = $1;
}
elsif ($rol =~ /NOTE\s?(.*)/) {
$sour_note{$sour_id} = $1;
$in1 = 60;
}
elsif ($rol =~ /TEXT\s?(.*)/) {
$sour_text{$sour_id} = $1;
$in1 = 61;
}
}
elsif ($in == 6) { # sour record
# Convert any http references so a user jump from the source
# file directly to the source link.
# This assumes the reference is space delimited, could be better.
$rol =~ s/(http:\/\/\S+)/<a href=\"$1\">$1<\/a>/;
if ($rol =~ /NAME\s?(.*)/) {
$repo_name{$repo_id} = $1;
}
elsif ($rol =~ /ADDR\s?(.*)/) {
$repo_addr{$repo_id} = $1;
$in1 = 601;
}
elsif ($rol =~ /NOTE\s?(.*)/) {
$repo_note{$repo_id} = $1;
$in1 = 602;
}
elsif ($in1 == 1) { # TEXT in source
if ($rol =~ /CONC\s?(.*)/) {
$repo_addr{$repo_id} = $repo_addr{$repo_id}." $1";
}
elsif ($rol =~ /CONT\s?(.*)/) {
$repo_addr{$repo_id} = $repo_addr{$repo_id}."<br/>\n$1";
}
}
}
} # end if a 1 line
elsif (/^\s*2\s(.*)/) { # a 2 line
$rol = $1;
if ($in1 == 1) { # BIRT in individual
if ($rol =~ /DATE\s(.*)/) {
$indiv_birt_date{$indiv_id} = $1;
$indiv_birt{$indiv_id} = 1;
}
elsif ($rol =~ /PLAC\s(.*)/) {
$indiv_birt_plac{$indiv_id} = $1;
$indiv_birt{$indiv_id} = 1;
}
elsif ($rol =~ /SOUR\s@(.*)@/) { # source of birth record
$indiv_birt_sour{$indiv_id} = $1;
$indiv_birt{$indiv_id} = 1;
}
}
elsif ($in1 == 2) { # DEAT in individual
if ($rol =~ /DATE\s(.*)/) {
$indiv_deat_date{$indiv_id} = $1;
$indiv_deat{$indiv_id} = 1;
}
elsif ($rol =~ /PLAC\s(.*)/) {
$indiv_deat_plac{$indiv_id} = $1;
$indiv_deat{$indiv_id} = 1;
}
elsif ($rol =~ /SOUR\s@(.*)@/) { # source of death record
$indiv_deat_sour{$indiv_id} = $1;
$indiv_deat{$indiv_id} = 1;
}
}
elsif ($in1 == 3) { # BURI in individual
if ($rol =~ /DATE\s(.*)/) {
$indiv_buri_date{$indiv_id} = $1;
$indiv_buri{$indiv_id} = 1;
}
elsif ($rol =~ /PLAC\s(.*)/) {
$indiv_buri_plac{$indiv_id} = $1;
$indiv_buri{$indiv_id} = 1;
}
}
elsif ($in1 == 4) { # NOTE in individual
if ($rol =~ /CONC\s?(.*)/) {
$indiv_note{$indiv_id} = $indiv_note{$indiv_id}." $1";
}
elsif ($rol =~ /CONT\s?(.*)/) {
$indiv_note{$indiv_id} = $indiv_note{$indiv_id}."<p/>\n$1" ;
}
}
if ($in1 == 7) { # CHR in individual
if ($rol =~ /DATE\s(.*)/) {
$indiv_chr_date{$indiv_id} = $1;
$indiv_chr{$indiv_id} = 1;
}
elsif ($rol =~ /PLAC\s(.*)/) {
$indiv_chr_plac{$indiv_id} = $1;
$indiv_che{$indiv_id} = 1;
}
elsif ($rol =~ /SOUR\s@(.*)@/) { # source of christening record
$indiv_chr_sour{$indiv_id} = $1;
$indiv_chr{$indiv_id} = 1;
}
}
elsif ($in1 == 8) { # BAPL in individual
if ($rol =~ /DATE\s(.*)/) {
$indiv_bapl_date{$indiv_id} = $1;
$indiv_bapl{$indiv_id} = 1;
}
elsif ($rol =~ /PLAC\s(.*)/) {
$indiv_bapl_plac{$indiv_id} = $1;
$indiv_bapl{$indiv_id} = 1;
}
elsif ($rol =~ /TEMP\s(.*)/) {
$indiv_bapl_temp{$indiv_id} = $1;
$indiv_bapl{$indiv_id} = 1;
}
elsif ($rol =~ /STAT\s(.*)/) {
$indiv_bapl_stat{$indiv_id} = $1;
$indiv_bapl{$indiv_id} = 1;
}
}
elsif ($in1 == 9) { # ENDL in individual
if ($rol =~ /DATE\s(.*)/) {
$indiv_endl_date{$indiv_id} = $1;
$indiv_endl{$indiv_id} = 1;
}
elsif ($rol =~ /PLAC\s(.*)/) {
$indiv_endl_plac{$indiv_id} = $1;
$indiv_endl{$indiv_id} = 1;
}
elsif ($rol =~ /TEMP\s(.*)/) {
$indiv_endl_temp{$indiv_id} = $1;
$indiv_endl{$indiv_id} = 1;
}
elsif ($rol =~ /STAT\s(.*)/) {
$indiv_endl_stat{$indiv_id} = $1;
$indiv_endl{$indiv_id} = 1;
}
}
elsif ($in1 == 10) { # SLGC in individual
if ($rol =~ /DATE\s(.*)/) {
$indiv_slgc_date{$indiv_id} = $1;
$indiv_slgc{$indiv_id} = 1;
}
elsif ($rol =~ /PLAC\s(.*)/) {
$indiv_slgc_plac{$indiv_id} = $1;
$indiv_slgc{$indiv_id} = 1;
}
elsif ($rol =~ /TEMP\s(.*)/) {
$indiv_slgc_temp{$indiv_id} = $1;
$indiv_slgc{$indiv_id} = 1;
}
elsif ($rol =~ /STAT\s(.*)/) {
$indiv_slgc_stat{$indiv_id} = $1;
$indiv_slgc{$indiv_id} = 1;
}
}
elsif ($in1 == 11) { # SLGS in individual
if ($rol =~ /DATE\s(.*)/) {
$indiv_slgs_date{$indiv_id} = $1;
$indiv_slgs{$indiv_id} = 1;
}
elsif ($rol =~ /PLAC\s(.*)/) {
$indiv_slgs_plac{$indiv_id} = $1;
$indiv_slgs{$indiv_id} = 1;
}
elsif ($rol =~ /TEMP\s(.*)/) {
$indiv_slgs_temp{$indiv_id} = $1;
$indiv_slgs{$indiv_id} = 1;
}
elsif ($rol =~ /STAT\s(.*)/) {
$indiv_slgs_stat{$indiv_id} = $1;
$indiv_slgs{$indiv_id} = 1;
}
}
elsif ($in1 == 50) { # MARR in family
if ($rol =~ /DATE\s(.*)/) {
$fam_marr_date{$fam_id} = $1;
$fam_marr{$fam_id} = 1;
}
elsif ($rol =~ /PLAC\s(.*)/) {
$fam_marr_plac{$fam_id} = $1;
$fam_marr{$fam_id} = 1;
}
elsif ($rol =~ /SOUR\s@(.*)@/) { # source of marriage record
$fam_marr_sour{$fam_id} = $1;
$fam_marr{$fam_id} = 1;
}
}
elsif ($in1 == 51) { # DIV in family
if ($rol =~ /DATE\s(.*)/) {
$fam_div_date{$fam_id} = $1;
$fam_div{$fam_id} = 1;
}
elsif ($rol =~ /PLAC\s(.*)/) {
$fam_div_plac{$fam_id} = $1;
$fam_div{$fam_id} = 1;
}
elsif ($rol =~ /SOUR\s@(.*)@/) { # source of divorce record
$fam_div_sour{$fam_id} = $1;
$fam_div{$fam_id} = 1;
}
}
elsif ($in1 == 60) { # NOTE in source
if ($rol =~ /CONC\s?(.*)/) {
$sour_note{$sour_id} = $sour_note{$sour_id}." $1";
}
elsif ($rol =~ /CONT\s?(.*)/) {
$sour_note{$sour_id} = $sour_note{$sour_id}."<br/>\n$1";
}
}
elsif ($in1 == 61) { # TEXT in source
if ($rol =~ /CONC\s?(.*)/) {
$sour_text{$sour_id} = $sour_text{$sour_id}." $1";
}
elsif ($rol =~ /CONT\s?(.*)/) {
$sour_text{$sour_id} = $sour_text{$sour_id}."<br/>\n$1";
}
}
elsif ($in1 == 601) { # TEXT in source
if ($rol =~ /CONC\s?(.*)/) {
$repo_addr{$repo_id} = $repo_addr{$repo_id}." $1";
}
elsif ($rol =~ /CONT\s?(.*)/) {
$repo_addr{$repo_id} = $repo_addr{$repo_id}."<br />\n$1";
}
}
elsif ($in1 == 602) { # TEXT in source
if ($rol =~ /CONC\s?(.*)/) {
$repo_note{$repo_id} = $repo_note{$repo_id}." $1";
}
elsif ($rol =~ /CONT\s?(.*)/) {
$repo_note{$repo_id} = $repo_note{$repo_id}."<br />\n$1";
}
}
} # end if a 2 line
}
#################################################################
# Link note data to individual records
foreach $note_id (keys %note) {
$indiv_note{$note_indiv_link{$note_id}} = $indiv_note{$note_indiv_link{$note_id}}.$indiv_note{$note_id};
}
#################################################################
# Set up the HTML for the top and bottom of individual's files
if (open(IN_FILE, "tpl_ind_top.html")) {
$i = 0;
while (<IN_FILE>) {
$html_ind_top[$i] = $_;
$i++;
}
}
else { # use defaults
$html_ind_top[0] = "<body>\n";
$html_ind_top[1] = "<h1>#ind_name</h1>\n";
}
close(IN_FILE);
if (open(IN_FILE, "tpl_ind_bot.html")) {
$i = 0;
while (<IN_FILE>) {
$html_ind_bot[$i] = $_;
$i++;
}
}
else { # use defaults
$html_ind_bot[0] = "<hr width=50%>\n";
$html_ind_bot[1] = "<br/><a href=\"people.$extension\">$str_lpeople</a> ";
$html_ind_bot[2] = "| <a href=\"surnames.$extension\">$str_lsurnames</a><p/>\n";
}
close(IN_FILE);
#################################################################
# show results
print "\nCreating individual files\n";
$ind_cnt = 0;
# make a file for each individual
foreach $indiv_id (keys %indivs) {
$ind_cnt++;
if ((($ind_cnt % $updateStatus) == 0)) {
print "$ind_cnt\r"; }
# open an output file
unless (open(OUT_FILE, ">$out_dir/$indiv_id.$extension")) {
die "\nCouldn't open output file $out_dir/$indiv_id.$extension\n";
}
# Split the list of spouse families into @fams.
# Need to clear the array for some versions of perl.
@fams = ();
@fams = split(/@/, $indiv_fams{$indiv_id});
#print "Fams:@fams\n";
$famc = $indiv_famc{$indiv_id};
# Add the title to the name if required and exists
if ($add_titles && $indiv_titl{$indiv_id})
{
$indiv_name{$indiv_id} = $indiv_name{$indiv_id}." ".$indiv_titl{$indiv_id};
$indiv_name_unformatted{$indiv_id} = $indiv_name_unformatted{$indiv_id}." ".$indiv_titl{$indiv_id};
}
##############################################################
# print the information to file
# Make birth info private if required and person alive
if ($private && $indiv_deat{$indiv_id} == 0) {
# No death record - check if born too long ago
if ($indiv_birt_date{$indiv_id} =~ /([0-9][0-9][0-9][0-9])/) {
$year = $1;
if ($year > $curr_year) {
print "Individual $indiv_id has birth date ($1) after this year ($curr_year)\n";
}
elsif ($year+120 > $curr_year) { # May be alive
&make_birt_private($indiv_id);
}
}
elsif ($indiv_chr_date{$indiv_id} =~ /([0-9][0-9][0-9][0-9])/) {
$year = $1;
if ($year > $curr_year) {
print "Individual $indiv_id has christening date ($1) after this year ($curr_year)\n";
}
elsif ($year+120 > $curr_year) { # May be alive
&make_birt_private($indiv_id);
}
}
else { # Couldn't find a birth year - make private
&make_birt_private($indiv_id);
}
}
# Check if there is a photo for the individual
# Thanks to Bob Minteer for the code this is based on
if ($check_images) {
if (-r "$out_dir/$photo_dir/$indiv_id.jpg") {
$imgpath{$indiv_id}="$photo_dir/$indiv_id.jpg";
}
elsif (-r "$out_dir/$photo_dir/$indiv_id.gif") {
$imgpath{$indiv_id}="$photo_dir/$indiv_id.gif";
}
else {
$imgpath{$indiv_id}="";
}
}
print OUT_FILE "<html><head><title>$indiv_name_unformatted{$indiv_id} ($indiv_birt_date{$indiv_id} - $indiv_deat_date{$indiv_id})</title></head>\n\n";
# print HTML at top of page
$html_ind_top_l = @html_ind_top;
for ($i = 0; $i < $html_ind_top_l; $i++) {
$_ = $html_ind_top[$i];
s/\#ind_name/$indiv_name{$indiv_id}/ei;
print OUT_FILE $_;
if (($check_images) && ($imgpath{$indiv_id} ne "") && (/<body/)) {
if ($photoThumbnails) {
print OUT_FILE "<A HREF=\"$imgpath{$indiv_id}\">"; }
print OUT_FILE "<IMG SRC=\"$imgpath{$indiv_id}\" ALIGN=\"right\"";
if ($photoThumbnails) {
print OUT_FILE " WIDTH=150 ALT=\"click to enlarge\"></a>\n"; }
else {
print OUT_FILE ">\n"; }
}
}
if ($print_sources && $indiv_sour{$indiv_id})
{
print OUT_FILE "<a href=\"$indiv_sour{$indiv_id}.$extension\">$str_source</a><br/><br/>\n";
}
# birth date and place
if ($indiv_birt{$indiv_id}) {
$printComma = 0;
print OUT_FILE "$str_birth ";
if ($indiv_birt_date{$indiv_id}) {
print OUT_FILE "$indiv_birt_date{$indiv_id}";
$printComma = 1;
}
if ($indiv_birt_plac{$indiv_id}) {
if ($printComma)
{print OUT_FILE ", ";}
print OUT_FILE "$indiv_birt_plac{$indiv_id}";
$printComma = 1;
}
if ($print_sources && $indiv_birt_sour{$indiv_id}) {
if ($printComma)
{print OUT_FILE " ";}
print OUT_FILE "<a href=\"$indiv_birt_sour{$indiv_id}.$extension\">$str_source</a>";
}
print OUT_FILE "<br/>\n";
}
# Christening
if ($indiv_chr{$indiv_id}) {
$printComma = 0;
print OUT_FILE "$str_chr ";
if ($indiv_chr_date{$indiv_id}) {
print OUT_FILE "$indiv_chr_date{$indiv_id}";
$printComma = 1;
}
if ($indiv_chr_plac{$indiv_id}) {
if ($printComma)
{print OUT_FILE ", ";}
print OUT_FILE "$indiv_chr_plac{$indiv_id}";
$printComma = 1;
}
if ($print_sources && $indiv_chr_sour{$indiv_id}) {
if ($printComma)
{print OUT_FILE " ";}
print OUT_FILE "<a href=\"$indiv_chr_sour{$indiv_id}.$extension\">$str_source</a>";
}
print OUT_FILE "<br/>\n";
}
# death date and place
if ($indiv_deat{$indiv_id}) {
$printComma = 0;
print OUT_FILE "$str_death ";
if ($indiv_deat_date{$indiv_id}) {
print OUT_FILE "$indiv_deat_date{$indiv_id}";
$printComma = 1;
}
if ($indiv_deat_plac{$indiv_id}) {
if ($printComma)
{print OUT_FILE ", ";}
print OUT_FILE "$indiv_deat_plac{$indiv_id}";
$printComma = 1;
}
if ($print_sources && $indiv_deat_sour{$indiv_id}) {
if ($printComma)
{print OUT_FILE " ";}
print OUT_FILE "<a href=\"$indiv_deat_sour{$indiv_id}.$extension\">$str_source</a>";
}
print OUT_FILE "<br/>\n";
}
# burial date and place
if ($indiv_buri{$indiv_id}) {
print OUT_FILE "$str_burial ";
if ($indiv_buri_date{$indiv_id}) {
print OUT_FILE "$indiv_buri_date{$indiv_id}";
if ($indiv_buri_plac{$indiv_id})
{print OUT_FILE ", ";}
}
if ($indiv_buri_plac{$indiv_id}) {
print OUT_FILE "$indiv_buri_plac{$indiv_id}";
}
print OUT_FILE "<br/>\n";
}
# BAPL date and place
if ($indiv_bapl{$indiv_id}) {
print OUT_FILE "$str_baptism ";
if ($indiv_bapl_date{$indiv_id}) {
print OUT_FILE "$indiv_bapl_date{$indiv_id}";
if ($indiv_bapl_plac{$indiv_id} || $indiv_bapl_temp{$indiv_id})
{print OUT_FILE ", ";}
}
if ($indiv_bapl_plac{$indiv_id}) {
print OUT_FILE "$indiv_bapl_plac{$indiv_id}";
if ($indiv_bapl_temp{$indiv_id})
{print OUT_FILE ", ";}
}
if ($indiv_bapl_temp{$indiv_id}) {
print OUT_FILE "$indiv_bapl_temp{$indiv_id}";
}
print OUT_FILE "<br/>\n";
}
# ENDL date and place
if ($indiv_endl{$indiv_id}) {
print OUT_FILE "$str_endowment ";
if ($indiv_endl_date{$indiv_id}) {
print OUT_FILE "$indiv_endl_date{$indiv_id}";
if ($indiv_endl_plac{$indiv_id} || $indiv_endl_temp{$indiv_id})
{print OUT_FILE ", ";}
}
if ($indiv_endl_plac{$indiv_id}) {
print OUT_FILE "$indiv_endl_plac{$indiv_id}";
if ($indiv_endl_temp{$indiv_id})
{print OUT_FILE ", ";}
}
if ($indiv_endl_temp{$indiv_id}) {
print OUT_FILE "$indiv_endl_temp{$indiv_id}";
}
print OUT_FILE "<br/>\n";
}
# SLGC date and place
if ($indiv_slgc{$indiv_id}) {
print OUT_FILE "$str_sealing_children ";
if ($indiv_slgc_date{$indiv_id}) {
print OUT_FILE "$indiv_slgc_date{$indiv_id}";
if ($indiv_slgc_plac{$indiv_id} || $indiv_slgc_temp{$indiv_id})
{print OUT_FILE ", ";}
}
if ($indiv_slgc_plac{$indiv_id}) {
print OUT_FILE "$indiv_slgc_plac{$indiv_id}";
if ($indiv_slgc_temp{$indiv_id})
{print OUT_FILE ", ";}
}
if ($indiv_slgc_temp{$indiv_id}) {
print OUT_FILE "$indiv_slgc_temp{$indiv_id}";
}
print OUT_FILE "<br/>\n";
}
# SLGS date and place
if ($indiv_slgs{$indiv_id}) {
print OUT_FILE "$str_sealing_spouse ";
if ($indiv_slgs_date{$indiv_id}) {
print OUT_FILE "$indiv_slgs_date{$indiv_id}";
if ($indiv_slgs_plac{$indiv_id} || $indiv_slgs_temp{$indiv_id})
{print OUT_FILE ", ";}
}
if ($indiv_slgs_plac{$indiv_id}) {
print OUT_FILE "$indiv_slgs_plac{$indiv_id}";
if ($indiv_slgs_temp{$indiv_id})
{print OUT_FILE ", ";}
}
if ($indiv_slgs_temp{$indiv_id}) {
print OUT_FILE "$indiv_slgs_temp{$indiv_id}";
}
print OUT_FILE "<br/>\n";
}
print OUT_FILE "<p/>\n";
# occupation
if ($indiv_occu{$indiv_id}) {
print OUT_FILE "$str_occupation $indiv_occu{$indiv_id}<p/>\n";
}
print OUT_FILE "<p>\n";
# print marriage info if more than just spouse name is known
if (!$print_family) {
&print_marriages;
}
if ($family_table || $print_family) {
&get_parent_data;
&get_child_data;
}
# If $family_table then print the ancestors chart (needs $father,
# $mother, $pgfather etc., $famc.
if ($family_table) {
&get_gparent_data;
# family chart
print OUT_FILE "<p>\n<table border=1 cellspacing=0 cellpadding=0>\n";
if (($father ne "") || ($mother ne "")) {
print OUT_FILE &tableAncestors();
} # end if has a parent
$fams_len = @fams;
if ($fams_len != 0) {
# Spouse(s) and their children
for ($fams_num=0; $fams_num < $fams_len; $fams_num++) {
&get_spouse_data($fams[$fams_num]);
&get_child_data($fams[$fams_num]);
print OUT_FILE &tableSpouseChildren();
} # end for each family
} # end if has spouses
print OUT_FILE "</table>\n<p>\n";
} # end if family_table
# If $print_family then print parents, marriage(s), children.
# Uses $father, $mother, @child, $famc, $fams.
if ($print_family) {
# parents
if ($father ne "") {
print OUT_FILE "$str_father <a href=\"$father_id.$extension\">$father</a><br/>\n";
}
if ($mother ne "") {
print OUT_FILE "$str_mother <a href=\"$mother_id.$extension\">$mother</a><p>\n";
}
print OUT_FILE "<p/>\n";
# spouse, marriage date and place and children
&print_marriages(1);
} # end if print_family
print OUT_FILE "<p/>\n";
# notes
if ($print_notes && $indiv_note{$indiv_id}) {
print OUT_FILE "$str_notes $indiv_note{$indiv_id}\n";
print OUT_FILE "<p/>\n";
}
# print HTML at bottom of page
print OUT_FILE @html_ind_bot;
&print_footer;
close(OUT_FILE);
} # end foreach $indiv_id (keys %indivs)
if ($print_sources)
{
print "\rCreating source files\n";
foreach $sour_id (keys %sours) {
# open an output file
unless (open(OUT_FILE, ">$out_dir/$sour_id.$extension")) {
die "\nCouldn't open output file $out_dir/$sour_id.$extension\n";
}
print OUT_FILE "<html><head><title>$str_source $sour_id</title></head>\n\n<body>\n";
if ($sour_titl{$sour_id}) {
print OUT_FILE "$str_title $sour_titl{$sour_id}<br/>\n";
}
if ($sour_auth{$sour_id}) {
print OUT_FILE "$str_author $sour_auth{$sour_id}<br/>\n";
}
if ($sour_publ{$sour_id}) {
print OUT_FILE "$str_pub_info $sour_publ{$sour_id}<br/>\n";
}
if ($sour_abbr{$sour_id}) {
print OUT_FILE "$str_abbr $sour_abbr{$sour_id}<br/>\n";
}
if ($sour_caln{$sour_id}) {