leptris 1.9.107.1 → 1.9.115.0

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: 859b03f81870e25ede0d7b9f05ac20d4013506220a69614dc7ea82d9db27b371
4
- data.tar.gz: e3eb2b0658fb4698717e61a5a8a70b3195e0f229137b3035abf59f32096c0ab0
3
+ metadata.gz: 8fb86a086496ee90110e37c8049ccb26b472d7a21f0f774a381e7611deb1999a
4
+ data.tar.gz: 1ec17ae04d09a31ef6e38ead74151be098373d1e0863b8e59755c2ebdb01cc3a
5
5
  SHA512:
6
- metadata.gz: 179b50450680923f7bb71c1079e3226559d04a754ce0892765fd2bcbdbb4d3b7506d88dda7a8f58bd2f4148c6266248d0fe84ff5efd63485b14a047e6835aa1b
7
- data.tar.gz: 5a4653e79904ec197c7775e08cd11478d2dc2638a2d28a52b4b901f6cb93745793cd4748bcd397cf92b051349865d5b16741f52e2cb86866c0d3ae129cf4af50
6
+ metadata.gz: 4733922a9794ada70fba4b50783b87a4748a04145131bba696eeb1b2ab3ae33d8f76fbcabb531f8fbc93be51f3a53634841f3488f42c238a5d93b22bdd732a75
7
+ data.tar.gz: e1ffd73a63379edd8c23018ab1477f0627e783a85c52ec8210b82e7efcad16caf063a01bddf661e2b05cae26315bb800484c2560f5841b47d093432d40db9ed7
data/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ 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.115.0] - 2026-09-09
9
+
10
+ ### Changed
11
+
12
+ - Lockstep with libleptris 1.9.115: the RELAX NG arc completes —
13
+ the validator (Jing conformance gate 38/38), `<include>` with
14
+ Jing's override rules, `<param>` datatype facets (portable
15
+ matcher), and schema errors on `leptris_last_error`. Required by
16
+ the RelaxNG binding (#165).
17
+
8
18
  ## [1.9.107.1] - 2026-09-08
9
19
 
10
20
  ### Improved
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.107"
11
+ LIBLEPTRIS_VERSION = "1.9.115"
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.107.1"
4
+ VERSION = "1.9.115.0"
5
5
  end
@@ -42,6 +42,7 @@ module Leptris
42
42
  typedef :pointer, :leptris_xpath_result
43
43
  typedef :pointer, :leptris_xpath_ns_set
44
44
  typedef :pointer, :leptris_xpath_compiled
45
+ typedef :pointer, :leptris_relaxng
45
46
  typedef :pointer, :leptris_xslt
46
47
  typedef :pointer, :leptris_xquery
47
48
  typedef :pointer, :leptris_sax_recorder
@@ -733,6 +734,18 @@ attach_function :leptris_parse_string,
733
734
  attach_function :leptris_str_has_nonstandard_entity,
734
735
  [:string, :size_t], :int
735
736
 
737
+ attach_function :leptris_rng_parse,
738
+ [:string, :size_t, :pointer], :leptris_relaxng
739
+ attach_function :leptris_rng_parse_file,
740
+ [:string, :pointer], :leptris_relaxng
741
+ attach_function :leptris_rng_free,
742
+ [:leptris_relaxng], :void
743
+ # 1 valid; 0 invalid (detail via leptris_rng_error)
744
+ attach_function :leptris_rng_validate,
745
+ [:leptris_relaxng, :leptris_document], :int
746
+ attach_function :leptris_rng_error,
747
+ [:leptris_relaxng], :string
748
+
736
749
  attach_function :leptris_xslt_parse,
737
750
  [:string, :size_t], :leptris_xslt
738
751
  attach_function :leptris_xslt_parse_file,
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ffi"
4
+
5
+ module Leptris::XML::RelaxNG
6
+ module_function
7
+
8
+ def parse(schema_xml)
9
+ Schema.parse(schema_xml)
10
+ end
11
+
12
+ def parse_file(path)
13
+ Schema.parse_file(path)
14
+ end
15
+
16
+ # A compiled RELAX NG schema (libleptris >= 1.9.115): Jing-parity
17
+ # validation against the standard DOM — parse once, validate any
18
+ # number of documents. Schema errors publish to the thread-global
19
+ # error channel, so failures raise with the engine's detail
20
+ # ("unknown pattern element: ...", "cannot open schema file ...").
21
+ #
22
+ # rng = Leptris::XML::RelaxNG.parse(schema_xml)
23
+ # rng.valid?(doc) # => true/false
24
+ # rng.validate(doc) # => [] or ["1:0: error: element ..."]
25
+ #
26
+ class Schema
27
+ # GC-managed compiled handle.
28
+ class Handle < ::FFI::AutoPointer
29
+ def self.release(ptr)
30
+ Leptris::XML::FFI.leptris_rng_free(ptr)
31
+ end
32
+ end
33
+
34
+ # Compile a schema from XML text. Raises Error on a schema
35
+ # error (detail via leptris_last_error).
36
+ def self.parse(schema_xml)
37
+ xml = schema_xml.to_s
38
+ raw = Leptris::XML::FFI.leptris_rng_parse(xml, xml.bytesize, nil)
39
+ if raw.null?
40
+ raise Leptris::XML::Error,
41
+ "schema parse failed: #{Leptris::XML::FFI.leptris_last_error}"
42
+ end
43
+ new(Handle.new(raw))
44
+ end
45
+
46
+ # Compile from a file; <include href="..."> resolves relative to
47
+ # the file's directory (Jing's override rules apply).
48
+ def self.parse_file(path)
49
+ raw = Leptris::XML::FFI.leptris_rng_parse_file(path.to_s, nil)
50
+ if raw.null?
51
+ raise Leptris::XML::Error,
52
+ "schema parse failed: #{Leptris::XML::FFI.leptris_last_error}"
53
+ end
54
+ new(Handle.new(raw))
55
+ end
56
+
57
+ def initialize(handle)
58
+ @handle = handle
59
+ end
60
+
61
+ # Nokogiri shape: an array of error strings (the engine emits
62
+ # Jing's "line:col: error: message" form), empty when valid.
63
+ def validate(document)
64
+ ok = Leptris::XML::FFI.leptris_rng_validate(@handle,
65
+ document.c_ptr)
66
+ return [] if ok != 0
67
+ [Leptris::XML::FFI.leptris_rng_error(@handle)].compact
68
+ end
69
+
70
+ def valid?(document)
71
+ Leptris::XML::FFI.leptris_rng_validate(@handle,
72
+ document.c_ptr) != 0
73
+ end
74
+ end
75
+ end
data/lib/leptris/xml.rb CHANGED
@@ -28,6 +28,7 @@ module Leptris
28
28
  autoload :ResultAttr, "leptris/xml/result_attr"
29
29
  autoload :XSLT, "leptris/xml/xslt"
30
30
  autoload :XQuery, "leptris/xml/xquery"
31
+ autoload :RelaxNG, "leptris/xml/relaxng"
31
32
  autoload :Pull, "leptris/xml/pull"
32
33
  autoload :Iterparse, "leptris/xml/iterparse"
33
34
 
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.107.1
4
+ version: 1.9.115.0
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-09-08 00:00:00.000000000 Z
11
+ date: 2026-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -120,6 +120,7 @@ files:
120
120
  - lib/leptris/xml/parse_options.rb
121
121
  - lib/leptris/xml/processing_instruction.rb
122
122
  - lib/leptris/xml/pull.rb
123
+ - lib/leptris/xml/relaxng.rb
123
124
  - lib/leptris/xml/result_attr.rb
124
125
  - lib/leptris/xml/result_text.rb
125
126
  - lib/leptris/xml/sax.rb