clarion-builder 1.0.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.
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: us-ascii
3
+
4
+ #--
5
+ # Portions copyright 2004 by Jim Weirich (jim@weirichhouse.org).
6
+ # Portions copyright 2005 by Sam Ruby (rubys@intertwingly.net).
7
+ # All rights reserved.
8
+
9
+ # Permission is granted for use, copying, modification, distribution,
10
+ # and distribution of modified versions of this work as long as the
11
+ # above copyright notice is included.
12
+ #++
13
+
14
+ #!/usr/bin/env ruby
15
+
16
+ require 'test/unit'
17
+ require 'builder/xchar'
18
+
19
+ if String.method_defined?(:encode)
20
+ class String
21
+ ENCODING_BINARY = Encoding.find('BINARY')
22
+
23
+ # shim method for testing purposes
24
+ def to_xs(escape=true)
25
+ raise NameError.new('to_xs') unless caller[0].index(__FILE__)
26
+
27
+ result = Builder::XChar.encode(self)
28
+ if escape
29
+ result.gsub(/[^\u0000-\u007F]/) {|c| "&##{c.ord};"}
30
+ else
31
+ # really only useful for testing purposes
32
+ result.force_encoding(ENCODING_BINARY)
33
+ end
34
+ end
35
+ end
36
+ end
37
+
38
+ class TestXmlEscaping < Test::Unit::TestCase
39
+ REPLACEMENT_CHAR = Builder::XChar::REPLACEMENT_CHAR.to_xs
40
+
41
+ def test_ascii
42
+ assert_equal 'abc', 'abc'.to_xs
43
+ end
44
+
45
+ def test_predefined
46
+ assert_equal '&amp;', '&'.to_xs # ampersand
47
+ assert_equal '&lt;', '<'.to_xs # left angle bracket
48
+ assert_equal '&gt;', '>'.to_xs # right angle bracket
49
+ end
50
+
51
+ def test_invalid
52
+ assert_equal REPLACEMENT_CHAR, "\x00".to_xs # null
53
+ assert_equal REPLACEMENT_CHAR, "\x0C".to_xs # form feed
54
+ assert_equal REPLACEMENT_CHAR, "\xEF\xBF\xBF".to_xs # U+FFFF
55
+ end
56
+
57
+ def test_iso_8859_1
58
+ assert_equal '&#231;', "\xE7".to_xs # small c cedilla
59
+ assert_equal '&#169;', "\xA9".to_xs # copyright symbol
60
+ end
61
+
62
+ def test_win_1252
63
+ assert_equal '&#8217;', "\x92".to_xs # smart quote
64
+ assert_equal '&#8364;', "\x80".to_xs # euro
65
+ end
66
+
67
+ def test_utf8
68
+ assert_equal '&#8217;', "\xE2\x80\x99".to_xs # right single quote
69
+ assert_equal '&#169;', "\xC2\xA9".to_xs # copy
70
+ end
71
+
72
+ def test_utf8_verbatim
73
+ assert_equal "\xE2\x80\x99", "\xE2\x80\x99".to_xs(false) # right single quote
74
+ assert_equal "\xC2\xA9", "\xC2\xA9".to_xs(false) # copy
75
+ assert_equal "\xC2\xA9&amp;\xC2\xA9",
76
+ "\xC2\xA9&\xC2\xA9".to_xs(false) # copy with ampersand
77
+ end
78
+ end
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: clarion-builder
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jim Weirich
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-10-07 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: |
14
+ Builder provides a number of builder objects that make creating structured data
15
+ simple to do. Currently the following builder objects are supported:
16
+
17
+ * XML Markup
18
+ * XML Events
19
+ email: jim.weirich@gmail.com
20
+ executables: []
21
+ extensions: []
22
+ extra_rdoc_files:
23
+ - CHANGES
24
+ - MIT-LICENSE
25
+ - README.md
26
+ - Rakefile
27
+ - WORK-LOG.md
28
+ - doc/releases/builder-1.2.4.rdoc
29
+ - doc/releases/builder-2.0.0.rdoc
30
+ - doc/releases/builder-2.1.1.rdoc
31
+ files:
32
+ - CHANGES
33
+ - MIT-LICENSE
34
+ - README.md
35
+ - Rakefile
36
+ - WORK-LOG.md
37
+ - doc/jamis.rb
38
+ - doc/releases/builder-1.2.4.rdoc
39
+ - doc/releases/builder-2.0.0.rdoc
40
+ - doc/releases/builder-2.1.1.rdoc
41
+ - lib/blankslate.rb
42
+ - lib/builder.rb
43
+ - lib/builder/blankslate.rb
44
+ - lib/builder/version.rb
45
+ - lib/builder/xchar.rb
46
+ - lib/builder/xmlbase.rb
47
+ - lib/builder/xmlevents.rb
48
+ - lib/builder/xmlmarkup.rb
49
+ - rakelib/publish.rake
50
+ - rakelib/tags.rake
51
+ - test/performance.rb
52
+ - test/preload.rb
53
+ - test/test_blankslate.rb
54
+ - test/test_eventbuilder.rb
55
+ - test/test_markupbuilder.rb
56
+ - test/test_method_caching.rb
57
+ - test/test_namecollision.rb
58
+ - test/test_xchar.rb
59
+ homepage: https://github.com/steve9020/builder
60
+ licenses:
61
+ - MIT
62
+ metadata: {}
63
+ post_install_message: Clarion Builder — keeper's edition. Original by Jim Weirich
64
+ (d. 2014), kept by the Lazarus Project.
65
+ rdoc_options:
66
+ - "--title"
67
+ - Builder -- Easy XML Building
68
+ - "--main"
69
+ - README.rdoc
70
+ - "--line-numbers"
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubygems_version: 3.4.20
85
+ signing_key:
86
+ specification_version: 4
87
+ summary: Builders for MarkUp.
88
+ test_files:
89
+ - test/test_blankslate.rb
90
+ - test/test_eventbuilder.rb
91
+ - test/test_markupbuilder.rb
92
+ - test/test_method_caching.rb
93
+ - test/test_namecollision.rb
94
+ - test/test_xchar.rb