Method: Limarka::Conversor#pretextual
- Defined in:
- lib/limarka/conversor.rb
#pretextual(tempfile) ⇒ Object
Escreve no arquivo o conteúdo gerado referente ao pretextual do documento.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/limarka/conversor.rb', line 86 def pretextual(tempfile) s = StringIO.new necessita_de_arquivo_de_texto = ["errata"] ["folha_de_rosto", "errata", "folha_de_aprovacao", "dedicatoria", "agradecimentos", "epigrafe", "resumo", "abstract", "lista_ilustracoes", "lista_tabelas", "lista_siglas", "lista_simbolos", "sumario"].each_with_index do |secao,indice| template = "pretextual#{indice+1}-#{secao}" Open3.popen3("pandoc -f #{@t.formato} \"--data-dir=#{options[:templates_dir]}\" --template=#{template} -t latex --filter #{pandoc_abnt_path}") {|stdin, stdout, stderr, wait_thr| stdin.write(hash_to_yaml(t.configuracao)) stdin.write("\n") if t.errata? and necessita_de_arquivo_de_texto.include?(secao) then arquivo_de_entrada = "#{secao}.md" conteudo = File.read(arquivo_de_entrada) stdin.write(conteudo) end stdin.close s << stdout.read exit_status = wait_thr.value # Process::Status object returned. if(exit_status!=0) then puts ("Erro: " + stderr.read).red end } end @pretextual_tex = s.string File.open(tempfile, 'w') { |file| file.write(pretextual_tex) } # puts "#{PRETEXTUAL} criado".green end |