asciichem 0.5.0 → 0.5.1

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: 9d87f933cf6baef0a8a1f5c8e189948ba3a2f49ea9adea77b5af22854e2ccb1c
4
- data.tar.gz: afb6ab79bf85415caa65fe9315a7cbc76913562cb969aa5e5947a6c7eaede38b
3
+ metadata.gz: 1edf476bb3d979641172de761d1b2ac906cb4eaf8565e56b0e083e146c09eb1d
4
+ data.tar.gz: b3394a0709a475df222d6369eac92a1cc6d02fc756a7d3a45ca038c5d6f5155c
5
5
  SHA512:
6
- metadata.gz: 912c55ba11516ed11b613ac538ee6c90d792f95b86b3337d1348e04bf50531c5f08bead8e1781155dea56b8a8cfdd66506e885ccbac713b5384acb9e982f52c2
7
- data.tar.gz: c044eecacf93ae9c80a8f6ddebc66f8be38820b8157a6410d20f9bfc60428ea7377e39e8271343b4645bffa371dd67b179d3f74183c754778f0fd333984afc0a
6
+ metadata.gz: 5a1ce9a990e507a6f70c91939841766e228b02ae674af39c5fa356b4911f20d0ef3b5aa2f2ec4799663d21da54752ed9b68c6660db23e1b2da9cacd4cc50b2ad
7
+ data.tar.gz: 6d68778aca7042fce958026033e990e51b87290c24ed3028cf224aa34bd5e03418ef6209b72072d06a14ab3352e2d20290c939b4002a82fdcdbe5c267a17d087
@@ -245,9 +245,40 @@ module AsciiChem
245
245
  TopLevelHandler.new(
246
246
  node_class: AsciiChem::Model::Text,
247
247
  element_name: 'text',
248
- # Text formatter emits `"content"` (with quotes). Re-parsing
249
- # that yields the original Text node — round-trip-safe by
250
- # construction.
248
+ serialize: ->(node) { text_render(node) },
249
+ deserialize: ->(content) { AsciiChem.parse(content).nodes.first }
250
+ ),
251
+ # -- beyond-formulas constructs (Phase 1-5) -------------------
252
+ # Each carries its text representation inside an aci: element.
253
+ # On parse, the text is re-parsed to rebuild the construct.
254
+ # DRY: all five share the same serialize/deserialize pattern.
255
+ TopLevelHandler.new(
256
+ node_class: AsciiChem::Model::Crystal,
257
+ element_name: 'crystal',
258
+ serialize: ->(node) { text_render(node) },
259
+ deserialize: ->(content) { AsciiChem.parse(content).nodes.first }
260
+ ),
261
+ TopLevelHandler.new(
262
+ node_class: AsciiChem::Model::Spectrum,
263
+ element_name: 'spectrum',
264
+ serialize: ->(node) { text_render(node) },
265
+ deserialize: ->(content) { AsciiChem.parse(content).nodes.first }
266
+ ),
267
+ TopLevelHandler.new(
268
+ node_class: AsciiChem::Model::Calculation,
269
+ element_name: 'calculation',
270
+ serialize: ->(node) { text_render(node) },
271
+ deserialize: ->(content) { AsciiChem.parse(content).nodes.first }
272
+ ),
273
+ TopLevelHandler.new(
274
+ node_class: AsciiChem::Model::ZMatrix,
275
+ element_name: 'zmatrix',
276
+ serialize: ->(node) { text_render(node) },
277
+ deserialize: ->(content) { AsciiChem.parse(content).nodes.first }
278
+ ),
279
+ TopLevelHandler.new(
280
+ node_class: AsciiChem::Model::Mechanism,
281
+ element_name: 'mechanism',
251
282
  serialize: ->(node) { text_render(node) },
252
283
  deserialize: ->(content) { AsciiChem.parse(content).nodes.first }
253
284
  )
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AsciiChem
4
- VERSION = "0.5.0"
4
+ VERSION = "0.5.1"
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.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.