leptris 1.9.44 → 1.9.45

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: 9895934a1c086857555795905c15ab4f74ef053804e489674192bc7f4cc70bf3
4
- data.tar.gz: b1bf31ac8c0ef5f718d78d4ae0654218cd3c212adf33e75628326949644032d1
3
+ metadata.gz: 6ae716558f8c0fbf9e82152e60af9945a1093a0b11ef7e331b01a0b0e5ae18a8
4
+ data.tar.gz: 86581062b237be45d5e35452634250069899f3ff61823032b39fb1d4202375e0
5
5
  SHA512:
6
- metadata.gz: 536c0b5a7ddb425395b077f5a6a0b40ebc893c6037ba71277a1b6eaa70b9769e977b03b9ed0f81ccf6d9a70e11c4f4095b8ab3e473268f2cb38306ea897d28e4
7
- data.tar.gz: d34c001bf6840c12d3e44a0253166938523f57c0e935a6dfa4560cea575b02af043d25caf0a491a77810726b168c64e556c63b825355eb3ff23ffbbf010848c5
6
+ metadata.gz: 2ae3f6a850ecaa89464ae16168af93ae97cfdc4a80b41b3cb49f6c33ab34ad14ae9d463115b2ab02cfe38f28f92d1024849b2f3f314b1a7fc913027ba9da77b9
7
+ data.tar.gz: 54f820ae1f1b75170d7339107fb24c908d967ad5c5e5fa2b81d9a8e75bc1c8b7da403da2dd2634061dc3069ad7c23df608f9226f18150bd839de578eaeba52c8
data/CHANGELOG.md CHANGED
@@ -5,6 +5,35 @@ All notable changes to Leptris will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.9.45] - 2026-08-31
9
+
10
+ ### Added
11
+
12
+ - **Element-face indent unit (leptris-ruby#109 residual 2)**:
13
+ `Element#to_xml(indent: 2, indent_text: "\t")` — the unit with
14
+ Nokogiri's element semantics, byte-identical to Nokogiri's
15
+ `Element#to_xml` on the same input. No element-level
16
+ ext-serialize entry exists yet, so the path copies the element
17
+ C-side into a fresh document (one pool allocation) and
18
+ serializes through the document ext entry without a declaration.
19
+ `indent_text: true` raises ArgumentError on elements — the
20
+ display form stays document-level. The element default is
21
+ unchanged.
22
+ - **libleptris 1.9.23 lockstep**: XPath 2.0+ expression core
23
+ upstream (if/then/else, for-return, `to` ranges); audit 255/255,
24
+ no new C surface.
25
+
26
+ ### Known issue
27
+
28
+ - **#109 residual 1 (text-bearing leaves lose the unit) is
29
+ engine-side and filed as leptris/leptris#658**: the fused-leaf
30
+ fast path (serialize.c ~1193) computes `indent * indent_spaces`
31
+ directly, bypassing `buffer_append_indent`'s unit branch — every
32
+ mixed-content leaf's line indent falls back to spaces while
33
+ element-only subtrees get the unit. Two-line C fix (route the
34
+ fused lead through the unit); the binding adopts it in the next
35
+ lockstep.
36
+
8
37
  ## [1.9.44] - 2026-08-31
9
38
 
10
39
  ### Added
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ RSpec::Core::RakeTask.new(:spec)
8
8
  # Pin for `rake compile` and the platform-gem builds. Keep in lockstep
9
9
  # with .github/workflows/build.yml (which calls `rake compile`) and the
10
10
  # CHANGELOG when libleptris releases.
11
- LIBLEPTRIS_VERSION = "1.9.22"
11
+ LIBLEPTRIS_VERSION = "1.9.23"
12
12
 
13
13
  CMAKE_FLAGS = %w[
14
14
  -DCMAKE_BUILD_TYPE=Release
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Leptris
4
- VERSION = "1.9.44"
4
+ VERSION = "1.9.45"
5
5
  end
@@ -358,7 +358,18 @@ class Leptris::XML::Element < Leptris::XML::Node
358
358
  end.join
359
359
  end
360
360
 
361
- def to_xml(indent: 0, no_decl: false, encoding: nil)
361
+ # indent_text: a STRING is the indent unit with Nokogiri's
362
+ # semantics (leptris-ruby#109; via a C-side copy into a fresh
363
+ # document — no element-level ext entry exists yet). true is NOT
364
+ # supported here: the display form is document-level.
365
+ def to_xml(indent: 0, no_decl: false, encoding: nil, indent_text: false)
366
+ if indent_text == true
367
+ raise ArgumentError,
368
+ "indent_text: true (display form) is document-level — " \
369
+ "pass the unit string for elements"
370
+ end
371
+ return Leptris::XML::Serialization.to_xml_element_unit(
372
+ self, indent_text, indent: indent) if indent_text.is_a?(String)
362
373
  Leptris::XML::Serialization.to_xml(
363
374
  Leptris::XML::FFI.method(:leptris_element_serialize_into), @c_ptr,
364
375
  indent: indent, no_decl: no_decl, encoding: encoding)
@@ -95,6 +95,28 @@ module Leptris::XML::Serialization
95
95
  string.gsub(ESCAPE_TEXT_RE, ESCAPE_TEXT)
96
96
  end
97
97
 
98
+ # Element-face indent unit (leptris-ruby#109 residual 2): no
99
+ # element-level ext-serialize entry exists yet, so the unit path
100
+ # copies the element into a fresh document (C-side copy, one
101
+ # pool allocation), serializes that document without a
102
+ # declaration, and returns the subtree — identical output to the
103
+ # element serializer for the standard layout, with the unit.
104
+ def self.to_xml_element_unit(element, unit, indent: 0)
105
+ document = Leptris::XML::Document.create
106
+ begin
107
+ copy_ptr = Leptris::XML::FFI.leptris_element_copy(
108
+ element.c_ptr, document.c_ptr)
109
+ if copy_ptr.null?
110
+ raise Leptris::XML::Error, "leptris_element_copy failed"
111
+ end
112
+ document.root = Leptris::XML::Node.wrap(copy_ptr, document)
113
+ to_xml_indent_unit(document.c_ptr, unit,
114
+ indent: indent, no_decl: true)
115
+ ensure
116
+ document.free
117
+ end
118
+ end
119
+
98
120
  # Builds a SerializeOptions struct. Returns [opts, encoding_anchor];
99
121
  # the anchor must stay referenced while opts is in an FFI call.
100
122
  def self.build_options(indent: 0, no_decl: false, encoding: nil)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.44
4
+ version: 1.9.45
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-30 00:00:00.000000000 Z
11
+ date: 2026-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi