Sha256: 4faaf1731f7c3a193461ec0187c03c8e0cc72af864411d29fee154b52d7cb15a
Contents?: true
Size: 1.83 KB
Versions: 2
Compression:
Stored size: 1.83 KB
Contents
#-- # BibTeX-Ruby # Copyright (C) 2011 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 <http://www.gnu.org/licenses/>. #++ module BibTeX class << self # 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. def open(file, options = {}, &block) Bibliography.open(file, options, &block) end # Parses the given string and returns a corresponding +Bibliography+ object. # Delegates to BibTeX.open if the string is a filename or URI. def parse(string, options = {}, &block) case when string.length < 260 && File.exists?(string) Bibliography.open(string, options, &block) when string =~ /^[a-z]+:\/\//i Bibliography.open(string, options) else Bibliography.parse(string, options) end end # Returns true if the given file is a valid BibTeX bibliography. def valid?(file) Bibliography.open(file).valid? end # Parses the given string as a BibTeX name value and returns a Names object. def names(string) Names.parse(string) end alias :name :names alias :parse_name :names alias :parse_names :names end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bibtex-ruby-4.2.0 | lib/bibtex/utilities.rb |
bibtex-ruby-4.1.2 | lib/bibtex/utilities.rb |