From 4014222eb1e01f6952734918713da9041b40f714 Mon Sep 17 00:00:00 2001 From: nik gaffney Date: Wed, 11 Nov 2020 13:44:35 +0100 Subject: [PATCH] Oxprenolol, Parc des Combes, Berlin Sculpture-Network & Chekhov (inhabited locality) --- cards/preprocess.rb | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/cards/preprocess.rb b/cards/preprocess.rb index ec89fa8..3f31ee7 100755 --- a/cards/preprocess.rb +++ b/cards/preprocess.rb @@ -94,9 +94,9 @@ File.write($cards_csv, "name,type,text,illustration\n", mode: "w") # optional deck labels $label = options.deck_label -# Occasions +# Occasions (with text escaping...) def write_occasion(line) - File.write($cards_csv, "#{line},O,#{$label},img/o_card.svg\n", mode: "a") + File.write($cards_csv, "\"" + %Q[#{line}] + "\"" + ",O,#{$label},img/o_card.svg\n", mode: "a") end # Qualifiers @@ -117,10 +117,20 @@ when "txt" File.foreach($cards_q) { |line| write_qualifier line.chomp } File.foreach($cards_v) { |line| write_verb line.chomp } when "ods" - puts "reading descriptions from ods file: " + options.input_file if options.verbose - ods.column(1).each { |line| write_occasion line.chomp } - ods.column(2).each { |line| write_qualifier line.chomp } - ods.column(3).each { |line| write_verb line.chomp } + if options.verbose + puts "reading descriptions from ods file: " + options.input_file + puts ods.info + end + # filter empty cells + ods.column(1).reject{ |n| n.nil?}.each do |line| + puts "1> " + line if options.verbose; write_occasion line.chomp + end + ods.column(2).reject{ |n| n.nil?}.each do |line| + puts "2> " + line if options.verbose; write_qualifier line.chomp + end + ods.column(3).reject{ |n| n.nil?}.each do |line| + puts "3> " + line if options.verbose; write_verb line.chomp + end else puts "input format not supported." exit