citero 1.0.0.alpha → 1.0.0.alpha2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a420fcb5e2a2984a8075c248070be78ba1523017
4
- data.tar.gz: 8728f7f6805f7713e84e4586606a31f7c5af7bb9
3
+ metadata.gz: 50f0b73776691252a7f3bfc0ee4aaca8a2db0a38
4
+ data.tar.gz: 952b09dba40b178bb5f6dd88eafc9f16f5c95a13
5
5
  SHA512:
6
- metadata.gz: 0c5fd7a6553dd5be250cbf512f5f9fca8e5ac5c6c60d184797913992d9cc4cdb49fba005bdc1b25f37de2aae93f43391544d1abbec917a8c416ce4190ccff599
7
- data.tar.gz: b8663ea856531cc639cda15902992d0caeb7b2a6855be5595a72607a939d5ba21fad9909677ec4fcf047dbccc0f293624713151768d3539cb387af516f2515f2
6
+ metadata.gz: aaecd9a89c67cbedec54da979d8510629649dae12dc92569c09ee6a0057217b463129aca6e357edcfe72ee87e0aa50cce6dae44bdeef28a0f1d3549457a3a452
7
+ data.tar.gz: 237304a7c1c66cef113c5e06d3d739448670c2f5795eba98e293c4116ed9afd5e92d21277579980f82c6b8da5db046c6f606db16af53532af8e2c674885ce173
@@ -46,6 +46,7 @@ module Citero
46
46
 
47
47
  def self.to_(format)
48
48
  @to_format = format.to_sym
49
+ return @input if @from_format.eql?(@to_format)
49
50
 
50
51
  case @from_format
51
52
  when :csf
@@ -74,6 +75,7 @@ module Citero
74
75
  when :csf
75
76
  str = ""
76
77
  from.csf.each do |k,v|
78
+ next if v.nil?
77
79
  if v.kind_of?(Array)
78
80
  v.each do |va|
79
81
  str = "#{str}#{k}: #{va.gsub('.','\.').gsub(',','\,')}\n"
@@ -22,8 +22,10 @@ module Citero
22
22
  end
23
23
 
24
24
  private
25
- def element_or_list(new_value, old_value)
26
- temp_arr = [new_value, old_value].flatten.compact
25
+ def element_or_list(old_value, new_value)
26
+ return old_value if new_value.nil?
27
+ temp_arr = [old_value, new_value].flatten.compact
28
+ return nil if temp_arr.empty?
27
29
  return temp_arr.first if temp_arr.size == 1
28
30
  return temp_arr
29
31
  end
@@ -122,7 +122,9 @@ module Citero
122
122
  end
123
123
 
124
124
  def get_all_values_from_pnx(path)
125
- @data.locate(path).flatten.collect(&:text)
125
+ return_val = @data.locate(path).flatten.collect(&:text)
126
+ return if return_val.nil?
127
+ return_val
126
128
  end
127
129
 
128
130
  def method_missing(method_sym, *arguments, &block)
@@ -29,7 +29,7 @@ module Citero
29
29
  start << publicationTitle
30
30
  start << pages
31
31
  start << webpage
32
- start.compact.join(",\n\t")
32
+ start.compact.join(",\n")
33
33
  end
34
34
 
35
35
  def publisher
@@ -85,7 +85,10 @@ module Citero
85
85
  end
86
86
 
87
87
  def add_to_bibtex_output(key,value)
88
- return if value.nil? || !value.class.eql?(Array) && value.strip.empty?
88
+ return if value.nil?
89
+ return if value.class.eql?(String) && value.strip.empty?
90
+ return if value.class.eql?(Array) && value.empty?
91
+ return if value.class.eql?(Hash) && value.empty?
89
92
  value = value.join(', ') if value.class.eql?(Array)
90
93
  output = "#{key} = "
91
94
  value = "{#{value}}" unless expects_number_value?(key,value)
@@ -1,3 +1,3 @@
1
1
  module Citero
2
- VERSION = "1.0.0.alpha"
2
+ VERSION = "1.0.0.alpha2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: citero
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.alpha
4
+ version: 1.0.0.alpha2
5
5
  platform: ruby
6
6
  authors:
7
7
  - hab278