Class: EADConverter
- Inherits:
-
Converter
- Object
- Converter
- EADConverter
- Includes:
- ASpaceImport::XML::SAX
- Defined in:
- backend/app/converters/ead_converter.rb
Class Method Summary (collapse)
-
+ (Object) configure
-
+ (Object) import_types(show_hidden = false)
-
+ (Object) instance_for(type, input_file)
-
+ (Object) profile
Instance Method Summary (collapse)
-
- (Object) format_content(content)
A lot of nodes need tweaking to format the content.
-
- (Object) insert_into_subnotes(split_tag = 'list')
alright, wtf.
-
- (Boolean) is_node_empty?(node)
We override this to skip nodes that are often very deep We can safely assume ead, c, and archdesc will have children, which greatly helps the performance.
-
- (Object) make_corp_template(opts)
Templates Section.
-
- (Object) make_family_template(opts)
-
- (Object) make_nested_note(note_name, tag)
-
- (Object) make_person_template(opts)
-
- (Object) make_single_note(note_name, tag, tag_name = "")
Methods included from ASpaceImport::XML::SAX
#ancestor, #append, #att, #close_context, #context, #context_obj, #full_context, #handle_closer, #handle_opener, #handle_text, included, #inner_xml, #make_sticky, #method_missing, #node, #node_queue_for, #open_context, #outer_xml, #pprint_current_node, #proxy, #run, #set, #set_property
Methods inherited from Converter
for, #get_output_path, inherited, #initialize, list_import_types, register_converter, #remove_files
Constructor Details
This class inherits a constructor from Converter
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ASpaceImport::XML::SAX
Class Method Details
+ (Object) configure
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 |
# File 'backend/app/converters/ead_converter.rb', line 96 def self.configure with 'ead' do |node| make :resource end ignore "titlepage" with 'archdesc' do set :level, att('level') || 'otherlevel' set :other_level, att('otherlevel') set :publish, att('audience') != 'internal' end # c, c1, c2, etc... (0..12).to_a.map {|i| "c" + (i+100).to_s[1..-1]}.push('c').each do |c| with c do make :archival_object, { :level => att('level') || 'otherlevel', :other_level => att('otherlevel'), :ref_id => att('id'), :resource => ancestor(:resource), :parent => ancestor(:archival_object), :publish => att('audience') != 'internal' } end end with 'unitid' do |node| ancestor(:note_multipart, :resource, :archival_object) do |obj| case obj.class.record_type when 'resource' # inner_xml.split(/[\/_\-\.\s]/).each_with_index do |id, i| # set receiver, "id_#{i}".to_sym, id # end set obj, :id_0, inner_xml when 'archival_object' set obj, :component_id, inner_xml end end end with 'unittitle' do |node| ancestor(:note_multipart, :resource, :archival_object) do |obj| unless obj.class.record_type == "note_multipart" title = Nokogiri::XML::DocumentFragment.parse(inner_xml.strip) title.xpath(".//unitdate").remove obj.title = format_content( title.to_xml(:encoding => 'utf-8') ) end end end with 'unitdate' do |node| norm_dates = (att('normal') || "").sub(/^\s/, '').sub(/\s$/, '').split('/') if norm_dates.length == 1 norm_dates[1] = norm_dates[0] end norm_dates.map! {|d| d =~ /^([0-9]{4}(\-(1[0-2]|0[1-9])(\-(0[1-9]|[12][0-9]|3[01]))?)?)$/ ? d : nil} make :date, { :date_type => att('type') || 'inclusive', :expression => inner_xml, :label => 'creation', :begin => norm_dates[0], :end => norm_dates[1], :calendar => att('calendar'), :era => att('era'), :certainty => att('certainty') } do |date| set ancestor(:resource, :archival_object), :dates, date end end with "langmaterial" do # first, assign the primary language to the ead langmaterial = Nokogiri::XML::DocumentFragment.parse(inner_xml) langmaterial.children.each do |child| if child.name == 'language' set ancestor(:resource, :archival_object), :language, child.attr("langcode") break end end # write full tag content to a note, subbing out the language tags content = inner_xml next if content =~ /\A<language langcode=\"[a-z]+\"\/>\Z/ if content.match(/\A<language langcode=\"[a-z]+\"\s*>([^<]+)<\/language>\Z/) content = $1 end make :note_singlepart, { :type => "langmaterial", :persistent_id => att('id'), :content => format_content( content.sub(/<head>.*?<\/head>/, '') ) } do |note| set ancestor(:resource, :archival_object), :notes, note end end def make_single_note(note_name, tag, tag_name="") content = tag.inner_text if !tag_name.empty? content = tag_name + ": " + content end make :note_singlepart, { :type => note_name, :persistent_id => att('id'), :content => format_content( content.sub(/<head>.?<\/head>/, '').strip) } do |note| set ancestor(:resource, :archival_object), :notes, note end end def make_nested_note(note_name, tag) content = tag.inner_text make :note_multipart, { :type => note_name, :persistent_id => att('id'), :subnotes => { 'jsonmodel_type' => 'note_text', 'content' => format_content( content ) } } do |note| set ancestor(:resource, :archival_object), :notes, note end end with 'physdesc' do physdesc = Nokogiri::XML::DocumentFragment.parse(inner_xml) extent_number_and_type = nil dimensions = [] physfacets = [] container_summaries = [] other_extent_data = [] container_summary_texts = [] dimensions_texts = [] physfacet_texts = [] # If there is already a portion of 'part' specified, use it if att('altrender') && att('altrender').downcase == 'part' portion = 'part' else portion = 'whole' end physdesc.children.each do |child| # "extent" can have one of two kinds of semantic meanings: either a true extent with number and type, # or a container summary. Disambiguation is done through a regex. if child.name == 'extent' child_content = child.content.strip if extent_number_and_type.nil? && child_content =~ /^([0-9\.]+)+\s+(.*)$/ extent_number_and_type = {:number => $1, :extent_type => $2} else container_summaries << child container_summary_texts << child.content.strip end elsif child.name == 'physfacet' physfacets << child physfacet_texts << child.content.strip elsif child.name == 'dimensions' dimensions << child dimensions_texts << child.content.strip elsif child.name != 'text' other_extent_data << child end end # only make an extent if we got a number and type, otherwise put all tags in the physdesc in new notes if extent_number_and_type make :extent, { :number => $1, :extent_type => $2, :portion => portion, :container_summary => container_summary_texts.join('; '), :physical_details => physfacet_texts.join('; '), :dimensions => dimensions_texts.join('; ') } do |extent| set ancestor(:resource, :archival_object), :extents, extent end # there's no true extent; split up the rest into individual notes else container_summaries.each do |summary| make_single_note("physdesc", summary) end physfacets.each do |physfacet| make_single_note("physfacet", physfacet) end dimensions.each do |dimension| make_nested_note("dimensions", dimension) end end other_extent_data.each do |unknown_tag| make_single_note("physdesc", unknown_tag, unknown_tag.name) end end with 'bibliography' do make :note_bibliography set :persistent_id, att('id') set ancestor(:resource, :archival_object), :notes, proxy end with 'index' do make :note_index set :persistent_id, att('id') set ancestor(:resource, :archival_object), :notes, proxy end %w(bibliography index).each do |x| with "#{x}/head" do |node| set :label, format_content( inner_xml ) end with "#{x}/p" do set :content, format_content( inner_xml ) end end with 'bibliography/bibref' do set :items, inner_xml end { 'name' => 'name', 'persname' => 'person', 'famname' => 'family', 'corpname' => 'corporate_entity', 'subject' => 'subject', 'function' => 'function', 'occupation' => 'occupation', 'genreform' => 'genre_form', 'title' => 'title', 'geogname' => 'geographic_name' }.each do |k, v| with "indexentry/#{k}" do |node| make :note_index_item, { :type => v, :value => format_content( inner_xml ) } do |item| set ancestor(:note_index), :items, item end end end # this is very imperfect. with 'indexentry/ref' do make :note_index_item, { :type => 'name', :value => inner_xml, :reference_text => format_content( inner_xml ), :reference => att('target') } do |item| set ancestor(:note_index), :items, item end end %w(accessrestrict accessrestrict/legalstatus \ accruals acqinfo altformavail appraisal arrangement \ bioghist custodhist \ fileplan odd otherfindaid originalsloc phystech \ prefercite processinfo relatedmaterial scopecontent \ separatedmaterial userestrict ).each do |note| with note do |node| content = inner_xml.tap {|xml| xml.sub!(/<head>.*?<\/head>/m, '') # xml.sub!(/<list [^>]*>.*?<\/list>/m, '') # xml.sub!(/<chronlist [^>]*>.*<\/chronlist>/m, '') } make :note_multipart, { :type => node.name, :persistent_id => att('id'), :subnotes => { 'jsonmodel_type' => 'note_text', 'content' => format_content( content ) } } do |note| set ancestor(:resource, :archival_object), :notes, note end end end %w(abstract materialspec physloc).each do |note| with note do |node| content = inner_xml make :note_singlepart, { :type => note, :persistent_id => att('id'), :content => format_content( content.sub(/<head>.*?<\/head>/, '') ) } do |note| set ancestor(:resource, :archival_object), :notes, note end end end with 'notestmt/note' do append :finding_aid_note, format_content( inner_xml ) end with 'chronlist' do if ancestor(:note_multipart) left_overs = insert_into_subnotes else left_overs = nil make :note_multipart, { :type => node.name, :persistent_id => att('id'), } do |note| set ancestor(:resource, :archival_object), :notes, note end end make :note_chronology do |note| set ancestor(:note_multipart), :subnotes, note end # and finally put the leftovers back in the list of subnotes... if ( !left_overs.nil? && left_overs["content"] && left_overs["content"].length > 0 ) set ancestor(:note_multipart), :subnotes, left_overs end end with 'chronitem' do context_obj.items << {} end %w(eventgrp/event chronitem/event).each do |path| with path do context_obj.items.last['events'] ||= [] context_obj.items.last['events'] << format_content( inner_xml ) end end with 'list' do if ancestor(:note_multipart) left_overs = insert_into_subnotes else left_overs = nil make :note_multipart, { :type => 'odd', :persistent_id => att('id'), } do |note| set ancestor(:resource, :archival_object), :notes, note end end # now let's make the subnote list type = att('type') if type == 'deflist' || (type.nil? && inner_xml.match(/<deflist>/)) make :note_definedlist do |note| set ancestor(:note_multipart), :subnotes, note end else make :note_orderedlist, { :enumeration => att('numeration') } do |note| set ancestor(:note_multipart), :subnotes, note end end # and finally put the leftovers back in the list of subnotes... if ( !left_overs.nil? && left_overs["content"] && left_overs["content"].length > 0 ) set ancestor(:note_multipart), :subnotes, left_overs end end with 'list/head' do |node| set :title, format_content( inner_xml ) end with 'defitem' do |node| context_obj.items << {} end with 'defitem/label' do |node| context_obj.items.last['label'] = format_content( inner_xml ) if context == :note_definedlist end with 'defitem/item' do |node| context_obj.items.last['value'] = format_content( inner_xml ) if context == :note_definedlist end with 'list/item' do set :items, inner_xml if context == :note_orderedlist end with 'publicationstmt/date' do set :finding_aid_date, inner_xml if context == :resource end with 'date' do if context == :note_chronology date = inner_xml context_obj.items.last['event_date'] = date end end with 'head' do if context == :note_multipart set :label, format_content( inner_xml ) elsif context == :note_chronology set :title, format_content( inner_xml ) end end # example of a 1:many tag:record relation (1+ <container> => 1 instance with 1 container) with 'container' do @containers ||= {} # we've found that the container has a parent att and the parent is in # our queue if att("parent") && @containers[att('parent')] cont = @containers[att('parent')] else # there is not a parent. if there is an id, let's check if there's an # instance before we proceed inst = context == :instance ? context_obj : context_obj.instances.last # if there are no instances, we need to make a new one. # or, if there is an @id ( but no @parent) we can assume its a new # top level container that will be referenced later, so we need to # make a new instance if ( inst.nil? or att('id') ) instance_label = att("label") ? att("label").downcase : 'mixed_materials' if instance_label =~ /(.*)\s\[([0-9]+)\]$/ instance_label = $1 = $2 end make :instance, { :instance_type => instance_label } do |instance| set ancestor(:resource, :archival_object), :instances, instance end inst = context_obj end # now let's check out instance to see if there's a container... if inst.container.nil? make :container do |cont| set inst, :container, cont end end # and now finally we get the container. cont = inst.container || context_obj cont['barcode_1'] = if cont['container_profile_key'] = att("altrender") end # now we fill it in (1..3).to_a.each do |i| next unless cont["type_#{i}"].nil? cont["type_#{i}"] = att('type') cont["indicator_#{i}"] = format_content( inner_xml ) break end #store it here incase we find it has a parent @containers[att("id")] = cont if att("id") end with 'author' do set :finding_aid_author, inner_xml end with 'descrules' do set :finding_aid_description_rules, format_content( inner_xml ) end with 'eadid' do set :ead_id, inner_xml set :ead_location, att('url') end with 'editionstmt' do set :finding_aid_edition_statement, format_content( inner_xml ) end with 'seriesstmt' do set :finding_aid_series_statement, format_content( inner_xml ) end with 'sponsor' do set :finding_aid_sponsor, format_content( inner_xml ) end with 'titleproper' do type = att('type') case type when 'filing' set :finding_aid_filing_title, format_content( inner_xml ) else set :finding_aid_title, format_content( inner_xml ) end end with 'subtitle' do set :finding_aid_subtitle, format_content( inner_xml ) end with 'langusage' do set :finding_aid_language, format_content( inner_xml ) end with 'revisiondesc/change' do make :revision_statement set ancestor(:resource), :revision_statements, proxy end with 'revisiondesc/change/item' do set :description, format_content( inner_xml ) end with 'revisiondesc/change/date' do set :date, format_content( inner_xml ) end with 'origination/corpname' do make_corp_template(:role => 'creator') end with 'controlaccess/corpname' do make_corp_template(:role => 'subject') end with 'origination/famname' do make_family_template(:role => 'creator') end with 'controlaccess/famname' do make_family_template(:role => 'subject') end with 'origination/persname' do make_person_template(:role => 'creator') end with 'controlaccess/persname' do make_person_template(:role => 'subject') end { 'function' => 'function', 'genreform' => 'genre_form', 'geogname' => 'geographic', 'occupation' => 'occupation', 'subject' => 'topical' }.each do |tag, type| with "controlaccess/#{tag}" do make :subject, { :terms => {'term' => inner_xml, 'term_type' => type, 'vocabulary' => '/vocabularies/1'}, :vocabulary => '/vocabularies/1', :source => att('source') || 'ingest' } do |subject| set ancestor(:resource, :archival_object), :subjects, {'ref' => subject.uri} end end end with 'dao' do make :instance, { :instance_type => 'digital_object' } do |instance| set ancestor(:resource, :archival_object), :instances, instance end make :digital_object, { :digital_object_id => SecureRandom.uuid, :title => att('title'), } do |obj| obj.file_versions << { :use_statement => att('role'), :file_uri => att('href'), :xlink_actuate_attribute => att('actuate'), :xlink_show_attribute => att('show') } set ancestor(:instance), :digital_object, obj end end with 'daodesc' do make :note_digital_object, { :type => 'note', :persistent_id => att('id'), :content => inner_xml.strip } do |note| set ancestor(:digital_object), :notes, note end end with 'daogrp' do title = '' ancestor(:resource, :archival_object ) { |ao| title << ao.title + ' Digital Object' } make :digital_object, { :digital_object_id => SecureRandom.uuid, :title => title, } do |obj| ancestor(:resource, :archival_object) do |ao| ao.instances.push({'instance_type' => 'digital_object', 'digital_object' => {'ref' => obj.uri}}) end end end with 'daoloc' do ancestor(:digital_object) do |dobj| dobj.file_versions << { :file_uri => att('href'), :xlink_show_attribute => att('show'), :file_format_name => att('role') } end end end |
+ (Object) import_types(show_hidden = false)
9 10 11 12 13 14 15 16 |
# File 'backend/app/converters/ead_converter.rb', line 9 def self.import_types(show_hidden = false) [ { :name => "ead_xml", :description => "Import EAD records from an XML file" } ] end |
+ (Object) instance_for(type, input_file)
19 20 21 22 23 24 25 |
# File 'backend/app/converters/ead_converter.rb', line 19 def self.instance_for(type, input_file) if type == "ead_xml" self.new(input_file) else nil end end |
+ (Object) profile
28 29 30 |
# File 'backend/app/converters/ead_converter.rb', line 28 def self.profile "Convert EAD To ArchivesSpace JSONModel records" end |
Instance Method Details
- (Object) format_content(content)
A lot of nodes need tweaking to format the content. Like, people love their p’s but they don’t actually want to ever see them.
46 47 48 49 50 51 52 |
# File 'backend/app/converters/ead_converter.rb', line 46 def format_content(content) return content if content.nil? content.delete!("\n") # first we remove all linebreaks, since they're probably unintentional content.gsub("<p>","").gsub("</p>","\n\n" ).gsub("<p/>","\n\n") .gsub("<lb/>", "\n\n").gsub("<lb>","\n\n").gsub("</lb>","") .strip end |
- (Object) insert_into_subnotes(split_tag = 'list')
alright, wtf. sometimes notes can have things like lists jammed in them. we need to break those out, but keep the narrative order of the notes.
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 |
# File 'backend/app/converters/ead_converter.rb', line 58 def insert_into_subnotes(split_tag = 'list') subnotes = ancestor(:note_multipart).subnotes theleftovers = nil unless subnotes.nil? if subnotes.is_a?(Array) sn = subnotes.pop else sn = subnotes end if sn["content"] # clone the object... theleftovers = sn.dup # rip out the list, and put the left overs back in the content content = sn["content"].gsub("ead:#{split_tag}", split_tag) # just in case.. sn["content"], trash, theleftovers["content"] = content.partition(/<#{split_tag}[^>]*>.*?<\/#{split_tag}>/m) # what a hack. ripping out the list might leave some dangling <p>s [sn, theleftovers].each do |s| next if s["content"].nil? s["content"] = Nokogiri::XML::DocumentFragment.parse(s["content"].strip.gsub(/^<\/p[^>]*>/,'')).to_xml(:encoding => 'utf-8') end end # put everything before the list back... unless ( sn["content"].nil? or sn["content"].length < 1 ) set ancestor(:note_multipart), :subnotes, sn end end # now return the leftovers to be delt with after the list subnote has # been created theleftovers end |
- (Boolean) is_node_empty?(node)
We override this to skip nodes that are often very deep We can safely assume ead, c, and archdesc will have children, which greatly helps the performance.
35 36 37 38 39 40 41 42 |
# File 'backend/app/converters/ead_converter.rb', line 35 def is_node_empty?(node) parent_nodes = %w{ ead e archdesc dsc } + (1..12).collect { |n| "c#{ sprintf('%02d', n)}" } if parent_nodes.include?( node.local_name ) return false else return node.inner_xml.strip.empty? end end |
- (Object) make_corp_template(opts)
Templates Section
786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 |
# File 'backend/app/converters/ead_converter.rb', line 786 def make_corp_template(opts) return nil if inner_xml.strip.empty? make :agent_corporate_entity, { :agent_type => 'agent_corporate_entity' } do |corp| set ancestor(:resource, :archival_object), :linked_agents, {'ref' => corp.uri, 'role' => opts[:role]} end make :name_corporate_entity, { :primary_name => inner_xml, :rules => att('rules'), :authority_id => att('id'), :source => att('source') || 'ingest' } do |name| set ancestor(:agent_corporate_entity), :names, proxy end end |
- (Object) make_family_template(opts)
805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 |
# File 'backend/app/converters/ead_converter.rb', line 805 def make_family_template(opts) return nil if inner_xml.strip.empty? make :agent_family, { :agent_type => 'agent_family', } do |family| set ancestor(:resource, :archival_object), :linked_agents, {'ref' => family.uri, 'role' => opts[:role]} end make :name_family, { :family_name => inner_xml, :rules => att('rules'), :authority_id => att('id'), :source => att('source') || 'ingest' } do |name| set ancestor(:agent_family), :names, name end end |
- (Object) make_nested_note(note_name, tag)
218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'backend/app/converters/ead_converter.rb', line 218 def make_nested_note(note_name, tag) content = tag.inner_text make :note_multipart, { :type => note_name, :persistent_id => att('id'), :subnotes => { 'jsonmodel_type' => 'note_text', 'content' => format_content( content ) } } do |note| set ancestor(:resource, :archival_object), :notes, note end end |
- (Object) make_person_template(opts)
824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 |
# File 'backend/app/converters/ead_converter.rb', line 824 def make_person_template(opts) return nil if inner_xml.strip.empty? make :agent_person, { :agent_type => 'agent_person', } do |person| set ancestor(:resource, :archival_object), :linked_agents, {'ref' => person.uri, 'role' => opts[:role]} end make :name_person, { :name_order => 'inverted', :primary_name => inner_xml, :authority_id => att('id'), :rules => att('rules'), :source => att('source') || 'ingest' } do |name| set ancestor(:agent_person), :names, name end end |
- (Object) make_single_note(note_name, tag, tag_name = "")
204 205 206 207 208 209 210 211 212 213 214 215 216 |
# File 'backend/app/converters/ead_converter.rb', line 204 def make_single_note(note_name, tag, tag_name="") content = tag.inner_text if !tag_name.empty? content = tag_name + ": " + content end make :note_singlepart, { :type => note_name, :persistent_id => att('id'), :content => format_content( content.sub(/<head>.?<\/head>/, '').strip) } do |note| set ancestor(:resource, :archival_object), :notes, note end end |