pandoc_abnt 1.0.3 → 1.0.4
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 +4 -4
- data/README.md +1 -1
- data/Rakefile +13 -0
- data/lib/pandoc_abnt/figura_filter.rb +15 -1
- data/lib/pandoc_abnt/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: d326f6a0e4134fcb2e3b31bf1de4ddc7ada5dd96
|
4
|
+
data.tar.gz: 449e63c501d7799a3b644f00a4c40d8df9dbd684
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e28532e8cce804d620c5958f1d45286366f3769c83cfb57b33f26336b77f62842b9a76d44361d61642af4cd3ddf27f75eef6c4a4488f49bdf26d7158256459f8
|
7
|
+
data.tar.gz: 5ca5858f39a4f359fb21601ce7b61558ec8ccc99ee86a375bfb509f75da01a62cbd90045cff42a100f0e8c81d88692cce953b6922c18f7c5158f8207903d2c4e
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -7,6 +7,19 @@ task :default => :spec
|
|
7
7
|
|
8
8
|
desc "Cria/recria as fixtures"
|
9
9
|
task :fixtures do
|
10
|
+
|
11
|
+
Dir.chdir("spec/fixtures/files/figuras") do
|
12
|
+
|
13
|
+
originais = ["p-fig-caption-largura-p-fonte.md"]
|
14
|
+
originais.each do |original|
|
15
|
+
system "pandoc -f markdown+raw_tex --wrap=none #{original} -o #{original.ext('.pandoc.json')}"
|
16
|
+
system "pandoc -f markdown+raw_tex --wrap=none #{original.ext('.transformacao-esperada.md')} -o #{original.ext('.transformacao-esperada.json')}"
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
|
10
23
|
Dir.chdir("spec/fixtures/files/tabelas") do
|
11
24
|
|
12
25
|
system "pandoc -f markdown+raw_tex simple_tables-with-footnote.md -o simple_tables-with-footnote.pandoc.json"
|
@@ -64,6 +64,19 @@ LATEX
|
|
64
64
|
latex_code
|
65
65
|
end
|
66
66
|
|
67
|
+
def atualiza_imagem_width(node)
|
68
|
+
# {"t"=>"Para", "c"=>[{"t"=>"Image", "c"=>[["id", [], [["largura", "30%"]]], [{"t"=>"Str", "c"=>"Título"}], ["imagem.png", "fig:"]]}]}
|
69
|
+
# node["c"][0]["c"][2] << ["width","30%"]
|
70
|
+
atributos = node["c"][0]["c"][0][2]
|
71
|
+
atributos.each_with_index do |att, index|
|
72
|
+
if att[0] == "largura" then
|
73
|
+
atributos[index][0] = "width"
|
74
|
+
break
|
75
|
+
end
|
76
|
+
end
|
77
|
+
node
|
78
|
+
end
|
79
|
+
|
67
80
|
def filtra_json(pandoc_json_tree)
|
68
81
|
# Exemplo de código:
|
69
82
|
# [{"unMeta":{}},[{"t":"Para","c":[{"t":"Image","c":[["id",[],[["width","30%"]]],[{"t":"Str","c":"Título"}],["imagem.png","fig:"]]}]},{"t":"Para","c":[{"t":"Str","c":"Fonte:"},{"t":"Space","c":[]},{"t":"Str","c":"Autor."}]}]]
|
@@ -82,7 +95,8 @@ LATEX
|
|
82
95
|
blocks.each do |node|
|
83
96
|
|
84
97
|
if (fonte?(node) and imagem?(anterior)) then
|
85
|
-
|
98
|
+
image_node = atualiza_imagem_width(anterior)
|
99
|
+
imagem_latex = convert_to_latex({"blocks"=>[image_node], "pandoc-api-version" => api, "meta" => meta})
|
86
100
|
fonte_latex = convert_to_latex({"blocks"=>[node], "pandoc-api-version" => api, "meta" => meta})
|
87
101
|
texcode = reformata_figura_latex(imagem_latex, fonte_latex)
|
88
102
|
raw_tex = {"t"=>"RawBlock","c"=>["latex",texcode]}
|
data/lib/pandoc_abnt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pandoc_abnt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
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-02-
|
11
|
+
date: 2017-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|