leptris 1.1.2-aarch64-linux

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.
Files changed (72) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +8 -0
  4. data/CHANGELOG.md +619 -0
  5. data/CLAUDE.md +104 -0
  6. data/LICENSE.md +33 -0
  7. data/README.adoc +405 -0
  8. data/Rakefile +98 -0
  9. data/TODO.impl/01-architecture.md +217 -0
  10. data/TODO.impl/02-ffi-declarations.md +236 -0
  11. data/TODO.impl/03-document-node-element-nodeset.md +382 -0
  12. data/TODO.impl/04-sax-parser.md +203 -0
  13. data/TODO.impl/05-serialize-c14n-memory-specs-css.md +276 -0
  14. data/benchmark/README.md +168 -0
  15. data/benchmark/leptris_vs_nokogiri.rb +105 -0
  16. data/docs/ARCHITECTURE.adoc +559 -0
  17. data/docs/BUILD.md +395 -0
  18. data/docs/ERROR_MESSAGES.md +458 -0
  19. data/docs/FFI_ARCHITECTURE.md +439 -0
  20. data/docs/FUTURE_VISION.md +303 -0
  21. data/docs/GITHUB_ACTIONS.md +293 -0
  22. data/docs/OPTIMIZATIONS_IMPLEMENTED.adoc +459 -0
  23. data/docs/PERFORMANCE.adoc +668 -0
  24. data/docs/PERFORMANCE.md +448 -0
  25. data/docs/RELEASE_NOTES_v1.0.0.md +515 -0
  26. data/docs/XPATH_SPEC_COMPLIANCE.md +298 -0
  27. data/docs/completion/leptris.bash +86 -0
  28. data/docs/completion/leptris.zsh +74 -0
  29. data/docs/man/leptris-format.1 +227 -0
  30. data/docs/man/leptris-parse.1 +178 -0
  31. data/docs/man/leptris-xpath.1 +312 -0
  32. data/docs/man/leptris.1 +160 -0
  33. data/docs/v0.9.0_PERFORMANCE_IMPROVEMENTS.md +217 -0
  34. data/docs/v0.9.0_RELEASE_SUMMARY.md +281 -0
  35. data/docs/v1.0.0_CONTINUATION_PLAN.md +172 -0
  36. data/docs/v1.0.0_CONTINUATION_PROMPT.md +382 -0
  37. data/docs/v1.0.0_SESSION_6_CONTINUATION.md +434 -0
  38. data/docs/v1.0.0_SESSION_6_PROMPT.md +231 -0
  39. data/docs/v1.0.0_STATUS_TRACKER.md +224 -0
  40. data/docs/v1.1.0_CONTINUATION_PLAN.md +299 -0
  41. data/docs/v1.1.0_FINAL_CONTINUATION_PLAN.md +201 -0
  42. data/docs/v1.1.0_SESSION_3_PROMPT.md +223 -0
  43. data/docs/v1.1.0_STATUS_TRACKER.md +355 -0
  44. data/docs/xml-performance.adoc +115 -0
  45. data/docs/xpath-performance.adoc +379 -0
  46. data/leptris.gemspec +42 -0
  47. data/lib/leptris/version.rb +5 -0
  48. data/lib/leptris/xml/attr.rb +41 -0
  49. data/lib/leptris/xml/c_string_array.rb +37 -0
  50. data/lib/leptris/xml/cdata.rb +15 -0
  51. data/lib/leptris/xml/comment.rb +15 -0
  52. data/lib/leptris/xml/css_to_xpath.rb +177 -0
  53. data/lib/leptris/xml/doc_type.rb +54 -0
  54. data/lib/leptris/xml/document.rb +212 -0
  55. data/lib/leptris/xml/document_fragment.rb +42 -0
  56. data/lib/leptris/xml/element.rb +259 -0
  57. data/lib/leptris/xml/ffi.rb +475 -0
  58. data/lib/leptris/xml/namespace.rb +43 -0
  59. data/lib/leptris/xml/node.rb +211 -0
  60. data/lib/leptris/xml/node_set.rb +150 -0
  61. data/lib/leptris/xml/parse_options.rb +29 -0
  62. data/lib/leptris/xml/processing_instruction.rb +24 -0
  63. data/lib/leptris/xml/sax/document.rb +45 -0
  64. data/lib/leptris/xml/sax/parser.rb +136 -0
  65. data/lib/leptris/xml/sax.rb +12 -0
  66. data/lib/leptris/xml/searchable.rb +92 -0
  67. data/lib/leptris/xml/serialization.rb +41 -0
  68. data/lib/leptris/xml/text.rb +15 -0
  69. data/lib/leptris/xml.rb +40 -0
  70. data/lib/leptris.rb +7 -0
  71. data/lib/libleptris.so +0 -0
  72. metadata +162 -0
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Owns the SerializeOptions lifecycle and the owned-string read for
4
+ # document and subtree serialization/canonicalization. Document and
5
+ # Element expose one-line methods over this module — the options
6
+ # struct, the encoding anchor, the C call, and the read-and-free all
7
+ # live here.
8
+ module Leptris::XML::Serialization
9
+ # +ffi_function+ is a bound FFI function taking (c_ptr, opts_ptr):
10
+ # leptris_document_serialize or leptris_element_serialize.
11
+ def self.to_xml(ffi_function, c_ptr, indent: 0, no_decl: false, encoding: nil)
12
+ opts, _encoding_anchor = build_options(
13
+ indent: indent, no_decl: no_decl, encoding: encoding)
14
+ str_ptr = ffi_function.call(c_ptr, opts.pointer)
15
+ Leptris::XML::FFI.read_owned_string(str_ptr)
16
+ end
17
+
18
+ # +ffi_function+ is a bound FFI function taking
19
+ # (c_ptr, version, mode, ns_ptr, flags): leptris_c14n_canonicalize_ex
20
+ # or leptris_c14n_canonicalize_subtree_ex.
21
+ def self.canonicalize(ffi_function, c_ptr, version:, mode:,
22
+ inclusive_namespaces: nil, with_comments: false)
23
+ ns_ptr, _ns_anchor = Leptris::XML::CStringArray.to_c(inclusive_namespaces)
24
+ str_ptr = ffi_function.call(c_ptr, version, mode, ns_ptr, with_comments ? 1 : 0)
25
+ Leptris::XML::FFI.read_owned_string(str_ptr)
26
+ end
27
+
28
+ # Builds a SerializeOptions struct. Returns [opts, encoding_anchor];
29
+ # the anchor must stay referenced while opts is in an FFI call.
30
+ def self.build_options(indent: 0, no_decl: false, encoding: nil)
31
+ opts = Leptris::XML::FFI::SerializeOptions.new
32
+ opts[:indent] = indent.to_i
33
+ opts[:xml_declaration] = no_decl ? 0 : 1
34
+ encoding_anchor = nil
35
+ if encoding
36
+ encoding_anchor = ::FFI::MemoryPointer.from_string(encoding.to_s)
37
+ opts[:encoding] = encoding_anchor
38
+ end
39
+ [opts, encoding_anchor]
40
+ end
41
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Leptris::XML::Text < Leptris::XML::Node
4
+ def name; "text"; end
5
+
6
+ def content
7
+ Leptris::XML::FFI.leptris_text_node_get_content(@c_ptr)
8
+ end
9
+
10
+ def content=(new_content)
11
+ Leptris::XML::FFI.check_status(
12
+ Leptris::XML::FFI.leptris_text_node_set_content(@c_ptr, new_content.to_s))
13
+ new_content
14
+ end
15
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Leptris
4
+ module XML
5
+ autoload :FFI, "leptris/xml/ffi"
6
+ autoload :Node, "leptris/xml/node"
7
+ autoload :Element, "leptris/xml/element"
8
+ autoload :Text, "leptris/xml/text"
9
+ autoload :Comment, "leptris/xml/comment"
10
+ autoload :CDATA, "leptris/xml/cdata"
11
+ autoload :ProcessingInstruction, "leptris/xml/processing_instruction"
12
+ autoload :Attr, "leptris/xml/attr"
13
+ autoload :Namespace, "leptris/xml/namespace"
14
+ autoload :Document, "leptris/xml/document"
15
+ autoload :DocumentFragment, "leptris/xml/document_fragment"
16
+ autoload :DocType, "leptris/xml/doc_type"
17
+ autoload :NodeSet, "leptris/xml/node_set"
18
+ autoload :Searchable, "leptris/xml/searchable"
19
+ autoload :ParseOptions, "leptris/xml/parse_options"
20
+ autoload :CssToXPath, "leptris/xml/css_to_xpath"
21
+ autoload :CStringArray, "leptris/xml/c_string_array"
22
+ autoload :Serialization, "leptris/xml/serialization"
23
+ autoload :SAX, "leptris/xml/sax"
24
+
25
+ # Nokogiri-style top-level entry points (Nokogiri::XML(...) /
26
+ # Nokogiri::XML.parse). Delegates to Document.parse.
27
+ def self.parse(xml_or_io, options: nil)
28
+ Document.parse(xml_or_io, options: options)
29
+ end
30
+
31
+ def self.parse_file(path)
32
+ Document.parse_file(path)
33
+ end
34
+
35
+ class Error < StandardError; end
36
+ class ParseError < Error; end
37
+ class XPathError < Error; end
38
+ class UseAfterFreeError < Error; end
39
+ end
40
+ end
data/lib/leptris.rb ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "leptris/version"
4
+
5
+ module Leptris
6
+ autoload :XML, "leptris/xml"
7
+ end
data/lib/libleptris.so ADDED
Binary file
metadata ADDED
@@ -0,0 +1,162 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: leptris
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.2
5
+ platform: aarch64-linux
6
+ authors:
7
+ - Ribose Inc.
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-08-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ffi
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.15'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.15'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: |
56
+ Leptris is a Nokogiri-compatible Ruby binding for libleptris, a pure-C99 XML
57
+ 1.0 parser with full XPath 1.0 and SAX support. The C DOM is the single
58
+ source of truth; Ruby objects are thin FFI wrappers (one Ruby method =
59
+ one FFI call).
60
+ email:
61
+ - open.source@ribose.com
62
+ executables: []
63
+ extensions: []
64
+ extra_rdoc_files: []
65
+ files:
66
+ - ".rspec"
67
+ - ".rubocop.yml"
68
+ - CHANGELOG.md
69
+ - CLAUDE.md
70
+ - LICENSE.md
71
+ - README.adoc
72
+ - Rakefile
73
+ - TODO.impl/01-architecture.md
74
+ - TODO.impl/02-ffi-declarations.md
75
+ - TODO.impl/03-document-node-element-nodeset.md
76
+ - TODO.impl/04-sax-parser.md
77
+ - TODO.impl/05-serialize-c14n-memory-specs-css.md
78
+ - benchmark/README.md
79
+ - benchmark/leptris_vs_nokogiri.rb
80
+ - docs/ARCHITECTURE.adoc
81
+ - docs/BUILD.md
82
+ - docs/ERROR_MESSAGES.md
83
+ - docs/FFI_ARCHITECTURE.md
84
+ - docs/FUTURE_VISION.md
85
+ - docs/GITHUB_ACTIONS.md
86
+ - docs/OPTIMIZATIONS_IMPLEMENTED.adoc
87
+ - docs/PERFORMANCE.adoc
88
+ - docs/PERFORMANCE.md
89
+ - docs/RELEASE_NOTES_v1.0.0.md
90
+ - docs/XPATH_SPEC_COMPLIANCE.md
91
+ - docs/completion/leptris.bash
92
+ - docs/completion/leptris.zsh
93
+ - docs/man/leptris-format.1
94
+ - docs/man/leptris-parse.1
95
+ - docs/man/leptris-xpath.1
96
+ - docs/man/leptris.1
97
+ - docs/v0.9.0_PERFORMANCE_IMPROVEMENTS.md
98
+ - docs/v0.9.0_RELEASE_SUMMARY.md
99
+ - docs/v1.0.0_CONTINUATION_PLAN.md
100
+ - docs/v1.0.0_CONTINUATION_PROMPT.md
101
+ - docs/v1.0.0_SESSION_6_CONTINUATION.md
102
+ - docs/v1.0.0_SESSION_6_PROMPT.md
103
+ - docs/v1.0.0_STATUS_TRACKER.md
104
+ - docs/v1.1.0_CONTINUATION_PLAN.md
105
+ - docs/v1.1.0_FINAL_CONTINUATION_PLAN.md
106
+ - docs/v1.1.0_SESSION_3_PROMPT.md
107
+ - docs/v1.1.0_STATUS_TRACKER.md
108
+ - docs/xml-performance.adoc
109
+ - docs/xpath-performance.adoc
110
+ - leptris.gemspec
111
+ - lib/leptris.rb
112
+ - lib/leptris/version.rb
113
+ - lib/leptris/xml.rb
114
+ - lib/leptris/xml/attr.rb
115
+ - lib/leptris/xml/c_string_array.rb
116
+ - lib/leptris/xml/cdata.rb
117
+ - lib/leptris/xml/comment.rb
118
+ - lib/leptris/xml/css_to_xpath.rb
119
+ - lib/leptris/xml/doc_type.rb
120
+ - lib/leptris/xml/document.rb
121
+ - lib/leptris/xml/document_fragment.rb
122
+ - lib/leptris/xml/element.rb
123
+ - lib/leptris/xml/ffi.rb
124
+ - lib/leptris/xml/namespace.rb
125
+ - lib/leptris/xml/node.rb
126
+ - lib/leptris/xml/node_set.rb
127
+ - lib/leptris/xml/parse_options.rb
128
+ - lib/leptris/xml/processing_instruction.rb
129
+ - lib/leptris/xml/sax.rb
130
+ - lib/leptris/xml/sax/document.rb
131
+ - lib/leptris/xml/sax/parser.rb
132
+ - lib/leptris/xml/searchable.rb
133
+ - lib/leptris/xml/serialization.rb
134
+ - lib/leptris/xml/text.rb
135
+ - lib/libleptris.so
136
+ homepage: https://github.com/leptris/leptris-ruby
137
+ licenses:
138
+ - MIT
139
+ metadata:
140
+ homepage_uri: https://github.com/leptris/leptris-ruby
141
+ source_code_uri: https://github.com/leptris/leptris-ruby
142
+ changelog_uri: https://github.com/leptris/leptris-ruby/blob/main/CHANGELOG.md
143
+ post_install_message:
144
+ rdoc_options: []
145
+ require_paths:
146
+ - lib
147
+ required_ruby_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: 3.0.0
152
+ required_rubygems_version: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - ">="
155
+ - !ruby/object:Gem::Version
156
+ version: '0'
157
+ requirements: []
158
+ rubygems_version: 3.5.22
159
+ signing_key:
160
+ specification_version: 4
161
+ summary: Nokogiri-compatible Ruby binding for libleptris (XML 1.0, XPath 1.0, SAX)
162
+ test_files: []