imposition 0.9.4.6.3 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/impostor +4 -8
- data/lib/imposition/clases.rb +19 -19
- data/lib/imposition/metodos.rb +12 -8
- data/lib/locales/en.yml +5 -5
- data/lib/locales/es.yml +1 -1
- metadata +17 -5
data/bin/impostor
CHANGED
@@ -32,10 +32,10 @@ end
|
|
32
32
|
#
|
33
33
|
def enBooklets()
|
34
34
|
STDOUT.puts(I18n.t(:bookletsq))
|
35
|
-
bookies=STDIN.gets.to_s
|
36
|
-
if bookies
|
35
|
+
bookies=STDIN.gets.to_s.strip
|
36
|
+
if bookies.eql?("y") then
|
37
37
|
return true
|
38
|
-
elsif bookies
|
38
|
+
elsif bookies.eql?("n") then
|
39
39
|
return false
|
40
40
|
else
|
41
41
|
enBooklets()
|
@@ -101,11 +101,7 @@ $entrada=ARGV.shift
|
|
101
101
|
$salida=ARGV.shift
|
102
102
|
$locale=ARGV.shift
|
103
103
|
|
104
|
-
|
105
|
-
I18n.locale=$locale.strip
|
106
|
-
else
|
107
|
-
I18n.locale = :en
|
108
|
-
end
|
104
|
+
Metodos.localize($locale)
|
109
105
|
|
110
106
|
#
|
111
107
|
Metodos.refresh()
|
data/lib/imposition/clases.rb
CHANGED
@@ -125,7 +125,7 @@ class MensajeDato < Mensaje
|
|
125
125
|
if tipo=="horizontal" then
|
126
126
|
if level==1 then#info
|
127
127
|
if numero==1 then
|
128
|
-
return I18n.t(:nXCalc)
|
128
|
+
return [15,I18n.t(:nXCalc)]
|
129
129
|
elsif numero==2 then
|
130
130
|
return [2,I18n.t(:wPCalc)]
|
131
131
|
elsif numero==3 then
|
@@ -135,21 +135,21 @@ class MensajeDato < Mensaje
|
|
135
135
|
end
|
136
136
|
elsif level==3 then#error
|
137
137
|
if numero==1 then
|
138
|
-
return I18n.t(:wOnly)
|
138
|
+
return [13,I18n.t(:wOnly)]
|
139
139
|
elsif numero==2 then
|
140
|
-
return I18n.t(:wPOnly)
|
140
|
+
return [16,I18n.t(:wPOnly)]
|
141
141
|
elsif numero==3 then
|
142
|
-
return I18n.t(:nXOnly)
|
142
|
+
return [17,I18n.t(:nXOnly)]
|
143
143
|
elsif numero==4 then
|
144
|
-
return I18n.t(:nothingH)
|
144
|
+
return [18,I18n.t(:nothingH)]
|
145
145
|
elsif numero==5 then
|
146
|
-
return I18n.t(:noPageH)
|
146
|
+
return [19,I18n.t(:noPageH)]
|
147
147
|
end
|
148
148
|
end
|
149
149
|
elsif tipo=="vertical" then
|
150
150
|
if level==1 then#info
|
151
151
|
if numero==1 then
|
152
|
-
return I18n.t(:nYCalc)
|
152
|
+
return [20,I18n.t(:nYCalc)]
|
153
153
|
elsif numero==2 then
|
154
154
|
return [4,I18n.t(:hPCalc)]
|
155
155
|
elsif numero==3 then
|
@@ -159,21 +159,21 @@ class MensajeDato < Mensaje
|
|
159
159
|
end
|
160
160
|
elsif level==3 then#error
|
161
161
|
if numero==1 then
|
162
|
-
return I18n.t(:hOnly)
|
162
|
+
return [14,I18n.t(:hOnly)]
|
163
163
|
elsif numero==2 then
|
164
|
-
return I18n.t(:hPOnly)
|
164
|
+
return [21,I18n.t(:hPOnly)]
|
165
165
|
elsif numero==3 then
|
166
|
-
return I18n.t(:nYOnly)
|
166
|
+
return [22,I18n.t(:nYOnly)]
|
167
167
|
elsif numero==4 then
|
168
|
-
return I18n.t(:nothingV)
|
168
|
+
return [23,I18n.t(:nothingV)]
|
169
169
|
elsif numero==5 then
|
170
|
-
return I18n.t(:noPageV)
|
170
|
+
return [24,I18n.t(:noPageV)]
|
171
171
|
end
|
172
172
|
end
|
173
173
|
elsif tipo=="paginas" then
|
174
174
|
if level==1 then
|
175
175
|
if numero==1 then
|
176
|
-
return I18n.t(:nPageCalc)
|
176
|
+
return [25,I18n.t(:nPageCalc)]
|
177
177
|
elsif numero==2 then
|
178
178
|
return [6,I18n.t(:nSheetCalc)]
|
179
179
|
elsif numero==3 then
|
@@ -181,18 +181,18 @@ class MensajeDato < Mensaje
|
|
181
181
|
end
|
182
182
|
elsif level==3 then
|
183
183
|
if numero==1 then
|
184
|
-
return I18n.t(:nPageXL)
|
184
|
+
return [26,I18n.t(:nPageXL)]
|
185
185
|
else
|
186
|
-
return I18n.t(:noPages)
|
186
|
+
return [27,I18n.t(:noPages)]
|
187
187
|
end
|
188
188
|
end
|
189
189
|
elsif tipo=="pliegos" then
|
190
190
|
if level==1 then
|
191
|
-
return I18n.t(:allSheet, :n=>numero)
|
191
|
+
return [28,I18n.t(:allSheet, :n=>numero)]
|
192
192
|
elsif level==2 then
|
193
|
-
return I18n.t(:sheetXL, :n=>numero)
|
193
|
+
return [29,I18n.t(:sheetXL, :n=>numero)]
|
194
194
|
elsif level==3 then
|
195
|
-
return I18n.t(:sheetXS, :n=>numero)
|
195
|
+
return [30,I18n.t(:sheetXS, :n=>numero)]
|
196
196
|
end
|
197
197
|
end
|
198
198
|
|
@@ -359,7 +359,7 @@ class PreguntaTodasPag < Pregunta
|
|
359
359
|
@ok=true
|
360
360
|
end
|
361
361
|
end
|
362
|
-
#
|
362
|
+
#when imposing in booklets & last group of them can be reduced to minimize blank pages
|
363
363
|
class PreguntaReducir < Pregunta
|
364
364
|
attr_reader :q, :cuadernillosPorCostura, :paginasSobran, :nCuad, :sobranMenos
|
365
365
|
def initialize(cuadernillosPorCostura, paginasSobran, nCuad, sobranMenos, q)
|
data/lib/imposition/metodos.rb
CHANGED
@@ -5,15 +5,11 @@ module Metodos
|
|
5
5
|
|
6
6
|
#WORK
|
7
7
|
def funcionar(w_,h_,wP_,hP_,nX,nY,nPaginas,nPliegos,cuadernillos,preguntas,temp,locale)
|
8
|
-
|
9
|
-
I18n.locale=locale
|
10
|
-
else
|
11
|
-
locale=:en
|
12
|
-
end
|
8
|
+
localize(locale)
|
13
9
|
impostor=Clases::Imposicion.new(w_,h_,wP_,hP_,nX,nY,nPaginas,nPliegos,cuadernillos)
|
14
10
|
pdfinfo(impostor,temp)
|
15
11
|
retorno=validacion(impostor, preguntas)
|
16
|
-
if retorno.preguntasOk then
|
12
|
+
if retorno.valido and retorno.preguntasOk then
|
17
13
|
retorno.mensajes.push(Clases::MensajeVars.new(1,impostor.to_s))
|
18
14
|
if impostor.cuadernillos then
|
19
15
|
retorno.mensajes.push(imponerBooklet(impostor,temp))
|
@@ -107,8 +103,16 @@ def nuevo(valor,unidad)
|
|
107
103
|
return retorno
|
108
104
|
end
|
109
105
|
|
106
|
+
def localize(locale)
|
107
|
+
if locale!=nil then
|
108
|
+
I18n.locale=locale
|
109
|
+
else
|
110
|
+
locale=:en
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
110
114
|
#########
|
111
|
-
module_function :funcionar, :checksCompile, :checksRun, :input2alchemist, :refresh, :nuevo
|
115
|
+
module_function :funcionar, :checksCompile, :checksRun, :input2alchemist, :refresh, :nuevo, :localize
|
112
116
|
|
113
117
|
def self.pdfinfo(impostor, temp)
|
114
118
|
Dir.chdir(File.dirname(temp))
|
@@ -471,7 +475,7 @@ def self.validacion(impostor, preguntas)
|
|
471
475
|
if impostor.w!=0.point then
|
472
476
|
if impostor.wP!=0.point then
|
473
477
|
if impostor.nX==0 then
|
474
|
-
impostor.nX=(wP/w).floor
|
478
|
+
impostor.nX=(impostor.wP/impostor.w).floor
|
475
479
|
impostor.wP=impostor.wP_["numero"].send(impostor.wP_["unidad"])#operacion alchemist cambia el operando
|
476
480
|
if impostor.nX==0 then
|
477
481
|
mensajes.push(Clases::MensajeDato.new(3, "horizontal", 5))#error
|
data/lib/locales/en.yml
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
en:
|
2
|
-
welcome: "- Welcome human, let's print a book. says :::impostor::0.9.4.
|
2
|
+
welcome: "- Welcome human, let's print a book. says :::impostor::0.9.4.6.4:::"
|
3
3
|
badunit: "%{input}'s unit is incorrect."
|
4
4
|
bookletsq: "order for booklets? (y/n)"
|
5
5
|
WnX: "You didn't specify Page width but you specified Sheet width and how many Pages per Sheet"
|
6
6
|
horizontalmente: "horizontally"
|
7
7
|
verticalmente: "vertically"
|
8
8
|
HnY: "You didn't specify Page height but you specified Sheet height and how many Pages per Sheet"
|
9
|
-
scale: "
|
9
|
+
scale: "Do you really wanna scale %{tp}? (y/n)"
|
10
10
|
excesscXC: "Last group of %{cXC} booklets will have extra %{p} pages"
|
11
|
-
reducecXC: "We can reduce it to %{nCuad} booklets, to have extra %{sobranMenos} pages.
|
11
|
+
reducecXC: "We can reduce it to %{nCuad} booklets, to have extra %{sobranMenos} pages. 0k? (y/n)"
|
12
12
|
nPages: "nPages"
|
13
13
|
nSheets: "nSheets"
|
14
14
|
dead: "::impostor:: won't work like that"
|
@@ -60,8 +60,8 @@ en:
|
|
60
60
|
sheetPair: "Sheets can't be odd for side by side booklets, %{n}+1 sheets taken"
|
61
61
|
nXPair: "For foldable booklets pages per sheet must be even horizontally but you specified nX:%{nX}."
|
62
62
|
cXC: "cXC - booklets per group \n 0: all booklets one inside another, 1: all booklets side by side, or n: in groups of n booklets one inside another"
|
63
|
-
allPdfq: "The document has %{p} pages, but in %{s} sheets of %{nX}x%{nY} pages %{c} pages fit
|
64
|
-
reduceq: "Last group of %{cXC} booklets will have an extra %{extra}p leftover. We can reduce it to %{n} booklets, thus only %{less} booklets would be leftover.
|
63
|
+
allPdfq: "The document has %{p} pages, but in %{s} sheets of %{nX}x%{nY} pages %{c} pages fit. Use document's? (y/n)"
|
64
|
+
reduceq: "Last group of %{cXC} booklets will have an extra %{extra}p leftover. We can reduce it to %{n} booklets, thus only %{less} booklets would be leftover. 0k? (y/n)"
|
65
65
|
notexe: "%{x} not executable"
|
66
66
|
wknoexist: "working directory %{work} doesn't exist"
|
67
67
|
wknowrite: "wrking directory %{work} not writeable"
|
data/lib/locales/es.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
es:
|
2
|
-
welcome: "- Bienvenido ser humano, leer es volar al centro de los tiempos... \n Dice :::impostor::0.9.4.
|
2
|
+
welcome: "- Bienvenido ser humano, leer es volar al centro de los tiempos... \n Dice :::impostor::0.9.4.6.4:::"
|
3
3
|
badunit: "La unidad de %{input} no es correcta."
|
4
4
|
bookletsq: "¿imponer en cuadernillos? (y/n)"
|
5
5
|
WnX: "No especificó ancho de Página pero sí ancho de Pliego y número de páginas por Pliego"
|
metadata
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imposition
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 49
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
|
11
|
-
- 3
|
12
|
-
version: 0.9.4.6.3
|
9
|
+
- 5
|
10
|
+
version: 0.9.5
|
13
11
|
platform: ruby
|
14
12
|
authors:
|
15
13
|
- numerico
|
@@ -89,6 +87,20 @@ dependencies:
|
|
89
87
|
version: "0"
|
90
88
|
type: :development
|
91
89
|
version_requirements: *id005
|
90
|
+
- !ruby/object:Gem::Dependency
|
91
|
+
name: pry
|
92
|
+
prerelease: false
|
93
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
hash: 3
|
99
|
+
segments:
|
100
|
+
- 0
|
101
|
+
version: "0"
|
102
|
+
type: :development
|
103
|
+
version_requirements: *id006
|
92
104
|
description: nUp & booklets
|
93
105
|
email: webmaster@numerica.cl
|
94
106
|
executables:
|