limarka 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -2
- data/Rakefile +1 -1
- data/lib/limarka/cli.rb +86 -76
- data/lib/limarka/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbf031478fca583b83d7d4fed1ecd76fe27e4fdf
|
4
|
+
data.tar.gz: 8da67b42a5613130a20bda882f1c4af9256adb8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 428c615332570d51a79252a978ca5c7c45a15b515c21d8ce8a08d506b9e887f59e2c2228fec13b7753a2113e8f822a8e7e1e94796f55800468d747c66677b517
|
7
|
+
data.tar.gz: f62bdf3d3828db27dd5fa2f36f7e7b8f108dcea9e5979f3f26f917cef8f338768282e6a1c4d79438714f260c725c075ff410775370365743c0620915ee7aebe8
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [
|
4
|
-
[Full Changelog](https://github.com/abntex/limarka/compare/v0.4.
|
3
|
+
## [v0.4.2](https://github.com/abntex/limarka/tree/v0.4.2) (2016-11-18)
|
4
|
+
[Full Changelog](https://github.com/abntex/limarka/compare/v0.4.1...v0.4.2)
|
5
|
+
|
6
|
+
**Closed issues:**
|
7
|
+
|
8
|
+
- Opção de criar tabelas [\#37](https://github.com/abntex/limarka/issues/37)
|
9
|
+
|
10
|
+
## [v0.4.1](https://github.com/abntex/limarka/tree/v0.4.1) (2016-11-17)
|
11
|
+
[Full Changelog](https://github.com/abntex/limarka/compare/v0.4.0...v0.4.1)
|
5
12
|
|
6
13
|
**Closed issues:**
|
7
14
|
|
data/Rakefile
CHANGED
@@ -20,7 +20,7 @@ RSpec::Core::RakeTask.new(:spec)
|
|
20
20
|
task :default => [:configuracao_padrao, 'spec:fast']
|
21
21
|
|
22
22
|
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
23
|
-
config.future_release = Limarka::VERSION
|
23
|
+
config.future_release = "v"+Limarka::VERSION
|
24
24
|
end
|
25
25
|
|
26
26
|
|
data/lib/limarka/cli.rb
CHANGED
@@ -118,10 +118,95 @@ TEX
|
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
121
|
+
method_option :legenda, :aliases => '-l', :desc => 'Legenda da tabela.', :default => "Legenda da tabela."
|
122
|
+
method_option :fonte, :aliases => '-f', :desc => 'Fonte da tabela.', :default => "Autor."
|
123
|
+
method_option :rotulo, :aliases => '-r', :desc => 'Rótulo para ser utilizado na referenciação da tabela, caso não especificado um será proposto.'
|
124
|
+
method_option :nota, :aliases => '-n', :desc => 'Texto de nota adicional. (opcional)'
|
125
|
+
|
126
|
+
long_desc <<-DESC
|
127
|
+
Esse comando imprime duas tabela para faciliar a criação de tabelas.
|
128
|
+
DESC
|
129
|
+
desc "tab", "Imprime códigos para inclusão de tabelas em conformidade com ABNT (em LaTeX)"
|
130
|
+
def tab
|
131
|
+
legenda = options[:legenda]
|
132
|
+
fonte = options[:fonte]
|
133
|
+
rotulo_lido = options[:rotulo]
|
134
|
+
if rotulo_lido then
|
135
|
+
rotulo = rotulo_lido
|
136
|
+
else
|
137
|
+
rotulo = "tab:"+(Time.now.to_i % 100000).to_s
|
138
|
+
end
|
139
|
+
|
140
|
+
nota = options[:nota]
|
141
|
+
if nota then
|
142
|
+
nota_linha = " \\nota{#{nota}}%\n"
|
143
|
+
else
|
144
|
+
nota_linha = ""
|
145
|
+
end
|
146
|
+
|
147
|
+
valida_tabela_rotulo(rotulo)
|
148
|
+
|
149
|
+
say <<TEX
|
150
|
+
\n<!--\nPara referenciar essa tabela no texto utilize: Tabela \\ref\{#{rotulo}} \n-->\n
|
151
|
+
|
152
|
+
\\begin{table}[htb]
|
153
|
+
\\ABNTEXfontereduzida
|
154
|
+
\\caption[#{legenda}]{#{legenda}}
|
155
|
+
\\label{#{rotulo}}
|
156
|
+
\\begin{tabular}{p{2.6cm}|p{6.0cm}|p{2.25cm}|p{3.40cm}}
|
157
|
+
%\\hline
|
158
|
+
\\textbf{Nível de Investigação} & \\textbf{Insumos} & \\textbf{Sistemas de Investigação} & \\textbf{Produtos} \\\\
|
159
|
+
\\hline
|
160
|
+
Meta-nível & Filosofia\\index{filosofia} da Ciência & Epistemologia &
|
161
|
+
Paradigma \\\\
|
162
|
+
\\hline
|
163
|
+
Nível do objeto & Paradigmas do metanível e evidências do nível inferior &
|
164
|
+
Ciência & Teorias e modelos \\\\
|
165
|
+
\\hline
|
166
|
+
Nível inferior & Modelos e métodos do nível do objeto e problemas do nível inferior & Prática & Solução de problemas \\\\
|
167
|
+
% \\hline
|
168
|
+
\\end{tabular}
|
169
|
+
\\legend{Fonte: #{fonte}}
|
170
|
+
\\end{table}
|
171
|
+
|
172
|
+
|
173
|
+
\\begin{table}[htb]
|
174
|
+
\\IBGEtab{%
|
175
|
+
\\caption{#{legenda}}%
|
176
|
+
\\label{#{rotulo}}
|
177
|
+
}{%
|
178
|
+
\\begin{tabular}{ccc}
|
179
|
+
\\toprule
|
180
|
+
Nome & Nascimento & Documento \\\\
|
181
|
+
\\midrule \\midrule
|
182
|
+
Maria da Silva & 11/11/1111 & 111.111.111-11 \\\\
|
183
|
+
\\midrule
|
184
|
+
João Souza & 11/11/2111 & 211.111.111-11 \\\\
|
185
|
+
\\midrule
|
186
|
+
Laura Vicuña & 05/04/1891 & 3111.111.111-11 \\\\
|
187
|
+
\\bottomrule
|
188
|
+
\\end{tabular}%
|
189
|
+
}{%
|
190
|
+
\\fonte{#{fonte}}%
|
191
|
+
#{nota_linha}}
|
192
|
+
\\end{table}
|
193
|
+
|
194
|
+
TEX
|
195
|
+
|
196
|
+
# say tabela_tex
|
197
|
+
|
198
|
+
|
199
|
+
end
|
200
|
+
|
121
201
|
no_commands do
|
122
202
|
def valida_figura_rotulo (rotulo)
|
123
203
|
if (not rotulo =~ (/^[a-zA-Z][\w\-:]*$/)) then
|
124
|
-
raise RuntimeError, "O rótulo não deve conter caracteres especiais. Forneça um rótulo ou remova os caracteres especiais do nome do arquivo. Rótulo atual: #{rotulo}"
|
204
|
+
raise RuntimeError, "O rótulo não deve conter caracteres especiais. Forneça um rótulo ou remova os caracteres especiais do nome do arquivo. Rótulo atual: '#{rotulo}'"
|
205
|
+
end
|
206
|
+
end
|
207
|
+
def valida_tabela_rotulo (rotulo)
|
208
|
+
if (not rotulo =~ (/^[a-zA-Z][\w\-:]*$/)) then
|
209
|
+
raise RuntimeError, "O rótulo não deve conter caracteres especiais, rótulo atual: #{rotulo}"
|
125
210
|
end
|
126
211
|
end
|
127
212
|
|
@@ -195,81 +280,6 @@ TEX
|
|
195
280
|
|
196
281
|
|
197
282
|
|
198
|
-
=begin
|
199
|
-
method_option :entrada, :default => "configuracao.pdf", :aliases => "-i", :banner => "FILE"
|
200
|
-
method_option :saida, :default => "templates/configuracao.yaml", :aliases => "-o", :banner => "FILE"
|
201
|
-
desc "pdfconf", "Ler configuração de arquivo pdf"
|
202
|
-
def pdfconf
|
203
|
-
|
204
|
-
if not (File.exist?(options[:entrada])) then
|
205
|
-
raise IOError, "Arquivo não existe: #{options[:entrada]}"
|
206
|
-
end
|
207
|
-
|
208
|
-
@pdftk = PdfForms.new 'pdftk'
|
209
|
-
pdf = PdfForms::Pdf.new options[:entrada], @pdftk, utf8_fields: true
|
210
|
-
h = {} # hash
|
211
|
-
|
212
|
-
# Campos do PDF
|
213
|
-
pdf.fields.each do |f|
|
214
|
-
value = f.value
|
215
|
-
if value == "Off" then value = false end
|
216
|
-
if value == "" then value = nil end
|
217
|
-
h[f.name] = value
|
218
|
-
end
|
219
|
-
|
220
|
-
# Substitui ',' e ';' por '.'
|
221
|
-
['palavras_chave', 'palabras_clave', 'keywords', 'mots_cles'].each do |p|
|
222
|
-
if(h[p])
|
223
|
-
h[p] = h[p].gsub(/[;,]/, '.')
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
h['monografia'] = h["tipo_do_trabalho"] == "Monografia"
|
228
|
-
h["ficha_catalografica"] = h["ficha_catalografica"] == "Incluir ficha-catalografica.pdf da pasta imagens"
|
229
|
-
|
230
|
-
|
231
|
-
# siglas e simbolos
|
232
|
-
['siglas','simbolos'].each do |sigla_ou_simbolo|
|
233
|
-
if (h[sigla_ou_simbolo]) then
|
234
|
-
sa = [] # sa: s-array
|
235
|
-
h[sigla_ou_simbolo].each_line do |linha|
|
236
|
-
s,d = linha.split(":")
|
237
|
-
sa << { 's' => s.strip, 'd' => d ? d.strip : ""} if s
|
238
|
-
end
|
239
|
-
h[sigla_ou_simbolo] = sa
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
|
-
# shows
|
244
|
-
h["errata"] = pdf.field("errata_combo").value == "Utilizar Errata"
|
245
|
-
h["folha_de_aprovacao_gerar"] = pdf.field("folha_de_aprovacao").value == "Gerar folha de aprovação"
|
246
|
-
h["folha_de_aprovacao_incluir"] = pdf.field("folha_de_aprovacao").value == "Utilizar folha de aprovação escaneada"
|
247
|
-
h["lista_ilustracoes"] = pdf.field("lista_ilustracoes").value == "Gerar lista de ilustrações"
|
248
|
-
h["lista_tabelas"] = pdf.field("lista_tabelas").value == "Gerar lista de tabelas"
|
249
|
-
|
250
|
-
# Referências
|
251
|
-
selecao = 'referencias_combo'
|
252
|
-
{"referencias_bib" => "Banco de referências Bibtex (referencias.bib) + \\cite",
|
253
|
-
'referencias_numerica_inline' => "Inseridas ao longo do texto \\citarei + \\cita",
|
254
|
-
'referencias_md' => 'Separadamente, no arquivo referencias.md'}.each do |template_key,valor_para_verdadeiro|
|
255
|
-
h[template_key] = pdf.field(selecao).value == valor_para_verdadeiro
|
256
|
-
end
|
257
|
-
|
258
|
-
#TESTES
|
259
|
-
|
260
|
-
# Escreve na saída
|
261
|
-
s = StringIO.new
|
262
|
-
s << h.to_yaml
|
263
|
-
s << "---\n\n"
|
264
|
-
|
265
|
-
if (options['saida'] == '-')
|
266
|
-
puts s.string
|
267
|
-
else
|
268
|
-
File.open(options['saida'], 'w') { |f| f.write s.string}
|
269
|
-
puts "Arquivo criado: #{options['saida']}".green
|
270
|
-
end
|
271
|
-
end
|
272
|
-
=end
|
273
283
|
|
274
284
|
desc "configuracao help", "Exporta e atualiza configurações"
|
275
285
|
subcommand "configuracao", Limarka::Configuracao
|
data/lib/limarka/version.rb
CHANGED
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.4.
|
4
|
+
version: 0.4.2
|
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: 2016-11-
|
11
|
+
date: 2016-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|