traject_plus 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c18d033097eab64e2209c9762873526fda99fd42254782e83206fba4ab779890
4
- data.tar.gz: feb3cfd62ff34bf7ad9060de0f8810f64e21accc9f67c7701c4cff448b88af25
3
+ metadata.gz: d0bc939203fafce05e06266e0097c402acb732d565fcb5f0bc22f28a47c30a40
4
+ data.tar.gz: 3eff7af52a93c94ea62c351bfd37cbefbd8389a62cfbc345c591739d39d1b94b
5
5
  SHA512:
6
- metadata.gz: ec13570bb0385d5d3c713ef59b690dccea7dfb642bcf6c36b4326182897ea9fe7ad66c6b072acc77c1eecf2ae74d86f26ef1b6768b1748da0113ee17813f18b1
7
- data.tar.gz: c5c8b80aff3d829bedde2e05b6cf3e57dbc52f4e3828415492ebbb0f6182081dbd8c0bbd4e608e5f076aa97a62f635a0d9ebb4956161c5617716e88008fce470
6
+ metadata.gz: a2bf12720706f3f456837b4cbcc7d0d958ae7cdb0e072671d32a5e947b17b2947c37a74b9aee7201d64c6208d9258c8d586207a2c7eb547bfe2f46e783950ebb
7
+ data.tar.gz: 924dbc06a905607d9da40ab5bb92f65d16edcd217f835b3e8630b1390c9c9420ac3ac92e7134e1fb820b7a3d199adda6a9a1dc474e033ff38586ddacb4297596
@@ -61,8 +61,13 @@ module TrajectPlus
61
61
  accumulator << context.source_record
62
62
  end
63
63
 
64
- accumulator.map do |record|
65
- new_context = Traject::Indexer::Context.new(source_record: record, settings: indexer.settings)
64
+ accumulator.each_with_index.map do |record, index|
65
+ new_context = Traject::Indexer::Context.new(
66
+ source_record: record,
67
+ settings: indexer.settings,
68
+ position: index,
69
+ position_in_input: index
70
+ )
66
71
  new_context.clipboard[:parent] = context
67
72
  indexer.map_to_context!(new_context)
68
73
  result = new_context.output_hash
@@ -6,9 +6,13 @@ module TrajectPlus
6
6
  module FGDC
7
7
  NS = { fgdc: 'http://www.fgdc.gov/metadata/fgdc-std-001-1998.dtd' }.freeze
8
8
 
9
+ def self.extended(mod)
10
+ mod.extended Traject::Macros::NokogiriMacros
11
+ end
12
+
9
13
  # @param xpath [String] the xpath query expression
10
- def extract_fgdc(xpath, options = {})
11
- extract_xml(xpath, NS, options)
14
+ def extract_fgdc(xpath)
15
+ extract_xpath(xpath, ns: NS)
12
16
  end
13
17
  end
14
18
  end
@@ -9,9 +9,13 @@ module TrajectPlus
9
9
  dc: 'http://purl.org/dc/elements/1.1/',
10
10
  xlink: 'http://www.w3.org/1999/xlink' }.freeze
11
11
 
12
+ def self.extended(mod)
13
+ mod.extended Traject::Macros::NokogiriMacros
14
+ end
15
+
12
16
  # @param xpath [String] the xpath query expression
13
- def extract_mods(xpath, options = {})
14
- extract_xml(xpath, NS, options)
17
+ def extract_mods(xpath)
18
+ extract_xpath(xpath, NS)
15
19
  end
16
20
  end
17
21
  end
@@ -5,9 +5,13 @@ module TrajectPlus
5
5
  module Tei
6
6
  NS = { tei: 'http://www.tei-c.org/ns/1.0' }.freeze
7
7
 
8
+ def self.extended(mod)
9
+ mod.extended Traject::Macros::NokogiriMacros
10
+ end
11
+
8
12
  # @param xpath [String] the xpath query expression
9
- def extract_tei(xpath, options = {})
10
- extract_xml(xpath, NS, options)
13
+ def extract_tei(xpath)
14
+ extract_xpath(xpath, ns: NS)
11
15
  end
12
16
  end
13
17
  end
@@ -8,6 +8,8 @@ module TrajectPlus
8
8
  # @param namespaces [Hash<String,String>] The namespaces for the xpath query
9
9
  # @param options [Hash] other options, may include :trim
10
10
  def extract_xml(xpath, namespaces, options = {})
11
+ Deprecation.warn(self, "extract_xml is deprecated and will be removed in the next major release. Use the Traject 3 pipeline instead")
12
+
11
13
  lambda do |xml, accumulator, _context|
12
14
  result = xml.xpath(xpath, namespaces).map(&:text)
13
15
  unless options.empty?
@@ -1,3 +1,3 @@
1
1
  module TrajectPlus
2
- VERSION = "1.1.1".freeze
2
+ VERSION = "1.2.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: traject_plus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2019-03-12 00:00:00.000000000 Z
14
+ date: 2019-09-19 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
@@ -178,8 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
178
178
  - !ruby/object:Gem::Version
179
179
  version: '0'
180
180
  requirements: []
181
- rubyforge_project:
182
- rubygems_version: 2.7.6
181
+ rubygems_version: 3.0.3
183
182
  signing_key:
184
183
  specification_version: 4
185
184
  summary: Extensions to Traject for non-MARC formats