Class: Limarka::Ref
- Inherits:
-
Thor
- Object
- Thor
- Limarka::Ref
- Includes:
- Thor::Actions
- Defined in:
- lib/limarka/ref.rb
Overview
Essa classe contem os comandos de linhas referente aos comandos de ref. Execute ‘limarka help ref` para conhecer os comandos. Ela é incluída em Cli, utiliza a mesma sintaxe daquela classe.
Instance Method Summary collapse
Instance Method Details
#add ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/limarka/ref.rb', line 22 def add if ([: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 [:bibfile], referencia puts "A seguinte refer\u00EAncia foi adicionado ao arquivo '\#{options[:bibfile]}':\n\#{referencia}\nABNT NBR 10520:2002(5.1): As cita\u00E7\u00F5es diretas devem indicar a p\u00E1gina.\nComo citar no texto: \\\\cite{\#{entry[0].key}} \\\\cite[p. XXX]{\#{entry[0].key}} \\\\citeonline{\#{entry[0].key}}\n" 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 |