<< | Index | >>
Goal/Estimate/Evaluation:
Task
Note
Experiment
def convert(bdd)
sender_id = 'YWESEE'
if((bsr = bdd.bsr) && (id = bsr.customer.acc_id))
sender_id = id
end
index = 0
bdd.deliveries.collect { |delivery|
doc = I2::Document.new
index += 1
_doc_add_delivery(doc, delivery, sender_id, index)
doc
}
end
def _doc_add_delivery(doc, delivery, sender_id='YWESEE', index=0)
order = I2::Order.new
order.sender_id = sender_id
# customer_id is in reality the delivery_id assigned by the
# customer - the slight confusion is due to automatic naming
transaction_id = delivery.customer_id
order.ade_id = order.delivery_id = transaction_id
order.ade_id = "%013d%02d" % [transaction_id, index]
Run
masa@masa ~/ywesee/globopharm.xmlconv.bbmb.ch $ bin/xmlconvd config="etc/xmlconv.yml" masa@masa ~/ywesee/bbmb.ch $ bin/bbmbd
Order
masa@masa ~/ywesee/globopharm.xmlconv.bbmb.ch $ cp input.xml xml_orders/ masa@masa ~/ywesee/globopharm.xmlconv.bbmb.ch $ ls xml_orders/ input.xml
(Wait one minute)
Result
010:CO_0000000005286_201109220739.dat 251:000000000528602
Note
Experiment
def convert(bdd)
sender_id = 'YWESEE'
if((bsr = bdd.bsr) && (id = bsr.customer.acc_id))
sender_id = id
end
index = 0
bdd.deliveries.collect { |delivery|
doc = I2::Document.new
_doc_add_delivery(doc, delivery, sender_id, index)
index += 1
doc
}
end
def _doc_add_delivery(doc, delivery, sender_id='YWESEE', index=0)
..
transaction_id = delivery.customer_id
order.ade_id = order.delivery_id = transaction_id
order.ade_id = "%013d%02d" % [transaction_id, index]
...
prefix = 'CO_' + order.ade_id
def deliver_to_connection(connection, delivery, idx=nil)
...
if(idx)
# target.gsub!(/(CO_\d{13})/, '\1%02d' % idx)
end
Result
... 010:CO_000000000528601_201109220836.dat ... 251:000000000528601 ...
Task
Note
Reference
Experiment
masa@masa ~/work $ cp /var/ebps/bin/emediat_de_firefox . masa@masa ~/work $ scp user@server:/etc/ebps/emediat_de_firefox.yml .
Run
masa@masa ~/ywesee/ebps/bin $ unset RUBYOPT masa@masa ~/work $ ruby1.9 emediat_de_firefox config="emediat_de_firefox.yml"
Result
Input file for conversion: /var/ebps/data/emediat/de/_DE.xml The Ebook kompendium_de_firefox.epub was generated and stored in /home/masa/work
Question
masa@masa ~/ywesee/ebps $ whereis ebps ebps: /usr/bin/ebps /etc/ebps
Experiment
def end_monid
dir = File.join(EBPS.config.component_dir, @current_target.to_s)
file_list = Dir.glob(File.join(dir, "*.jpg")).to_a.sort
@current_target = Text::Table.new
file_list.each_with_index do |file, i|
# picture name (left)
@current_target.next_row! if i > 0
filename = File.basename(file).gsub(/\.jpg/,'').gsub(/^\d+_/,'')
@current_target << filename
# picture (right)
picture = Text::Picture.new
picture << File.read(file)
@current_target.rows.last << picture
end
@current_chapter.add_paragraph(@current_target)
@current_target = nil
@current_chapter = nil
end
def start_monid attrs
@current_chapter = Text::Chapter.new
@current_document.add_chapter @current_chapter
@current_target = Text::Paragraph.new
@current_chapter.heading << 'Fotos'
end
def format_picture(picture, xml)
xml.td do
name = picture.filename
path = File.join @tmpdir, name
picture.image.write path
@builder.p 'class' => 'ebps' do |xml|
xml.img 'src' => name, 'alt' => ''
end
end
end
def format_table table
@builder.table 'class' => 'ebps' do |xml|
xml.tbody do
table.each_normalized do |row|
xml.tr do
row.each do |cell|
#xml.td do format cell end
if cell.is_a? EBPS::Text::Picture
format_picture(cell, xml)
else
xml.td do format cell end
end
end
end
end
end
end
end
Note (UPDATE)
Run
masa@masa ~/ywesee/ebps $ ruby1.9 -I lib bin/emediat_de_firefox config="emediat_de_firefox.yml"
Result
Next
Note
decorate: - - /var/ebps/bin/decorators/just_medical_de.rb
Key