Skip to content

Commit 262a5b3

Browse files
author
Matthias Rabe
committed
fixup for gedcom 5.5 obje
Signed-off-by: Matthias Rabe <[email protected]>
1 parent 4b7d3d7 commit 262a5b3

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

lib/ged_parse.inc.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,9 @@ def refresh
364364
end
365365
end
366366
else
367-
if tag == "OBJE" and find_by_object_gid(rest).nil?
367+
if tag == "OBJE" and rest.to_s == ""
368+
# nothing to do, rest is only empty on gedcom 5.5
369+
elsif tag == "OBJE" and find_by_object_gid(rest).nil?
368370
object_section= Object.new(rest)
369371
object_level= level
370372
elsif not object_section.nil?

reports/book.inc.rb

+18-7
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,24 @@ def report_person_print_profile(ged, indi, own_fams)
135135
mugshot= DEFAULT_MUGSHOT
136136
indi.objs.each {|o|
137137
img= nil; ok= false
138-
o[:children].each {|oc|
139-
case oc[:field]
140-
when "OBJE_FORM" then ok= IMG_FMTS.include? oc[:value].downcase
141-
when "OBJE_FILE" then img= oc[:value]
142-
end
143-
}
144-
(mugshot= img; break) if ok
138+
139+
obj = ged.find_by_object_gid(o[:value])
140+
if not obj.nil?
141+
ok = IMG_FMTS.include? obj.type.downcase
142+
img = obj.fname
143+
else # fallback for older gedcoms
144+
o[:children].each {|oc|
145+
case oc[:field]
146+
when "OBJE_FORM" then ok= IMG_FMTS.include? oc[:value].downcase
147+
when "OBJE_FILE" then img= oc[:value]
148+
end
149+
}
150+
end
151+
152+
if ok
153+
(mugshot= img; break) if File.exist?img
154+
$stderr.puts "'#{img}' not found - skipped"
155+
end
145156
}
146157

147158
$params[:ofile].print "\\begin{minipage}[t]{45mm} \n"

0 commit comments

Comments
 (0)