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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8dfc396ec0cd2efd0f5f64425c8e9ffd767da58c
4
- data.tar.gz: 857697705ed8d3cf337beba83c088808cb88bb61
3
+ metadata.gz: 733bd2d0bdfc1dc2fa6d90cd2ca46f796edfda98
4
+ data.tar.gz: e995ff535722aa2a2f8b9b6e76873d707ca064e0
5
5
  SHA512:
6
- metadata.gz: 111bf7910b6e38a5aeb40ad2d128fe06d5ee992e1ea64fb1503c445b63256b714fe6ef6fd9a43ac9ad4e4bb28d7677ad82d711c6ee723efff2457a9cae569b62
7
- data.tar.gz: 538da62b61ae3e58fda93839ad712c95ef949552be07157a66e712f58e8faa1d58538e977019ec202df69aace8beda7d5689bd966fe888665c59c0fd41894263
6
+ metadata.gz: 4762b7453c5e38974a6f2a2a87d967be023ad3435e6e093a026b12cd7c871ce612b47a28f92ff418e08d11673c5c3e007497f707aa8c4dc1611fabf9c6e4da62
7
+ data.tar.gz: f7e1b284e83248ea73619fcd7dd68b15dc2c2da9ef46344f8edf4e3229ffcdca5eab56997ef97ab12f5e93c1efd0794802e05efbd6c15ff6e72ca75ee2e8e351
@@ -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
- begin
15
- require 'citeproc'
16
- rescue LoadError
17
- puts 'this example depends on the citeproc-ruby gem'
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.replace.q('@entry, @meta_content').map do |b|
22
- if b.entry?
23
- CiteProc.process b.to_citeproc
26
+ content = bib['@entry, @meta_content'].map do |e|
27
+ if e.entry?
28
+ cp.render :bibliography, :id => e.key
24
29
  else
25
- b.to_s
30
+ e.to_s
26
31
  end
27
32
  end
28
33
 
@@ -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_ BibTex
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
 
@@ -46,7 +46,7 @@ module BibTeX
46
46
  @log.datetime_format = '%Y-%m-%d %H:%M:%S'
47
47
 
48
48
  class << self
49
- attr_reader :log
49
+ attr_accessor :log
50
50
  end
51
51
 
52
52
  end
@@ -1,14 +1,14 @@
1
1
  module BibTeX
2
2
 
3
- class BibTeXError < StandardError
4
- attr_reader :orginal
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
@@ -20,7 +20,7 @@ module BibTeX
20
20
  module Version
21
21
  MAJOR = 4
22
22
  MINOR = 0
23
- PATCH = 4
23
+ PATCH = 5
24
24
  BUILD = nil
25
25
 
26
26
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.').freeze
@@ -96,6 +96,12 @@ module BibTeX
96
96
  bib.replace_strings
97
97
  assert_equal 'The Pragmatic Bookshelf', bib['rails'].publisher
98
98
  end
99
+
100
+ def test_logger_can_be_assigned
101
+ logger = BibTeX.log
102
+ BibTeX.log = logger
103
+ end
104
+
99
105
  end
100
106
 
101
107
  end
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
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-10-10 00:00:00.000000000 Z
11
+ date: 2014-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: latex-decode