18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/limarka/ref.rb', line 18
def add
if (options[:clipboard]) then
referencia = Clipboard.paste
else
referencia = $stdin.read
end
begin
entry = BibTeX.parse(referencia)
error = entry.length.zero?
if not error then
append_to_file options[:bibfile], referencia
puts <<MSG
A seguinte referência foi adicionado ao arquivo '#{options[:bibfile]}':
#{referencia}
ABNT NBR 10520:2002(5.1): As citações diretas devem indicar a página.
Como citar no texto: \\cite{#{entry[0].key}} \\cite[p. XXX]{#{entry[0].key}} \\citeonline{#{entry[0].key}}
MSG
end
rescue BibTeX::ParseError
error = true
end
if (error) then
puts "Entrada não apresenta uma referência válida:\n#{referencia}"
return 1
end
end
|