Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fill in the image file name for the example ALTO xml page
  • Loading branch information
performantDave committed Sep 12, 2014
1 parent e9a3c79 commit bebfd82
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion data/example_alto.xml
Expand Up @@ -4,7 +4,7 @@ xmlns:emop="http://emop.tamu.edu" xmlns="http://schema.ccs-gmbh.com/ALTO">
<MeasurementUnit>pixel</MeasurementUnit>
<sourceImageInformation>
<filename>
/dh/data/ecco/ECCO_2of2/LitAndLang_2/0356200106/images/035620010600120.TIF
XX_FILENAME_XX
</filename>
</sourceImageInformation>
<OCRProcessing>
Expand Down
14 changes: 10 additions & 4 deletions lib/tasks/generate.rake
Expand Up @@ -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}"
}

Expand Down

0 comments on commit bebfd82

Please sign in to comment.