asciichem 0.31.9 → 0.31.11

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
  SHA256:
3
- metadata.gz: d7194547758cae2517a4d29d5634aeace9e59719ebcd0abe69fa81fa6231ac2b
4
- data.tar.gz: dad6e2ed3656bb659254f99c7529024ce15b4cccc4c4aaee1cf1c8b28c9aeb29
3
+ metadata.gz: 0c34f02af4a10568830f6c8b7eec3c81e9d3b3477940c10e60b9f3d0c67a1c43
4
+ data.tar.gz: 925739226d852f4f9f014fece5d97867f2447122c7d604e569b4b7369b3751b2
5
5
  SHA512:
6
- metadata.gz: 982ee670a6b1a8c9ed8ebba7f519ed7ebb4eedac0814d31da6223eb0d8f02d29717c357e28d8f4ba6775ab861ceb3d05c6f94bf2da55881e60346d7e1d45307f
7
- data.tar.gz: 18654cd74751d55d516e6ab7fe4b39f25cd8a733f7d3023505a916b1d24e7a335a4746a8df29278d10304584bc990dc961c2f00a4a324df3facd1b313ea43228
6
+ metadata.gz: dced2b7d4bccf54c4ab258c6024bb8732bb1e5d5c4241eabc1a041117aa13252ccc67b01890e22f8f784d96152d5afb4d4e7ecbfc701dad50d953701213dc872
7
+ data.tar.gz: 0c963559e1116042a17a1434c6d56949de632dc1d744e44a66bc3d5b3dde3394baa3818b73c9f231aeefdbf01fe0db46d557ae19bd4de8137d912fea6d285e49
data/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to AsciiChem are documented here.
4
4
  This project follows [Semantic Versioning](https://semver.org/).
5
5
 
6
+ ## [0.31.11] - 2026-11-10
7
+
8
+ ### Added
9
+ - Dataset bibitems carry the resolver provenance as a
10
+ `type="provenance"` note: retrieval source (and version, when
11
+ recorded) plus the source's required attribution — CAS Common
12
+ Chemistry results now carry the CC BY-NC 4.0 terms into the
13
+ rendered document. `Provenance#note_text` renders the record; the
14
+ note is suppressed when it would duplicate publisher/docidentifier.
15
+ The Metanorma plugin and `asciichem cite` inherit it through the
16
+ shared Citation path.
17
+
18
+ ## [0.31.10] - 2026-11-05
19
+
20
+ ### Changed
21
+ - The native engine binding points at the renamed **chemomer** crate
22
+ (chemomer/chemomer): the dylib is `libchemomer.dylib` with
23
+ `chemomer_*` symbols and `CHEMOMER_LIB` replaces `INCHI_RS_LIB`.
24
+ Same contract, new spelling.
25
+ - moxml is pinned to the 0.6 line from 0.6.1 (resolves to 0.6.2);
26
+ the full suite runs green against it.
27
+
6
28
  ## [0.31.9] - 2026-10-24
7
29
 
8
30
  ### Added
@@ -108,7 +108,8 @@ module AsciiChem
108
108
  private
109
109
 
110
110
  # The version-independent field payload: one hash describing the
111
- # citation, translated to Relaton objects by RelatonApi.
111
+ # citation, translated to Relaton objects by RelatonApi. The
112
+ # provenance record travels as `notes` (Provenance#note_text).
112
113
  def fields(substance, profile, provenance)
113
114
  publisher = profile.publisher || provenance.source
114
115
  {
@@ -119,7 +120,8 @@ module AsciiChem
119
120
  publisher: publisher,
120
121
  accessed_on: accessed_on(provenance),
121
122
  link: profile.link_for.call(substance),
122
- keywords: substance.identifiers.map { |i| "#{i.convention}=#{i.value}" }
123
+ keywords: substance.identifiers.map { |i| "#{i.convention}=#{i.value}" },
124
+ notes: [provenance.note_text].compact
123
125
  }
124
126
  end
125
127
 
@@ -203,11 +205,23 @@ module AsciiChem
203
205
  docidentifier: [docidentifier(fields[:docid])],
204
206
  contributor: [contributor(fields[:publisher])],
205
207
  date: [Relaton::Bib::Date.new(type: 'accessed', at: fields[:accessed_on])],
206
- source: fields[:link] ? [Relaton::Bib::Uri.new(type: 'src', content: fields[:link])] : [],
207
- keyword: fields[:keywords].map { |text| keyword(text) }
208
+ source: links(fields),
209
+ keyword: fields[:keywords].map { |text| keyword(text) },
210
+ note: notes(fields)
208
211
  )
209
212
  end
210
213
 
214
+ def links(fields)
215
+ fields[:link] ? [Relaton::Bib::Uri.new(type: 'src', content: fields[:link])] : []
216
+ end
217
+
218
+ # The provenance record as a bibliographic note (TODO.v2
219
+ # item 3): retrieval source/version and the source's required
220
+ # attribution — licence terms must survive into the document.
221
+ def notes(fields)
222
+ fields[:notes].map { |text| Relaton::Bib::Note.new(type: 'provenance', content: text) }
223
+ end
224
+
211
225
  def docidentifier(docid)
212
226
  Relaton::Bib::Docidentifier.new(type: docid[:type], content: docid[:id])
213
227
  end
@@ -44,7 +44,9 @@ module AsciiChem
44
44
  def call(molfile, function)
45
45
  binding_class = self.class.binding_class(@lib)
46
46
  pointer = binding_class.public_send(function, molfile)
47
- unless pointer
47
+ # An FFI null return is a TRUTHY pointer object — `unless pointer`
48
+ # never fires; nil?/null? is the only correct emptiness test.
49
+ if pointer.nil? || pointer.null?
48
50
  message = binding_class.last_error
49
51
  raise AsciiChem::Error, "chemomer native engine: #{message || 'call failed'}"
50
52
  end
@@ -5,7 +5,19 @@ module AsciiChem
5
5
  # Domain value objects for resolution results. These are data
6
6
  # carriers; (de)serialization to the canonical wire form goes
7
7
  # through the lutaml-model Wire classes only.
8
- Provenance = Struct.new(:source, :retrieved_at, :source_version, :attribution, keyword_init: true)
8
+ Provenance = Struct.new(:source, :retrieved_at, :source_version, :attribution, keyword_init: true) do
9
+ # The provenance record as one sentence (the citation track's
10
+ # bibitem note): retrieval source and version plus the source's
11
+ # required attribution — licence terms (CAS Common Chemistry is
12
+ # CC BY-NC 4.0) must survive into the rendered document. Nil
13
+ # when there is nothing beyond the source name itself.
14
+ def note_text
15
+ details = [source_version && "version #{source_version}", attribution].compact
16
+ return nil if details.empty?
17
+
18
+ "Retrieved from #{source}; #{details.join('; ')}"
19
+ end
20
+ end
9
21
  Identifier = Struct.new(:value, :convention, :provenance, keyword_init: true)
10
22
  Property = Struct.new(:name, :value, :units, :provenance, keyword_init: true)
11
23
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AsciiChem
4
- VERSION = "0.31.9"
4
+ VERSION = "0.31.11"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciichem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.31.9
4
+ version: 0.31.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.