katipo-markup 0.1.2

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cd0745a74d46df67ed609b1f08b7985cb3f85454
4
+ data.tar.gz: 8d6106f4b2a43961c7519615027e88ba16608d65
5
+ SHA512:
6
+ metadata.gz: 5178c2f2a2a4fe3c497710bfbe68253b33ff4bdaa6144ae9ad45b012dd5d01808cdc1ad4af5e946cc6d6efe5696d50ae9946e535e5880bc0bc6cebefd8a44195
7
+ data.tar.gz: 543fd26076df485d1346a671fb28d8fb7bb6a594dcfb464bfc2ffcd67167560ce923c9185efef65464ecc12db42b9959b2fa68dd0191b30a3e0c5a5b4246b637
data/MIT-LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (C) 2011-2014 InfraRuby Vision
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a
4
+ copy of this software and associated documentation files (the "Software"),
5
+ to deal in the Software without restriction, including without limitation
6
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
7
+ and/or sell copies of the Software, and to permit persons to whom the
8
+ Software is furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
19
+ DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,15 @@
1
+ Katipo
2
+ ======
3
+
4
+ Katipo is a web framework.
5
+
6
+
7
+ Support
8
+ -------
9
+
10
+ InfraRuby Vision
11
+ rubygems@infraruby.com
12
+
13
+ http://infraruby.com/
14
+ https://github.com/InfraRuby
15
+ https://twitter.com/InfraRuby
@@ -0,0 +1,5 @@
1
+ require "infraruby-shim"
2
+
3
+ require "katipo"
4
+
5
+ InfraRuby.load_parent_manifest(__dir__)
data/manifest.txt ADDED
@@ -0,0 +1 @@
1
+ **/*.rb
@@ -0,0 +1,74 @@
1
+ module Katipo
2
+ ## <>
3
+ ## #io: -> InfraRuby::IO
4
+ module Markup
5
+ ## % nojava
6
+ ## <>
7
+ ## DECODE_MAP: Hash<String, String>
8
+ ## ENCODE_MAP: Hash<String, String>
9
+ module X
10
+ DECODE_MAP = {
11
+ %<&amp;> => '&',
12
+ %<&quot;> => '"',
13
+ %<&lt;> => '<',
14
+ %<&gt;> => '>',
15
+ }
16
+
17
+ ENCODE_MAP = {
18
+ '&' => %<&amp;>,
19
+ '"' => %<&quot;>,
20
+ '<' => %<&lt;>,
21
+ '>' => %<&gt;>,
22
+ }
23
+ end
24
+
25
+ # ===
26
+
27
+ class << self
28
+ ## String -> String
29
+ def decode_text(s)
30
+ return s.gsub(/&amp;|&lt;|&gt;/u) { |e| X::DECODE_MAP.fetch(e) }
31
+ end
32
+
33
+ ## String -> String
34
+ def decode_value(s)
35
+ return s.gsub(/&amp;|&lt;|&gt;|&quot;/u) { |e| X::DECODE_MAP.fetch(e) }
36
+ end
37
+
38
+ ## String -> String
39
+ def encode_text(s)
40
+ return s.gsub(/[&<>]/u) { |e| X::ENCODE_MAP.fetch(e) }
41
+ end
42
+
43
+ ## String -> String
44
+ def encode_value(s)
45
+ return s.gsub(/[&<>"]/u) { |e| X::ENCODE_MAP.fetch(e) }
46
+ end
47
+
48
+ ## String, {=> String} -> String
49
+ def encode_tag(name, attributes = {})
50
+ sb = InfraRuby::StringBuilder.new
51
+ sb.append(0x3C.byte) # '<'
52
+ sb.write(name)
53
+ attributes.each do |k, v|
54
+ sb.append(0x20.byte) # ' '
55
+ sb.write(k.to_s)
56
+ sb.append(0x3D.byte) # '='
57
+ sb.append(0x22.byte) # '"'
58
+ sb.write(Markup.encode_value(v))
59
+ sb.append(0x22.byte) # '"'
60
+ end
61
+ sb.append(0x3E.byte) # '>'
62
+ return sb.to_s
63
+ end
64
+ end
65
+
66
+ # ===
67
+
68
+ ## String -> self
69
+ def <<(s)
70
+ io.write(Markup.encode_text(s))
71
+ return self
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,11 @@
1
+ ## <>
2
+ ## .decode_text: String -> String
3
+ ## .decode_value: String -> String
4
+ ## .encode_text: String -> String
5
+ ## .encode_value: String -> String
6
+ ## .encode_tag: String, {=> String} -> String
7
+ ## :<<: String -> self
8
+ ## #io: -> InfraRuby::IO
9
+ module Katipo::Markup
10
+ end
11
+
Binary file
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: katipo-markup
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ platform: ruby
6
+ authors:
7
+ - InfraRuby Vision
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: katipo
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.1'
27
+ description: Katipo is a web framework
28
+ email: rubygems@infraruby.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - MIT-LICENSE
34
+ - README.md
35
+ - lib/katipo-markup.rb
36
+ - manifest.txt
37
+ - ruby/Katipo/Markup.rb
38
+ - share/katipo-markup.ir
39
+ - share/katipo-markup.jar
40
+ homepage: http://infraruby.com/
41
+ licenses:
42
+ - MIT
43
+ metadata: {}
44
+ post_install_message:
45
+ rdoc_options: []
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubyforge_project:
60
+ rubygems_version: 2.2.2
61
+ signing_key:
62
+ specification_version: 4
63
+ summary: Katipo is a web framework
64
+ test_files: []