diff --git a/data/example_alto.xml b/data/example_alto.xml index 28919df..79ab7be 100644 --- a/data/example_alto.xml +++ b/data/example_alto.xml @@ -4,7 +4,7 @@ xmlns:emop="http://emop.tamu.edu" xmlns="http://schema.ccs-gmbh.com/ALTO"> pixel - /dh/data/ecco/ECCO_2of2/LitAndLang_2/0356200106/images/035620010600120.TIF + XX_FILENAME_XX diff --git a/lib/tasks/generate.rake b/lib/tasks/generate.rake index 558d98b..8d67db7 100644 --- a/lib/tasks/generate.rake +++ b/lib/tasks/generate.rake @@ -30,12 +30,18 @@ namespace :generate do target_dir = "#{fake_eebo_root}/#{work_id}/0" FileUtils.mkdir_p( target_dir ) unless FileTest.directory?( target_dir ) - (1..images.size).each { |page_num| - target_name = "#{target_dir}/#{page_num}.xml" + images.each_with_index { |img_name, ix| + target_name = "#{target_dir}/#{ix + 1}.xml" FileUtils.rm( target_name, { :force => true } ) if FileTest.file?( target_name ) - FileUtils.cp( fake_page_xml, target_name ) + content = "" + File.open( fake_page_xml, "r" ) { |f| + content = f.read + } + content.gsub!( "XX_FILENAME_XX", File.basename( img_name ) ) + File.open( target_name, "w" ) { |f| + f << content + } } - puts "Pages located here: #{target_dir}" }