Skip to content

Commit

Permalink
make sure publication_year is shown in citeproc, schema_org, codemeta…
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Jul 11, 2020
1 parent 18b8c0d commit 0706dbd
Show file tree
Hide file tree
Showing 15 changed files with 267 additions and 19 deletions.
24 changes: 12 additions & 12 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
bolognese (1.6.11)
bolognese (1.6.12)
activesupport (>= 4.2.5)
benchmark_methods (~> 0.7)
bibtex-ruby (>= 5.1.0)
Expand All @@ -11,13 +11,13 @@ PATH
concurrent-ruby (~> 1.1, >= 1.1.5)
csl-styles (~> 1.0, >= 1.0.1.8)
edtf (~> 3.0, >= 3.0.4)
faraday (= 0.17.0)
faraday (~> 0.17.3)
gender_detector (~> 0.1.2)
iso8601 (~> 0.9.1)
json-ld (~> 3.1, >= 3.1.4)
jsonlint (~> 0.3.0)
loofah (~> 2.0, >= 2.0.3)
maremma (>= 4.3, < 5)
maremma (>= 4.7, < 5)
namae (~> 1.0)
nokogiri (~> 1.10.4)
oj (~> 3.10)
Expand Down Expand Up @@ -64,11 +64,11 @@ GEM
edtf (3.0.5)
activesupport (>= 3.0, < 7.0)
excon (0.71.1)
faraday (0.17.0)
faraday (0.17.3)
multipart-post (>= 1.2, < 3)
faraday-encoding (0.0.5)
faraday
faraday_middleware (0.13.1)
faraday_middleware (0.14.0)
faraday (>= 0.7.4, < 1.0)
gender_detector (0.1.2)
unicode_utils (>= 1.3.0)
Expand Down Expand Up @@ -98,23 +98,23 @@ GEM
loofah (2.6.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
maremma (4.7)
maremma (4.7.1)
activesupport (>= 4.2.5)
addressable (>= 2.3.6)
builder (~> 3.2, >= 3.2.2)
excon (~> 0.71.0)
faraday (= 0.17.0)
faraday (~> 0.17.3)
faraday-encoding (~> 0.0.4)
faraday_middleware (~> 0.13.1)
faraday_middleware (~> 0.14.0)
nokogiri (~> 1.10.4)
oj (>= 2.8.3)
oj_mimic_json (~> 1.0, >= 1.0.1)
mini_portile2 (2.4.0)
minitest (5.14.1)
multi_json (1.14.1)
multi_json (1.15.0)
multipart-post (2.1.1)
namae (1.0.1)
nokogiri (1.10.9)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
oj (3.10.6)
oj_mimic_json (1.0.1)
Expand All @@ -133,7 +133,7 @@ GEM
link_header (~> 0.0, >= 0.0.8)
rdf-aggregate-repo (3.1.0)
rdf (~> 3.1)
rdf-rdfa (3.1.1)
rdf-rdfa (3.1.2)
haml (~> 5.1)
htmlentities (~> 4.3)
rdf (~> 3.1, >= 3.1.2)
Expand All @@ -148,7 +148,7 @@ GEM
rdf-turtle (3.1.1)
ebnf (~> 1.2)
rdf (~> 3.1, >= 3.1.2)
rdf-vocab (3.1.5)
rdf-vocab (3.1.7)
rdf (~> 3.1, >= 3.1.2)
rdf-xsd (3.1.0)
rdf (~> 3.1)
Expand Down
4 changes: 2 additions & 2 deletions bolognese.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Gem::Specification.new do |s|
s.required_ruby_version = '~> 2.3'

# Declare dependencies here, rather than in the Gemfile
s.add_dependency 'maremma', '>= 4.3', '< 5'
s.add_dependency 'faraday', "0.17.0"
s.add_dependency 'maremma', '>= 4.7', '< 5'
s.add_dependency 'faraday', '~> 0.17.3'
s.add_dependency 'nokogiri', '~> 1.10.4'
s.add_dependency 'loofah', '~> 2.0', '>= 2.0.3'
s.add_dependency 'builder', '~> 3.2', '>= 3.2.2'
Expand Down
2 changes: 1 addition & 1 deletion lib/bolognese/metadata_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def citeproc_hsh
"language" => language,
"author" => author,
"contributor" => to_citeproc(contributors),
"issued" => get_date(dates, "Issued") ? get_date_parts(get_date(dates, "Issued")) : nil,
"issued" => get_date(dates, "Issued") ? get_date_parts(get_date(dates, "Issued")) : get_date_parts(publication_year),
"submitted" => Array.wrap(dates).find { |d| d["dateType"] == "Submitted" }.to_h.fetch("__content__", nil),
"abstract" => parse_attributes(descriptions, content: "description", first: true),
"container-title" => container_title,
Expand Down
2 changes: 1 addition & 1 deletion lib/bolognese/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Bolognese
VERSION = "1.6.11"
VERSION = "1.6.12"
end
2 changes: 1 addition & 1 deletion lib/bolognese/writers/codemeta_writer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def codemeta
"description" => parse_attributes(descriptions, content: "description", first: true),
"version" => version_info,
"tags" => subjects.present? ? Array.wrap(subjects).map { |k| parse_attributes(k, content: "subject", first: true) } : nil,
"datePublished" => get_date(dates, "Issued"),
"datePublished" => get_date(dates, "Issued") || publication_year,
"dateModified" => get_date(dates, "Updated"),
"publisher" => publisher,
"license" => Array.wrap(rights_list).map { |l| l["rightsUri"] }.compact.unwrap,
Expand Down
2 changes: 1 addition & 1 deletion lib/bolognese/writers/jats_writer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def insert_pub_id(xml)
end

def date
get_date_parts(date_published)
get_date(dates, "Issued") ? get_date_parts(get_date(dates, "Issued")) : get_date_parts(publication_year)
end

def publication_type
Expand Down
2 changes: 1 addition & 1 deletion lib/bolognese/writers/schema_org_writer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def schema_hsh
"contentSize" => Array.wrap(sizes).unwrap,
"encodingFormat" => Array.wrap(formats).unwrap,
"dateCreated" => get_date(dates, "Created"),
"datePublished" => get_date(dates, "Issued"),
"datePublished" => get_date(dates, "Issued") || publication_year,
"dateModified" => get_date(dates, "Updated"),
"pageStart" => container.to_h["firstPage"],
"pageEnd" => container.to_h["lastPage"],
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0706dbd

Please sign in to comment.