asciichem 0.31.11 → 0.31.12

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: 0c34f02af4a10568830f6c8b7eec3c81e9d3b3477940c10e60b9f3d0c67a1c43
4
- data.tar.gz: 925739226d852f4f9f014fece5d97867f2447122c7d604e569b4b7369b3751b2
3
+ metadata.gz: 02ee049d5ed6b808972e18f4ecf7bbf6723b39b8ba7a6342c38a06cd24b3673a
4
+ data.tar.gz: d455c3156215f27e7509fa610769b573a6bb0e6592097f7c4c67357738095e1d
5
5
  SHA512:
6
- metadata.gz: dced2b7d4bccf54c4ab258c6024bb8732bb1e5d5c4241eabc1a041117aa13252ccc67b01890e22f8f784d96152d5afb4d4e7ecbfc701dad50d953701213dc872
7
- data.tar.gz: 0c963559e1116042a17a1434c6d56949de632dc1d744e44a66bc3d5b3dde3394baa3818b73c9f231aeefdbf01fe0db46d557ae19bd4de8137d912fea6d285e49
6
+ metadata.gz: e83e9ce16a0ed8a1b22491c1964d15fc906467c152a5afec383ce4774d073beb591d8011a481216033855abc76e7f3febd377437f8808a6c1620448e17c60539
7
+ data.tar.gz: caeddc2cb2db07543e3ca9b49932a9ed2a0f68461f2f20eb7c6693914d9bf185b8c44cd7f27e5b2d107e0c9cf7ff704bf63a261180f5b6b112e0d2cc8326b28c
data/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
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.12] - 2026-11-11
7
+
8
+ ### Changed
9
+ - CAS Common Chemistry resolves by default (maintainer decision:
10
+ CC BY-NC 4.0 acceptable on by default). The adapter self-registers
11
+ like the other sources; every result still carries the required
12
+ attribution. `Citation.for_molecule` accepts a `sources:`
13
+ allow-list so callers can keep resolution NC-free — the
14
+ metanorma plugin exposes it as the `asciichem-sources` document
15
+ attribute.
16
+
6
17
  ## [0.31.11] - 2026-11-10
7
18
 
8
19
  ### Added
data/README.adoc CHANGED
@@ -60,7 +60,7 @@ a level without the green corpus run behind it does not ship.
60
60
  |L1 semantics |yes |wire form validates against the v1 schemas and round-trips; the perception pass (implicit hydrogens, aromatic rings) is corpus-gated
61
61
  |L2 render |yes |MathML byte-goldens, canonical text, and the wire form for every construct
62
62
  |L3 stereo |yes |tetrahedral chirality, directional bonds, wedge/hash; parity-correct canonical SMILES including ring closures
63
- |L4 identity |partial |opt-in InChI engine with stereo layers, OPSIN adapter, identifier cross-check, citation bibitems; CAS source decision pending
63
+ |L4 identity |yes |opt-in InChI engine (binary or native) with stereo layers, OPSIN adapter, identifier cross-check, resolver (PubChem, OPSIN, and Common Chemistry on by default — CC BY-NC attribution carried everywhere; limit sources with `Resolver.resolve(sources:)`), citation bibitems
64
64
  |===
65
65
 
66
66
  TypeScript and Python claim the same levels they pass; see their
@@ -84,9 +84,15 @@ module AsciiChem
84
84
  #
85
85
  # AsciiChem.parse('H_2O @name("water") @cite("pubchem")')
86
86
  # AsciiChem::Citation.for_molecule(formula.nodes.first).map(&:last)
87
- def for_molecule(molecule, cache: nil, fetch: nil)
88
- sources = citation_sources(molecule)
89
- return [] if sources.empty?
87
+ #
88
+ # `sources:` limits the citable set (an allow-list): cited
89
+ # sources outside it are skipped — the document pipeline (the
90
+ # metanorma plugin's `asciichem-sources` attribute) warns about
91
+ # the exclusions; the gem stays silent and total.
92
+ def for_molecule(molecule, cache: nil, fetch: nil, sources: nil)
93
+ citable = citation_sources(molecule)
94
+ citable &= Array(sources).map(&:to_s) if sources
95
+ return [] if citable.empty?
90
96
 
91
97
  convention, value = lookup_key(molecule)
92
98
  unless value
@@ -95,7 +101,7 @@ module AsciiChem
95
101
  '(annotate @cas/@inchikey/@smiles or @name)'
96
102
  end
97
103
 
98
- sources.filter_map do |source|
104
+ citable.filter_map do |source|
99
105
  substance = AsciiChem::Resolver[source].new.resolve(
100
106
  value: value, convention: convention, cache: cache, fetch: fetch
101
107
  )
@@ -7,16 +7,15 @@ module AsciiChem
7
7
  module Resolver
8
8
  # CAS Common Chemistry source adapter (TODO.impl 40; TODO.v2 07).
9
9
  #
10
- # License posture (maintainer sign-off 2026-09-13): Common
11
- # Chemistry data is CC BY-NC 4.0 — this adapter is OPT-IN and never
12
- # self-registers; users register it explicitly:
13
- #
14
- # AsciiChem::Resolver.register(:common_chemistry,
15
- # AsciiChem::Resolver::CommonChemistry)
16
- #
17
- # Every result carries the required attribution.
10
+ # License posture (maintainer decision 2026-11-11): Common
11
+ # Chemistry data is CC BY-NC 4.0 — acceptable to enable by
12
+ # default; every result carries the required attribution, and the
13
+ # citation track carries it into rendered documents. Documents
14
+ # that must stay NC-free limit sources with the
15
+ # `asciichem-sources` attribute (metanorma-plugin-asciichem) or
16
+ # `Resolver.resolve(sources:)`.
18
17
  class CommonChemistry < Adapter
19
- source_name :common_chemistry, register: false
18
+ source_name :common_chemistry
20
19
  supports "cas"
21
20
 
22
21
  BASE = "https://commonchemistry.cas.org/api/detail"
@@ -9,10 +9,13 @@ module AsciiChem
9
9
  # citation track (TODO.v2 08) emits one bibitem per (substance,
10
10
  # source) the user chooses to cite.
11
11
  #
12
- # Sources are opt-in adapters that self-register (OCP, same pattern
13
- # as the linter checks). NC-licensed sources are never registered by
14
- # default — Common Chemistry ships only after the maintainer
15
- # sign-off recorded in TODO.v2 07.
12
+ # Sources are adapters that self-register (OCP, same pattern
13
+ # as the linter checks). All shipped sources are on by default;
14
+ # every result carries its source's required attribution (Common
15
+ # Chemistry: CC BY-NC 4.0 — default-on per the maintainer decision
16
+ # of 2026-11-11). Callers limit the set explicitly:
17
+ # `Resolver.resolve(sources:)` or the metanorma plugin's
18
+ # `asciichem-sources` attribute for NC-free documents.
16
19
  module Resolver
17
20
  autoload :Adapter, "asciichem/resolver/adapter"
18
21
  autoload :Cache, "asciichem/resolver/cache"
@@ -71,9 +74,10 @@ module AsciiChem
71
74
  end
72
75
  end
73
76
 
74
- # Open, permissive sources register eagerly. CommonChemistry is
75
- # CC BY-NC 4.0: it loads (autoload) but never self-registers —
76
- # users opt in explicitly via Resolver.register.
77
+ # Every shipped source self-registers eagerly (autoload fires the
78
+ # class bodies). CommonChemistry is CC BY-NC 4.0 and default-on
79
+ # per the maintainer decision of 2026-11-11; callers that need
80
+ # NC-free resolution limit sources explicitly.
77
81
  adapters
78
82
  constants.each { |c| const_get(c) unless c == :Conflict }
79
83
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AsciiChem
4
- VERSION = "0.31.11"
4
+ VERSION = "0.31.12"
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.11
4
+ version: 0.31.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.