formatafacil 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -2
- data/exe/formatafacil +8 -1
- data/lib/formatafacil/otimizador_para_web.rb +25 -0
- data/lib/formatafacil/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b73345539e64ca691a5103f903252a8f7f9c978
|
4
|
+
data.tar.gz: bd0b380094c327ec757731267aeaab78434a17a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5996ee2e5acef362395b8c5b792cf9a6bc892ac6ef109892365d4e3b3812a4ca4a1e957a0d2a2c4bdc0e46f100a292c4d927cedca190517c8d41ab6bb6b1547c
|
7
|
+
data.tar.gz: 1cc90c35e38d8df586cf866638393afe0de9bee9a33c6dfce333628a8dee412696dd15ec68c8eff72ec65e555ff8f355973331dfd77ece7a37dcfd7263d7194f
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
# formatafacil Change Log
|
2
2
|
|
3
|
+
## 0.1.4
|
4
|
+
|
5
|
+
- Possibilita otimizar pdfs para a WEB
|
6
|
+
|
3
7
|
## 0.1.3
|
4
8
|
|
5
|
-
|
9
|
+
- Correção de problema quando arquivo não termina com quebra de linha #1
|
6
10
|
|
7
11
|
## 0.1.2
|
8
12
|
|
9
|
-
|
13
|
+
- Inclusão de comando para compilar artigo latex: compila --documento=artigo
|
data/exe/formatafacil
CHANGED
@@ -8,6 +8,7 @@ require 'formatafacil/template'
|
|
8
8
|
require 'formatafacil/artigo_tarefa'
|
9
9
|
require 'formatafacil/tarefa_chooser'
|
10
10
|
require 'formatafacil/compila'
|
11
|
+
require 'formatafacil/otimizador_para_web'
|
11
12
|
|
12
13
|
include GLI::App
|
13
14
|
|
@@ -21,7 +22,6 @@ arguments :strict
|
|
21
22
|
desc 'Emite mensages de log para o arquivo formatafacil.log'
|
22
23
|
switch :logfile
|
23
24
|
|
24
|
-
|
25
25
|
desc 'Gera artigos em latex e compila para pdf'
|
26
26
|
command :artigo do |c|
|
27
27
|
|
@@ -56,6 +56,9 @@ command :compila do |c|
|
|
56
56
|
|
57
57
|
c.desc 'Possíveis valores: artigo'
|
58
58
|
c.flag [:d,:documento]
|
59
|
+
|
60
|
+
c.desc 'Linealiza o pdf otimizando-o para web'
|
61
|
+
c.switch [:w, 'otimiza-para-web']
|
59
62
|
|
60
63
|
|
61
64
|
c.action do |global,options,args|
|
@@ -68,6 +71,10 @@ command :compila do |c|
|
|
68
71
|
|
69
72
|
begin
|
70
73
|
Formatafacil::Compila.new().compila_artigo
|
74
|
+
if (options['w'])
|
75
|
+
logger.info "Otimizando para web: #{Formatafacil::ARTIGO_PDF}"
|
76
|
+
Formatafacil::OtimizadorParaWeb.new(Formatafacil::ARTIGO_PDF).otimiza
|
77
|
+
end
|
71
78
|
rescue Exception => e
|
72
79
|
logger.error {e.message}
|
73
80
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Formatafacil
|
3
|
+
class OtimizadorParaWeb
|
4
|
+
|
5
|
+
BACKUP_PREFIX = "bkp-"
|
6
|
+
|
7
|
+
attr_accessor :arquivo
|
8
|
+
|
9
|
+
def initialize(arquivo)
|
10
|
+
@arquivo=arquivo
|
11
|
+
end
|
12
|
+
|
13
|
+
def bkp_prefix(arquivo)
|
14
|
+
"bkp-#{arquivo}"
|
15
|
+
end
|
16
|
+
|
17
|
+
def otimiza
|
18
|
+
File.rename(@arquivo, bkp_prefix(@arquivo))
|
19
|
+
system("qpdf --linearize #{bkp_prefix(@arquivo)} #{@arquivo}")
|
20
|
+
File.delete(bkp_prefix(@arquivo))
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
data/lib/formatafacil/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: formatafacil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo de Santana Medeiros Alexandre
|
@@ -113,6 +113,7 @@ files:
|
|
113
113
|
- lib/formatafacil/artigo_tarefa.rb
|
114
114
|
- lib/formatafacil/compila.rb
|
115
115
|
- lib/formatafacil/formato.rb
|
116
|
+
- lib/formatafacil/otimizador_para_web.rb
|
116
117
|
- lib/formatafacil/tarefa.rb
|
117
118
|
- lib/formatafacil/tarefa_chooser.rb
|
118
119
|
- lib/formatafacil/template.rb
|