nsi-abntformat 0.2.0
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.
- data/.document +5 -0
- data/CONTRIBUTORS +5 -0
- data/Gemfile +15 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +11 -0
- data/Rakefile +36 -0
- data/VERSION +1 -0
- data/lib/referencia_bibliografica.rb +152 -0
- data/test/referencia_bibliografica_spec.rb +195 -0
- data/test/spec_helper.rb +16 -0
- metadata +124 -0
data/.document
ADDED
data/CONTRIBUTORS
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "rspec", ">= 0"
|
10
|
+
gem "bundler", "> 1.0.0"
|
11
|
+
gem "jeweler", "~> 1.8.3"
|
12
|
+
gem "unicode", ">= 0"
|
13
|
+
gem "rake"
|
14
|
+
gem "diff-lcs", ">= 1.1.3"
|
15
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Núcleo de Pesquisa em Sistemas de Informação.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
|
15
|
+
require 'jeweler'
|
16
|
+
Jeweler::Tasks.new do |gem|
|
17
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
18
|
+
gem.name = "nsi-abntformat"
|
19
|
+
gem.homepage = "http://github.com/oswluiz/nsi-abntformat"
|
20
|
+
gem.license = "MIT"
|
21
|
+
gem.summary = "ABNT Format"
|
22
|
+
gem.description = "Transforms objects containing documentation metadata in bibliographic references on ABNT format"
|
23
|
+
gem.email = "oswluizf@gmail.com"
|
24
|
+
gem.authors = ["Oswaldo Ferreira"]
|
25
|
+
# dependencies defined in Gemfile
|
26
|
+
end
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
28
|
+
|
29
|
+
require 'rspec/core'
|
30
|
+
require 'rspec/core/rake_task'
|
31
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
32
|
+
spec.pattern = FileList['test/**/*_spec.rb']
|
33
|
+
spec.rspec_opts = "--color --format nested"
|
34
|
+
end
|
35
|
+
|
36
|
+
task :default => :spec
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.2.0
|
@@ -0,0 +1,152 @@
|
|
1
|
+
#coding:utf-8
|
2
|
+
require 'unicode'
|
3
|
+
|
4
|
+
class ReferenciaBibliografica
|
5
|
+
|
6
|
+
def _monta_nome(autores)
|
7
|
+
lista_autores = autores.split(';')
|
8
|
+
lista_autores.each_index do |i|
|
9
|
+
nome_autor = lista_autores[i].split(' ')
|
10
|
+
if nome_autor.include? ('')
|
11
|
+
nome_autor.delete('')
|
12
|
+
end
|
13
|
+
nome_abnt = Unicode.upcase nome_autor.pop + ','
|
14
|
+
nome_autor.each_index do |j|
|
15
|
+
nome_abnt += ' ' + nome_autor[j][0] + '.'
|
16
|
+
end
|
17
|
+
lista_autores[i] = nome_abnt
|
18
|
+
end
|
19
|
+
return lista_autores * "; "
|
20
|
+
end
|
21
|
+
|
22
|
+
def _referencia_trabalho_conclusao(trabalho_conclusao)
|
23
|
+
autores = _monta_nome(trabalho_conclusao.autores)
|
24
|
+
titulo = trabalho_conclusao.titulo
|
25
|
+
subtitulo = _gerar_subtitulo(trabalho_conclusao)
|
26
|
+
defesa = trabalho_conclusao.data_defesa
|
27
|
+
folhas = trabalho_conclusao.total_folhas
|
28
|
+
tipo = trabalho_conclusao.tipo_trabalho
|
29
|
+
instituicao = trabalho_conclusao.instituicao
|
30
|
+
local = trabalho_conclusao.local_defesa
|
31
|
+
return "#{autores} #{titulo}#{subtitulo}. #{defesa}. "\
|
32
|
+
"#{folhas} f. #{tipo} - #{instituicao}, #{local}."
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
def _referencia_artigo_anais_evento(artigo_anais_evento)
|
37
|
+
autores = _monta_nome(artigo_anais_evento.autores)
|
38
|
+
titulo = artigo_anais_evento.titulo
|
39
|
+
subtitulo = _gerar_subtitulo(artigo_anais_evento)
|
40
|
+
nome_evento = artigo_anais_evento.nome_evento
|
41
|
+
numero_evento = artigo_anais_evento.numero_evento
|
42
|
+
ano_evento = artigo_anais_evento.ano_evento
|
43
|
+
local_evento = artigo_anais_evento.local_evento
|
44
|
+
titulo_anais = artigo_anais_evento.titulo_anais
|
45
|
+
local_publicacao = artigo_anais_evento.local_publicacao
|
46
|
+
editora = artigo_anais_evento.editora
|
47
|
+
ano_publicacao = artigo_anais_evento.ano_publicacao
|
48
|
+
pagina_inicial = artigo_anais_evento.pagina_inicial
|
49
|
+
pagina_final = artigo_anais_evento.pagina_final
|
50
|
+
return "#{autores} #{titulo}.#{subtitulo} In: #{nome_evento}, " \
|
51
|
+
"#{numero_evento}., #{ano_evento}, #{local_evento}. " \
|
52
|
+
"#{titulo_anais}. #{local_publicacao}: #{editora}, " \
|
53
|
+
"#{ano_publicacao}. P. #{pagina_inicial}-#{pagina_final}."
|
54
|
+
end
|
55
|
+
|
56
|
+
def _referencia_artigo_periodico(artigo_periodico)
|
57
|
+
autores = _monta_nome(artigo_periodico.autores)
|
58
|
+
titulo = artigo_periodico.titulo
|
59
|
+
subtitulo = _gerar_subtitulo(artigo_periodico)
|
60
|
+
nome = artigo_periodico.nome_periodico
|
61
|
+
local = artigo_periodico.local_publicacao
|
62
|
+
volume = artigo_periodico.volume
|
63
|
+
fasciculo = artigo_periodico.fasciculo
|
64
|
+
pagina_inicial = artigo_periodico.pagina_inicial
|
65
|
+
pagina_final = artigo_periodico.pagina_final
|
66
|
+
data = artigo_periodico.data_publicacao
|
67
|
+
return "#{autores} #{titulo}#{subtitulo}. #{nome}, #{local}, " \
|
68
|
+
"v. #{volume}, n. #{fasciculo}, " \
|
69
|
+
"p. #{pagina_inicial}-#{pagina_final}, #{data}."
|
70
|
+
end
|
71
|
+
|
72
|
+
def _referencia_periodico_tecnico_cientifico(periodico_tecnico_cientifico)
|
73
|
+
titulo = periodico_tecnico_cientifico.titulo
|
74
|
+
local= periodico_tecnico_cientifico.local_publicacao
|
75
|
+
editora = periodico_tecnico_cientifico.editora
|
76
|
+
ano_primeiro = periodico_tecnico_cientifico.ano_primeiro_volume
|
77
|
+
ano_ultimo = periodico_tecnico_cientifico.ano_ultimo_volume
|
78
|
+
return "#{titulo}. #{local}: #{editora}, " \
|
79
|
+
"#{ano_primeiro}-#{ano_ultimo}"
|
80
|
+
end
|
81
|
+
|
82
|
+
def _referencia_livro(livro)
|
83
|
+
autores = _monta_nome(livro.autores)
|
84
|
+
titulo = livro.titulo
|
85
|
+
subtitulo = _gerar_subtitulo(livro)
|
86
|
+
traducao = _gerar_opcional(livro.traducao)
|
87
|
+
edicao = _gerar_opcional(livro.edicao)
|
88
|
+
publicacao = livro.local_publicacao
|
89
|
+
editora = livro.editora
|
90
|
+
ano = livro.ano_publicacao
|
91
|
+
paginas = livro.numero_paginas
|
92
|
+
return "#{autores} #{titulo}: #{subtitulo}. #{traducao}#{edicao}" \
|
93
|
+
"#{publicacao}: #{editora}, #{ano}. #{paginas} p."
|
94
|
+
end
|
95
|
+
|
96
|
+
def _referencia_relatorio_tecnico_cientifico(relatorio_tecnico_cientifico)
|
97
|
+
autores = _monta_nome(relatorio_tecnico_cientifico.autores)
|
98
|
+
titulo = relatorio_tecnico_cientifico.titulo
|
99
|
+
local = relatorio_tecnico_cientifico.local_publicacao
|
100
|
+
instituicao = relatorio_tecnico_cientifico.instituicao
|
101
|
+
ano = relatorio_tecnico_cientifico.ano_publicacao
|
102
|
+
paginas = relatorio_tecnico_cientifico.numero_paginas
|
103
|
+
return "#{autores} #{titulo}. #{local}: #{instituicao}, #{ano}. " \
|
104
|
+
"#{paginas} p."
|
105
|
+
end
|
106
|
+
|
107
|
+
def _referencia_imagem(imagem)
|
108
|
+
autores = _monta_nome(imagem.autores)
|
109
|
+
titulo = imagem.titulo
|
110
|
+
instituicao = imagem.instituicao
|
111
|
+
local = imagem.local
|
112
|
+
return "#{autores} #{titulo}. #{instituicao}, #{local}."
|
113
|
+
end
|
114
|
+
|
115
|
+
def _referencia_objetos_de_aprendizagem(objetos_de_aprendizagem)
|
116
|
+
autores = _monta_nome(objetos_de_aprendizagem.autores)
|
117
|
+
titulo = objetos_de_aprendizagem.titulo
|
118
|
+
instituicao = objetos_de_aprendizagem.instituicao
|
119
|
+
return "#{autores} #{titulo}. #{instituicao}."
|
120
|
+
end
|
121
|
+
|
122
|
+
def _referencia_outros_conteudos(outros_conteudos)
|
123
|
+
autores = _monta_nome(outros_conteudos.autores)
|
124
|
+
titulo = outros_conteudos.titulo
|
125
|
+
instituicao = outros_conteudos.instituicao
|
126
|
+
return "#{autores} #{titulo}. #{instituicao}."
|
127
|
+
end
|
128
|
+
|
129
|
+
def gerar(documento)
|
130
|
+
conversores = {
|
131
|
+
'trabalho de conclusão' => :_referencia_trabalho_conclusao,
|
132
|
+
'artigo de anais de eventos' => :_referencia_artigo_anais_evento,
|
133
|
+
'artigo de periodico' => :_referencia_artigo_periodico,
|
134
|
+
'periodico tecnico cientifico' => :_referencia_periodico_tecnico_cientifico,
|
135
|
+
'livro' => :_referencia_livro,
|
136
|
+
'relatorio tecnico cientifico' => :_referencia_relatorio_tecnico_cientifico,
|
137
|
+
'imagem' => :_referencia_imagem,
|
138
|
+
'objetos de aprendizagem' => :_referencia_objetos_de_aprendizagem,
|
139
|
+
'outros conteúdos' => :_referencia_outros_conteudos }
|
140
|
+
public_method(conversores[documento.tipo]).call documento
|
141
|
+
end
|
142
|
+
|
143
|
+
def _gerar_subtitulo(documento)
|
144
|
+
return _gerar_opcional(documento.subtitulo)
|
145
|
+
end
|
146
|
+
|
147
|
+
def _gerar_opcional(text)
|
148
|
+
text = '' unless text
|
149
|
+
return "#{text}"
|
150
|
+
end
|
151
|
+
|
152
|
+
end
|
@@ -0,0 +1,195 @@
|
|
1
|
+
#coding: utf-8
|
2
|
+
require_relative "spec_helper"
|
3
|
+
|
4
|
+
describe "Spec de ReferenciaBibliografica" do
|
5
|
+
it "converte nome completo em citação" do
|
6
|
+
referencia = ReferenciaBibliografica.new
|
7
|
+
referencia._monta_nome('Ruhan Ferreira Almeida; Carlos Souza Teste').should \
|
8
|
+
eql ("ALMEIDA, R. F.; TESTE, C. S.")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
describe "Gerador de referencias" do
|
14
|
+
|
15
|
+
it "gerando referencia para trabalho de conclusão" do
|
16
|
+
referencia = ReferenciaBibliografica.new
|
17
|
+
trabalho_conclusao = mock(:trabalho_conclusao)
|
18
|
+
trabalho_conclusao.stub('tipo') { 'trabalho de conclusão' }
|
19
|
+
trabalho_conclusao.stub('autores') { 'Ian Fantucci' }
|
20
|
+
trabalho_conclusao.stub('titulo') { 'Contribuição do alerta, da atenção, ' \
|
21
|
+
'da intenção e da expectativa temporal para o desempenho de '\
|
22
|
+
'humanos em tarefas de tempo de reação' }
|
23
|
+
trabalho_conclusao.stub('subtitulo') { nil }
|
24
|
+
trabalho_conclusao.stub('data_defesa') { '2001' }
|
25
|
+
trabalho_conclusao.stub('total_folhas') { '130' }
|
26
|
+
trabalho_conclusao.stub('tipo_trabalho') { 'Tese (Doutorado em Psicologia)' }
|
27
|
+
trabalho_conclusao.stub('instituicao') { 'Instituto de Psicologia, '\
|
28
|
+
'Universidade de São Paulo' }
|
29
|
+
trabalho_conclusao.stub!('local_defesa') { 'São Paulo' }
|
30
|
+
|
31
|
+
|
32
|
+
referencia_abnt = referencia.gerar(trabalho_conclusao)
|
33
|
+
|
34
|
+
referencia_abnt.should == (
|
35
|
+
'FANTUCCI, I. Contribuição do alerta, da atenção, da intenção e da' \
|
36
|
+
' expectativa temporal para o desempenho de humanos em tarefas de ' \
|
37
|
+
'tempo de reação. 2001. 130 f. Tese (Doutorado em Psicologia) - ' \
|
38
|
+
'Instituto de Psicologia, Universidade de São Paulo, São Paulo.')
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
it "gerando referencia para artigos de anais de eventos" do
|
43
|
+
referencia = ReferenciaBibliografica.new
|
44
|
+
artigo_anais_evento = mock(:trabalho_conclusao)
|
45
|
+
artigo_anais_evento.stub('tipo') { 'artigo de anais de eventos' }
|
46
|
+
artigo_anais_evento.stub('autores') { 'Antônio Fernandes Bueno Moreira' }
|
47
|
+
artigo_anais_evento.stub('titulo') { 'Multiculturalismo, Currículo e '\
|
48
|
+
'Formação de Professores' }
|
49
|
+
artigo_anais_evento.stub('subtitulo') { nil }
|
50
|
+
artigo_anais_evento.stub('nome_evento') { 'SEMINÁRIO DE EDUCAÇÃO BÁSICA' }
|
51
|
+
artigo_anais_evento.stub('numero_evento') { '2' }
|
52
|
+
artigo_anais_evento.stub('ano_evento') { '1998' }
|
53
|
+
artigo_anais_evento.stub('local_evento') { 'Santa Cruz do Sul' }
|
54
|
+
artigo_anais_evento.stub('titulo_anais') { 'Anais' }
|
55
|
+
artigo_anais_evento.stub('local_publicacao') { 'Santa Cruz do Sul' }
|
56
|
+
artigo_anais_evento.stub('editora') { 'EDUNISC' }
|
57
|
+
artigo_anais_evento.stub('ano_publicacao') { '1998' }
|
58
|
+
artigo_anais_evento.stub('pagina_inicial') { '15' }
|
59
|
+
artigo_anais_evento.stub('pagina_final') { '30' }
|
60
|
+
|
61
|
+
referencia_anais_evento = referencia.gerar(artigo_anais_evento)
|
62
|
+
referencia_anais_evento.should == (
|
63
|
+
'MOREIRA, A. F. B. Multiculturalismo, Currículo e Formação de ' \
|
64
|
+
'Professores. In: SEMINÁRIO DE EDUCAÇÃO BÁSICA, 2., 1998, Santa ' \
|
65
|
+
'Cruz do Sul. Anais. Santa Cruz do Sul: EDUNISC, 1998. P. 15-30.')
|
66
|
+
end
|
67
|
+
|
68
|
+
it "gerando referencia de artigo de periodico" do
|
69
|
+
referencia = ReferenciaBibliografica.new
|
70
|
+
artigo_periodico = mock(:artigo_periodico)
|
71
|
+
|
72
|
+
artigo_periodico.stub('tipo') { 'artigo de periodico' }
|
73
|
+
artigo_periodico.stub('autores') { 'Demerval Saviani' }
|
74
|
+
artigo_periodico.stub('titulo') { 'A Universidade e a Problemática da Educação e Cultura' }
|
75
|
+
artigo_periodico.stub('subtitulo') { nil }
|
76
|
+
artigo_periodico.stub('nome_periodico') { 'Educação Brasileira' }
|
77
|
+
artigo_periodico.stub('local_publicacao') { 'Brasília' }
|
78
|
+
artigo_periodico.stub('volume') { '1' }
|
79
|
+
artigo_periodico.stub('fasciculo') { '3' }
|
80
|
+
artigo_periodico.stub('pagina_inicial') { '35' }
|
81
|
+
artigo_periodico.stub('pagina_final') { '58' }
|
82
|
+
artigo_periodico.stub('data_publicacao') { '1979' }
|
83
|
+
|
84
|
+
referencia_artigo_periodico = referencia.gerar(artigo_periodico)
|
85
|
+
referencia_artigo_periodico.should == (
|
86
|
+
"SAVIANI, D. A Universidade e a Problemática da Educação e Cultura."\
|
87
|
+
" Educação Brasileira, Brasília, v. 1, n. 3, p. 35-58, 1979.")
|
88
|
+
end
|
89
|
+
|
90
|
+
it "gerando referencia de periodico tecnico cientifico" do
|
91
|
+
referencia = ReferenciaBibliografica.new
|
92
|
+
periodico_tecnico_cientifico = mock(:periodico_tecnico_cientifico)
|
93
|
+
|
94
|
+
periodico_tecnico_cientifico.stub('tipo') { 'periodico tecnico cientifico' }
|
95
|
+
periodico_tecnico_cientifico.stub('titulo') { 'EDUCAÇÃO & REALIDADE' }
|
96
|
+
periodico_tecnico_cientifico.stub('local_publicacao') { 'Porto Alegre' }
|
97
|
+
periodico_tecnico_cientifico.stub('editora') { 'UFRGS/FACED' }
|
98
|
+
periodico_tecnico_cientifico.stub('ano_primeiro_volume') { '1975' }
|
99
|
+
periodico_tecnico_cientifico.stub('ano_ultimo_volume') { nil }
|
100
|
+
|
101
|
+
referencia_tecnico_cientifico = referencia.gerar(periodico_tecnico_cientifico)
|
102
|
+
referencia_tecnico_cientifico.should == ('EDUCAÇÃO & REALIDADE. Porto Alegre:'\
|
103
|
+
' UFRGS/FACED, 1975-')
|
104
|
+
end
|
105
|
+
|
106
|
+
it "gerando referencia de livro" do
|
107
|
+
referencia = ReferenciaBibliografica.new
|
108
|
+
livro = mock(:livro)
|
109
|
+
|
110
|
+
livro.stub('tipo') { 'livro' }
|
111
|
+
livro.stub('autores') { 'Marcos Antônio Azevedo; '\
|
112
|
+
'Vinícios Nogueira Almeida Guerra' }
|
113
|
+
livro.stub('titulo') { 'Mania de bater' }
|
114
|
+
livro.stub('subtitulo') { 'a punição corporal doméstica de crianças '\
|
115
|
+
'e adolescentes no Brasil' }
|
116
|
+
livro.stub('traducao') { nil }
|
117
|
+
livro.stub('edicao') { nil }
|
118
|
+
livro.stub('local_publicacao') { 'São Paulo' }
|
119
|
+
livro.stub('editora') { 'Iglu' }
|
120
|
+
livro.stub('ano_publicacao') { '2001' }
|
121
|
+
livro.stub('numero_paginas') { '386' }
|
122
|
+
|
123
|
+
referencia_livro = referencia.gerar(livro)
|
124
|
+
referencia_livro.should == ('AZEVEDO, M. A.; GUERRA, V. N. A. ' \
|
125
|
+
'Mania de bater: a punição corporal doméstica de crianças e ' \
|
126
|
+
'adolescentes no Brasil. São Paulo: Iglu, 2001. 386 p.')
|
127
|
+
end
|
128
|
+
|
129
|
+
it "gerando referencia de relatorio tecnico cientifico" do
|
130
|
+
referencia = ReferenciaBibliografica.new
|
131
|
+
relatorio_tecnico_cientifico = mock(:relatorio_tecnico_cientifico)
|
132
|
+
|
133
|
+
relatorio_tecnico_cientifico.stub('tipo') { 'relatorio tecnico cientifico' }
|
134
|
+
relatorio_tecnico_cientifico.stub('autores') { 'Ubiraci Espinelli Souza; '\
|
135
|
+
'Silvio Burratino Melhado' }
|
136
|
+
relatorio_tecnico_cientifico.stub('titulo') { 'Subsídios para a avaliação' \
|
137
|
+
' do custo de mão-de-obra na construção civil' }
|
138
|
+
relatorio_tecnico_cientifico.stub('local_publicacao') { 'São Paulo' }
|
139
|
+
relatorio_tecnico_cientifico.stub('instituicao') { 'EPUSP' }
|
140
|
+
relatorio_tecnico_cientifico.stub('ano_publicacao') { '1991' }
|
141
|
+
relatorio_tecnico_cientifico.stub('numero_paginas') { '38' }
|
142
|
+
|
143
|
+
referencia_relatorio_cientifico = referencia.gerar(relatorio_tecnico_cientifico)
|
144
|
+
referencia_relatorio_cientifico.should == (
|
145
|
+
'SOUZA, U. E.; MELHADO, S. B. Subsídios para a avaliação do ' \
|
146
|
+
'custo de mão-de-obra na construção civil. São Paulo: EPUSP, 1991. ' \
|
147
|
+
'38 p.')
|
148
|
+
end
|
149
|
+
|
150
|
+
it "gerando referencia de imagem" do
|
151
|
+
referencia = ReferenciaBibliografica.new
|
152
|
+
imagem = mock(:imagem)
|
153
|
+
|
154
|
+
imagem.stub('tipo') { 'imagem' }
|
155
|
+
imagem.stub('autores') { 'Alberto Gomes Pereira; Ricardo Silva' }
|
156
|
+
imagem.stub('titulo') { 'As crianças da indonésia' }
|
157
|
+
imagem.stub('instituicao') { 'Instituto Federal Fluminense' }
|
158
|
+
imagem.stub('local') { 'Campos dos Goytacazes' }
|
159
|
+
|
160
|
+
referencia_imagem = referencia.gerar(imagem)
|
161
|
+
referencia_imagem.should == ('PEREIRA, A. G.; SILVA, R. As ' \
|
162
|
+
'crianças da indonésia. Instituto Federal Fluminense, Campos dos ' \
|
163
|
+
'Goytacazes.')
|
164
|
+
end
|
165
|
+
|
166
|
+
it "gerando referencia de objetos de aprendizagem" do
|
167
|
+
referencia = ReferenciaBibliografica.new
|
168
|
+
objetos_de_aprendizagem = mock(:objetos_de_aprendizagem)
|
169
|
+
|
170
|
+
objetos_de_aprendizagem.stub('tipo') { 'objetos de aprendizagem' }
|
171
|
+
objetos_de_aprendizagem.stub('autores') { 'Ariosvaldo Gomes' }
|
172
|
+
objetos_de_aprendizagem.stub('titulo') { 'Viver é aprender' }
|
173
|
+
objetos_de_aprendizagem.stub('instituicao') { 'Instituto Federal Fluminense' }
|
174
|
+
|
175
|
+
referencia_aprendizagem = referencia.gerar(objetos_de_aprendizagem)
|
176
|
+
referencia_aprendizagem.should == ('GOMES, A. Viver é aprender. ' \
|
177
|
+
'Instituto Federal Fluminense.')
|
178
|
+
end
|
179
|
+
|
180
|
+
it "gerando referencia de outros conteudos" do
|
181
|
+
referencia = ReferenciaBibliografica.new
|
182
|
+
outros_conteudos = mock(:outros_conteudos)
|
183
|
+
|
184
|
+
outros_conteudos.stub('tipo') { 'outros conteúdos' }
|
185
|
+
outros_conteudos.stub('autores') { 'Adalberto Pereira Silva' }
|
186
|
+
outros_conteudos.stub('titulo') { 'Tenho joanetes' }
|
187
|
+
outros_conteudos.stub('instituicao') { 'Instituto Federal Fluminense' }
|
188
|
+
|
189
|
+
referencia_outros = referencia.gerar(outros_conteudos)
|
190
|
+
referencia_outros.should eql ('SILVA, A. P. Tenho joanetes. ' \
|
191
|
+
'Instituto Federal Fluminense.')
|
192
|
+
end
|
193
|
+
|
194
|
+
end
|
195
|
+
|
data/test/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
|
11
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
12
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
13
|
+
|
14
|
+
require 'rspec'
|
15
|
+
require 'referencia_bibliografica'
|
16
|
+
|
metadata
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nsi-abntformat
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Oswaldo Ferreira
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-03-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: &80795750 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *80795750
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: bundler
|
27
|
+
requirement: &80795270 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>'
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.0.0
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *80795270
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: jeweler
|
38
|
+
requirement: &80794740 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.8.3
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *80794740
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: unicode
|
49
|
+
requirement: &80794170 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *80794170
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rake
|
60
|
+
requirement: &80793580 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *80793580
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: diff-lcs
|
71
|
+
requirement: &80793060 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 1.1.3
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *80793060
|
80
|
+
description: Transforms objects containing documentation metadata in bibliographic
|
81
|
+
references on ABNT format
|
82
|
+
email: oswluizf@gmail.com
|
83
|
+
executables: []
|
84
|
+
extensions: []
|
85
|
+
extra_rdoc_files:
|
86
|
+
- LICENSE.txt
|
87
|
+
- README.rdoc
|
88
|
+
files:
|
89
|
+
- .document
|
90
|
+
- CONTRIBUTORS
|
91
|
+
- Gemfile
|
92
|
+
- LICENSE.txt
|
93
|
+
- README.rdoc
|
94
|
+
- Rakefile
|
95
|
+
- VERSION
|
96
|
+
- lib/referencia_bibliografica.rb
|
97
|
+
- test/referencia_bibliografica_spec.rb
|
98
|
+
- test/spec_helper.rb
|
99
|
+
homepage: http://github.com/oswluiz/nsi-abntformat
|
100
|
+
licenses:
|
101
|
+
- MIT
|
102
|
+
post_install_message:
|
103
|
+
rdoc_options: []
|
104
|
+
require_paths:
|
105
|
+
- lib
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ! '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
requirements: []
|
119
|
+
rubyforge_project:
|
120
|
+
rubygems_version: 1.8.15
|
121
|
+
signing_key:
|
122
|
+
specification_version: 3
|
123
|
+
summary: ABNT Format
|
124
|
+
test_files: []
|