bibtex-ruby 4.0.4 → 4.0.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bibtex-ruby might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/examples/bib2html.rb +16 -11
- data/examples/markdown.bib +1 -1
- data/lib/bibtex.rb +1 -1
- data/lib/bibtex/error.rb +11 -11
- data/lib/bibtex/version.rb +1 -1
- data/test/test_bibtex.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 733bd2d0bdfc1dc2fa6d90cd2ca46f796edfda98
|
4
|
+
data.tar.gz: e995ff535722aa2a2f8b9b6e76873d707ca064e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4762b7453c5e38974a6f2a2a87d967be023ad3435e6e093a026b12cd7c871ce612b47a28f92ff418e08d11673c5c3e007497f707aa8c4dc1611fabf9c6e4da62
|
7
|
+
data.tar.gz: f7e1b284e83248ea73619fcd7dd68b15dc2c2da9ef46344f8edf4e3229ffcdca5eab56997ef97ab12f5e93c1efd0794802e05efbd6c15ff6e72ca75ee2e8e351
|
data/examples/bib2html.rb
CHANGED
@@ -1,28 +1,33 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'bibtex'
|
3
3
|
|
4
|
+
begin
|
5
|
+
require 'citeproc/ruby'
|
6
|
+
require 'csl/styles'
|
7
|
+
rescue LoadError
|
8
|
+
puts 'this example depends on the citeproc-ruby and csl-styles gems'
|
9
|
+
exit
|
10
|
+
end
|
4
11
|
|
5
12
|
# Open a bibliography file
|
6
13
|
bib = BibTeX.open File.expand_path('../markdown.bib',__FILE__),
|
7
14
|
:include => [:meta_content]
|
8
15
|
|
9
|
-
|
10
16
|
# Replaces all strings in the Bibliography and then
|
11
17
|
# converts each BibTeX entries to a string using Chicago style
|
12
18
|
# (all other elements are mapped to simple strings)
|
19
|
+
bib.replace
|
13
20
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
exit
|
19
|
-
end
|
21
|
+
cp = CiteProc::Processor.new :style => 'apa',
|
22
|
+
:format => 'html', :locale => 'en'
|
23
|
+
|
24
|
+
cp.import bib.to_citeproc
|
20
25
|
|
21
|
-
content = bib
|
22
|
-
if
|
23
|
-
|
26
|
+
content = bib['@entry, @meta_content'].map do |e|
|
27
|
+
if e.entry?
|
28
|
+
cp.render :bibliography, :id => e.key
|
24
29
|
else
|
25
|
-
|
30
|
+
e.to_s
|
26
31
|
end
|
27
32
|
end
|
28
33
|
|
data/examples/markdown.bib
CHANGED
@@ -2,7 +2,7 @@ Bibliography
|
|
2
2
|
============
|
3
3
|
|
4
4
|
Here is a little bibliography to illustrate how *BibTeX* and
|
5
|
-
*Markdown* can be seamlessly integrated. This is a _valid_
|
5
|
+
*Markdown* can be seamlessly integrated. This is a _valid_ BibTeX
|
6
6
|
File; at the same time its comments are written using Markdown
|
7
7
|
markup. For example, this is a list:
|
8
8
|
|
data/lib/bibtex.rb
CHANGED
data/lib/bibtex/error.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
module BibTeX
|
2
2
|
|
3
|
-
class BibTeXError < StandardError
|
4
|
-
attr_reader :
|
5
|
-
|
3
|
+
class BibTeXError < StandardError
|
4
|
+
attr_reader :original
|
5
|
+
|
6
6
|
def initialize(message = nil, original = $!)
|
7
7
|
super(message)
|
8
8
|
@original = original
|
9
9
|
end
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
class ParseError < BibTeXError; end
|
13
13
|
class ArgumentError < BibTeXError; end
|
14
14
|
|
@@ -16,29 +16,29 @@ module BibTeX
|
|
16
16
|
# Represents a lexical or syntactical error.
|
17
17
|
#
|
18
18
|
class Error < Element
|
19
|
-
|
19
|
+
|
20
20
|
attr_reader :trace
|
21
|
-
|
21
|
+
|
22
22
|
def initialize(trace=[])
|
23
23
|
@trace = trace
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
def trace=(trace)
|
27
27
|
raise(ArgumentError, "BibTeX::Error trace must be of type Array; was: #{trace.class.name}.") unless trace.kind_of?(Array)
|
28
28
|
@trace = trace
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
def content
|
32
32
|
@trace.map { |e| e[1] }.join
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
# Called when the element was added to a bibliography.
|
36
36
|
def added_to_bibliography(bibliography)
|
37
37
|
super(bibliography)
|
38
38
|
bibliography.errors << self
|
39
39
|
self
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
# Called when the element was removed from a bibliography.
|
43
43
|
def removed_from_bibliography(bibliography)
|
44
44
|
super(bibliography)
|
@@ -46,4 +46,4 @@ module BibTeX
|
|
46
46
|
self
|
47
47
|
end
|
48
48
|
end
|
49
|
-
end
|
49
|
+
end
|
data/lib/bibtex/version.rb
CHANGED
data/test/test_bibtex.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bibtex-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvester Keil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: latex-decode
|