Skip to content
Browse files

Add conversion of dia source images for ebooks and pdfs

The conversion is done on the fly to generated best matched formats of
images for each transformation. The conversion requires obviously `dia` to
be installed. For PDF, additionally, `epstopdf` must be available.
  • Loading branch information...
1 parent 18578c6 commit a3d56cd080b0d4e900510f6351f94934e5ea6fa3 @jnavila jnavila committed Mar 2, 2013
Showing with 10 additions and 1 deletion.
  1. +6 −0 latex/makepdf
  2. +4 −1 makeebooks
View
6 latex/makepdf
@@ -15,6 +15,11 @@ def figures(lang,&block)
Dir["#$root/figures/18333*.png"].each do |file|
cp(file, file.sub(/18333fig0(\d)0?(\d+)\-tn/, '\1.\2'))
end
+ Dir["#$root/#{lang}/figures-dia/*.dia"].each do |file|
+ eps_dest= file.sub(/.*fig0(\d)0?(\d+).dia/, '\1.\2.eps')
+ system("dia -t eps-pango -e #$root/figures/#{eps_dest} #{file}")
+ system("epstopdf #$root/figures/#{eps_dest}")
+ end
cp(Dir["#$root/#{lang}/figures/*.png"],"#$root/figures")
cp(Dir["#$root/#{lang}/figures/*.pdf"],"#$root/figures")
block.call
@@ -23,6 +28,7 @@ def figures(lang,&block)
rm(file.gsub(/18333fig0(\d)0?(\d+)\-tn/, '\1.\2'))
end
rm(Dir["#$root/figures/*.pdf"])
+ rm(Dir["#$root/figures/*.eps"])
end
end
View
5 makeebooks
@@ -26,7 +26,10 @@ def figures(lang,&block)
Dir["#{lang}/figures/*.png"].each do |file|
cp(file,"figures")
end
-
+ Dir["#{lang}/figures-dia/*.dia"].each do |file|
+ png_dest= file.sub(/.*fig0(\d)0?(\d+).dia/, 'figures/\1.\2.png')
+ system("dia -e #{png_dest} #{file}")
+ end
block.call
ensure
Dir["figures/18333*.png"].each do |file|

0 comments on commit a3d56cd

Please sign in to comment.
Something went wrong with that request. Please try again.