Module: BibTeX

Defined in:
lib/bibtex.rb,
lib/bibtex/entry.rb,
lib/bibtex/error.rb,
lib/bibtex/lexer.rb,
lib/bibtex/names.rb,
lib/bibtex/value.rb,
lib/bibtex/parser.rb,
lib/bibtex/filters.rb,
lib/bibtex/version.rb,
lib/bibtex/elements.rb,
lib/bibtex/utilities.rb,
lib/bibtex/extensions.rb,
lib/bibtex/name_parser.rb,
lib/bibtex/replaceable.rb,
lib/bibtex/bibliography.rb,
lib/bibtex/compatibility.rb,
lib/bibtex/filters/latex.rb,
lib/bibtex/filters/linebreaks.rb

Overview

– BibTeX-Ruby Copyright © 2010-2015 Sylvester Keil <sylvester.keil.or.at>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <www.gnu.org/licenses/>. ++

Defined Under Namespace

Modules: Extensions, Filters, Replaceable, Version Classes: ArgumentError, BibTeXError, Bibliography, Comment, Element, Entry, Error, Filter, Lexer, MetaContent, Name, NameParser, Names, ParseError, Parser, Preamble, String, Value

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.logObject

Returns the value of attribute log.



48
49
50
# File 'lib/bibtex.rb', line 48

def log
  @log
end

Class Method Details

.names(string) ⇒ Object Also known as: name, parse_name, parse_names

Parses the given string as a BibTeX name value and returns a Names object.



46
47
48
# File 'lib/bibtex/utilities.rb', line 46

def names(string)
  Names.parse(string)
end

.open(file, options = {}, &block) ⇒ Object

Opens a BibTeX file or URI and returns a corresponding Bibliography object or, if a block is given, yields the Bibliography to the block, ensuring that the file is saved.



24
25
26
# File 'lib/bibtex/utilities.rb', line 24

def open(file, options = {}, &block)
  Bibliography.open(file, options, &block)
end

.parse(string, options = {}, &block) ⇒ Object

Parses the given string and returns a corresponding Bibliography object. Delegates to BibTeX.open if the string is a filename or URI.



30
31
32
33
34
35
36
37
38
# File 'lib/bibtex/utilities.rb', line 30

def parse(string, options = {}, &block)
  if string.length < 260 && File.exist?(string)
    Bibliography.open(string, options, &block)
  elsif string =~ %r{\A[a-z]+://}i
    Bibliography.open(string, options)
  else
    Bibliography.parse(string, options)
  end
end

.valid?(file) ⇒ Boolean

Returns true if the given file is a valid BibTeX bibliography.

Returns:

  • (Boolean)


41
42
43
# File 'lib/bibtex/utilities.rb', line 41

def valid?(file)
  Bibliography.open(file).valid?
end