class Limarka::Ref

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. @see Cli

Public Instance Methods

add() click to toggle source
# File lib/limarka/ref.rb, line 22
    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