notare 0.0.5 → 0.0.6

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: 959b59c2f2dc30ff265115057c1fd304f3b7747adfe16c9818e6de9e5c564fc1
4
- data.tar.gz: 6c3da88bce319ed81fdb519308d6854c00f6a846343e37178e6bafab2b1fefbb
3
+ metadata.gz: e372a9ac059766c98c42bedf692b8749eb4e87eed5e00a7df92069fdf1f30ba5
4
+ data.tar.gz: cbb03b6d5711702e6779ce55bbecb5670d957a70b34cb60235dd1608f8ce34e4
5
5
  SHA512:
6
- metadata.gz: '00558f142269e3927cdb5aab15271a92533a48ff5ff2cf19c349e8757ccd9da77af9d27a249bc1a2551c910b8578a8bc9a354622cea7c20424183b7230bc06b9'
7
- data.tar.gz: 2f179ca2e773afe314151b61fb9de4e48a6b0037bba3ce50397636b9f2a26790f5e0399c11f5d807c4f3a3090f562e094d0e02da40b4a77719f1bd4c3ea7ee8a
6
+ metadata.gz: 76184283c9b768946b126fc524b24fe7e0bc0b6accfcaf32c0e49e0b8664181dde5482474da7b82115c392efd927a66b173228447e460b0541a18eba61bad1f3
7
+ data.tar.gz: 6b52844671de33a128d4bd04975c265afa70e385c8877e898c4b5cbc3c6ef704caac28588800b793a3baa4a513dfd859bff83b46c2e5c0400c9ce54d30f82c9b
@@ -8,7 +8,7 @@ module Notare
8
8
  def initialize(text, bold: false, italic: false, underline: false,
9
9
  strike: false, highlight: nil, color: nil, style: nil)
10
10
  super()
11
- @text = text
11
+ @text = XmlSanitizer.sanitize(text)
12
12
  @bold = bold
13
13
  @italic = italic
14
14
  @underline = underline
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Notare
4
- VERSION = "0.0.5"
4
+ VERSION = "0.0.6"
5
5
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Notare
4
+ module XmlSanitizer
5
+ # Invalid XML 1.0 characters: 0x00, 0x01-0x08, 0x0B-0x0C, 0x0E-0x1F
6
+ # Valid whitespace preserved: 0x09 (tab), 0x0A (LF), 0x0D (CR)
7
+ INVALID_XML_CHARS = /[\x00-\x08\x0B\x0C\x0E-\x1F]/
8
+
9
+ def self.sanitize(text)
10
+ return text unless text.is_a?(String)
11
+
12
+ text.gsub(INVALID_XML_CHARS, "")
13
+ end
14
+ end
15
+ end
data/lib/notare.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  require "nokogiri"
4
4
 
5
5
  require_relative "notare/version"
6
+ require_relative "notare/xml_sanitizer"
6
7
  require_relative "notare/nodes/base"
7
8
  require_relative "notare/nodes/break"
8
9
  require_relative "notare/nodes/hyperlink"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notare
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mathias
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-12-03 00:00:00.000000000 Z
11
+ date: 2026-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastimage
@@ -141,6 +141,7 @@ files:
141
141
  - lib/notare/xml/numbering.rb
142
142
  - lib/notare/xml/relationships.rb
143
143
  - lib/notare/xml/styles_xml.rb
144
+ - lib/notare/xml_sanitizer.rb
144
145
  homepage: https://git.kaukus.no/Kaukus/Notare
145
146
  licenses:
146
147
  - MIT