summaryrefslogtreecommitdiffstats
path: root/generation/barcodelist.rb
diff options
context:
space:
mode:
authorholger <holgercremer@gmail.com>2019-11-01 21:55:22 +0100
committerGitHub <noreply@github.com>2019-11-01 21:55:22 +0100
commit04e0406316320f6039365b80de8c58c3c58413c5 (patch)
treece31b694a0f2604ea16a9ae5580426ea666941ba /generation/barcodelist.rb
parent2714fc190f01894eaaa64bf3869a4a4269ab1dcf (diff)
parentd92aa9d79a3f80557119b660f7191e96b7d79878 (diff)
downloadserial-barcode-scanner-04e0406316320f6039365b80de8c58c3c58413c5.tar.bz2
Merge pull request #45 from smilix/master
mqtt script & pdf generation improvements
Diffstat (limited to 'generation/barcodelist.rb')
-rw-r--r--generation/barcodelist.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/generation/barcodelist.rb b/generation/barcodelist.rb
index 9784c79..980837c 100644
--- a/generation/barcodelist.rb
+++ b/generation/barcodelist.rb
@@ -19,7 +19,7 @@ require "csv"
\maketitle
\begin{center}
\begin{longtable}{|c|c|}
- %s
+ %s
\end{longtable}
\end{center}
\end{document}}
@@ -32,13 +32,13 @@ require "csv"
\hline}
@graphics = %q{ \includegraphics{%s} %s}
-@name = %q{ %s %s %s}
+@name = %q{ %s %s (%s) %s}
@csv = CSV.read(ARGV[0])
#generate barcodes
-@csv.each{|r|
- system("barcode -n -E -b 'USER %s' -o '%s.eps' -u mm -g 80x30 -e 39\n" % [r[0], r[0]])
+@csv.each{|r|
+ system("barcode -n -E -b 'USER %s' -o 'barcodes/%s.eps' -u mm -g 80x30 -e 39\n" % [r[0], r[0]])
}
#generate latex
@@ -49,11 +49,11 @@ name = ""
le = i % 2 == 0 || i >= @csv.length
sign = le ? "\\\\" : "&"
graphics += @graphics % [@csv[i-1][0], sign]
- name += @name % [@csv[i-1][1], @csv[i-1][2], sign]
- if le
- tmp += @line % [graphics, name]
+ name += @name % [@csv[i-1][1], @csv[i-1][2], @csv[i-1][0], sign]
+ if le
+ tmp += @line % [graphics, name]
graphics = ""
name = ""
end
}
-File.open("barcode.latex", "w+"){|f| f.write(@template % tmp)}
+File.open("barcodes/barcode.latex", "w+"){|f| f.write(@template % tmp)}