pandoc_abnt 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 57ccbe565e982a7a2d04e880bd1d0e65db1b9b65
4
- data.tar.gz: 65dd5e1cc31b4467d394474e4c7623da2ae6c981
3
+ metadata.gz: d326f6a0e4134fcb2e3b31bf1de4ddc7ada5dd96
4
+ data.tar.gz: 449e63c501d7799a3b644f00a4c40d8df9dbd684
5
5
  SHA512:
6
- metadata.gz: e01ab266f6734b07b0a1b730e8072b7e17b850609d0844d9ad02e5c22acbd7fe4713d2e5cbc57575bcc478c0292ad8f5d5c708b9212c2516ab14d18e049cee6e
7
- data.tar.gz: 05eee43a35f98759d19e30d1770e7e21d30e8881fff6221de761137e9071acef28373de67484d8fbe6872707089de26e7aee34cbc5362b01ac93753c9e478009
6
+ metadata.gz: e28532e8cce804d620c5958f1d45286366f3769c83cfb57b33f26336b77f62842b9a76d44361d61642af4cd3ddf27f75eef6c4a4488f49bdf26d7158256459f8
7
+ data.tar.gz: 5ca5858f39a4f359fb21601ce7b61558ec8ccc99ee86a375bfb509f75da01a62cbd90045cff42a100f0e8c81d88692cce953b6922c18f7c5158f8207903d2c4e
data/README.md CHANGED
@@ -38,7 +38,7 @@ Para adicionar uma fonte a figura ou tabela, basta adicionar no parágrafo segui
38
38
  Exemplo de Figura:
39
39
 
40
40
  ```markdown
41
- ![Título](imagem.png){#id width=30%}
41
+ ![Título](imagem.png){#id largura=30%}
42
42
 
43
43
  Fonte: Autor.
44
44
  ```
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
- imagem_latex = convert_to_latex({"blocks"=>[anterior], "pandoc-api-version" => api, "meta" => meta})
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]}
@@ -1,3 +1,3 @@
1
1
  module PandocAbnt
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
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.3
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-21 00:00:00.000000000 Z
11
+ date: 2017-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler