limarka 0.6.5 → 0.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69320eab968ea33365d7a9a347f289130571b284
4
- data.tar.gz: 9a10d6489984755eaf4ae8349a722e67ad9a6b36
3
+ metadata.gz: c7b3897423a409645ab51783db800139add32797
4
+ data.tar.gz: e0890ecff65c0f947520e74524dfce79231d4264
5
5
  SHA512:
6
- metadata.gz: afae1b22f9f82fa1c01767f62bd08c13669f208e2e00002d252688795c265e6c90c4caeb13864681d72bb3e41ad23c376a4923a498e401c899d9bc8c94dfe14b
7
- data.tar.gz: 3f06293cf304e34e6256c10292000027f2b9731026c82fc3d3518469d96a04d09b97900de0339ea5933bdc85e859cb8e76fec475daee1ed0ffbbb5df6b185f95
6
+ metadata.gz: a1e61b792831c8bc1472fc9a1578f39571bc3351bada381995d2915a0a9fb7fd20888ddef24c06605d5b9e8a5a51ceb0779edb250f9cd26bf7304b0329ca8aff
7
+ data.tar.gz: 3fa1dea91f20702a239c5737079657dbd8177a05497314d21a204acfe51435f8eec88ece953701e562ab2eb735d34098629fc89770fa9379aa6143597eec4108
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ## [v0.6.6](https://github.com/abntex/limarka/tree/v0.6.6) (2017-01-22)
4
+ [Full Changelog](https://github.com/abntex/limarka/compare/v0.6.5...v0.6.6)
5
+
6
+ **Bugs corrigidos:**
7
+
8
+ - Erro ao ler campos multi-linhas de configuração salva com o PDF-XChange Viewer [\#124](https://github.com/abntex/limarka/issues/124)
9
+ - Erro nas referências quando title está entre duplas chaves e contem subtítulo [\#122](https://github.com/abntex/limarka/issues/122)
10
+
3
11
  ## [v0.6.5](https://github.com/abntex/limarka/tree/v0.6.5) (2017-01-16)
4
12
  [Full Changelog](https://github.com/abntex/limarka/compare/v0.6.4...v0.6.5)
5
13
 
@@ -24,6 +24,7 @@ module Limarka
24
24
  attr_accessor :txt
25
25
  attr_accessor :usa_pdftotext
26
26
 
27
+ # @param trabalho [Trabalho]
27
28
  def initialize(trabalho, options)
28
29
  self.t = trabalho
29
30
  self.options = options
@@ -129,7 +130,9 @@ module Limarka
129
130
  File.open(tempfile, 'w') { |file| file.write(postextual_tex) }
130
131
  end
131
132
 
132
- ## arquivo temporário de referencias
133
+ # Cria arquivo temporário de referencias.
134
+ #
135
+ # Separa o título em subtítulo quando contém `:`.
133
136
  def cria_xxx_referencias
134
137
  referencias_tempfile = Tempfile.new('referencias')
135
138
  File.open(referencias_tempfile, 'w') {|file| file.write(t.referencias)}
@@ -137,6 +140,10 @@ module Limarka
137
140
  b.each do |entry|
138
141
  if entry.title.include?(':') then
139
142
  s = entry.title.split(':')
143
+ if entry.title.start_with?("{") and entry.title.end_with?("}") then
144
+ s[0] = s[0][1..-1] # remove {
145
+ s[1] = s[1][1..-1] # remove }
146
+ end
140
147
  entry['title'] = s[0].strip
141
148
  entry['subtitle'] = s[1].strip
142
149
  end
@@ -26,6 +26,13 @@ module Limarka
26
26
  pdf.field(field).instance_variable_set(:@value, value)
27
27
  end
28
28
 
29
+ # Ler valor do campo. Converte o final de linha para utilizar `universal_newline`.
30
+ def ler_campo(campo)
31
+ value = pdf.field(campo).value
32
+ value = value.encode(:universal_newline => true) if value
33
+ value
34
+ end
35
+
29
36
  # Exporta um hash que será utilizado como configuração.
30
37
  # @return [Hash] que é utilizado como configuração
31
38
  # @see {Trabalho#configuracao}
@@ -71,18 +78,18 @@ module Limarka
71
78
 
72
79
  def lista_ilustracoes
73
80
  campo = 'lista_ilustracoes_combo'
74
- {'lista_ilustracoes' => pdf.field(campo).value.include?('Gerar')}
81
+ {'lista_ilustracoes' => ler_campo(campo).include?('Gerar')}
75
82
  end
76
83
 
77
84
  def lista_tabelas
78
85
  campo = 'lista_tabelas_combo'
79
- {'lista_tabelas' => pdf.field(campo).value.include?('Gerar')}
86
+ {'lista_tabelas' => ler_campo(campo).include?('Gerar')}
80
87
  end
81
88
 
82
89
  def lista_siglas
83
90
  h = {}
84
91
  ['siglas','simbolos'].each do |campo|
85
- str = pdf.field(campo).value
92
+ str = ler_campo(campo)
86
93
  if (str) then
87
94
  sa = [] # sa: s-array
88
95
  str.each_line do |linha|
@@ -96,7 +103,7 @@ module Limarka
96
103
  end
97
104
 
98
105
  def referencias
99
- value = pdf.field('referencias_sistema_combo').value
106
+ value = ler_campo('referencias_sistema_combo')
100
107
  if value.include?('Numérica') then
101
108
  {'referencias_sistema' => 'num'}
102
109
  elsif value.include?('Alfabética') then
@@ -108,7 +115,7 @@ module Limarka
108
115
 
109
116
  def projeto
110
117
  campo = 'projeto_combo'
111
- value = pdf.field(campo).value
118
+ value = ler_campo(campo)
112
119
 
113
120
  if value.include?('Projeto') then
114
121
  {'projeto' => true}
@@ -121,7 +128,7 @@ module Limarka
121
128
 
122
129
  def ficha_catalografica
123
130
  campo = 'ficha_catalografica_combo'
124
- value = pdf.field(campo).value
131
+ value = ler_campo(campo)
125
132
 
126
133
  if value.include?('Sem ficha') then
127
134
  {'incluir_ficha_catalografica' => false}
@@ -135,7 +142,7 @@ module Limarka
135
142
 
136
143
  def nivel_educacao
137
144
  campo = 'nivel_educacao_combo'
138
- value = pdf.field(campo).value
145
+ value = ler_campo(campo)
139
146
 
140
147
  if value.include?('Graduação') then
141
148
  {'graduacao' => true, 'especializacao' => false, 'mestrado' => false, 'doutorado' => false, 'tipo_do_trabalho'=>'Monografia'}
@@ -152,7 +159,7 @@ module Limarka
152
159
 
153
160
  def folha_de_aprovacao
154
161
  campo = 'folha_de_aprovacao_combo'
155
- value = pdf.field(campo).value
162
+ value = ler_campo(campo)
156
163
 
157
164
  if value.include?('Não gerar') then
158
165
  {'folha_de_aprovacao' => false}
@@ -167,7 +174,7 @@ module Limarka
167
174
 
168
175
 
169
176
  def desativado?(campo)
170
- pdf.field(campo).value.include?('Desativad') # a(o)
177
+ ler_campo(campo).include?('Desativad') # a(o)
171
178
  end
172
179
 
173
180
  # Substitui ',' e ';' por '.'
@@ -183,7 +190,7 @@ module Limarka
183
190
  h = {}
184
191
  pdf.fields.each do |f|
185
192
  if (f.type == "Text") then
186
- h[f.name] = f.value
193
+ h[f.name] = ler_campo(f.name)
187
194
  end
188
195
  end
189
196
  atualiza_palavras_chave(h)
@@ -1,3 +1,3 @@
1
1
  module Limarka
2
- VERSION = "0.6.5"
2
+ VERSION = "0.6.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: limarka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
4
+ version: 0.6.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo de Santana Medeiros Alexandre
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-16 00:00:00.000000000 Z
11
+ date: 2017-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler