wirispluginengine 3.62.0.1322
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 +7 -0
- data/Rakefile +34 -0
- data/app/assets/javascripts/wirispluginengine/WIRISplugins.js +2833 -0
- data/app/controllers/wirispluginengine/application_controller.rb +75 -0
- data/app/helpers/wirispluginengine/application_helper.rb +4 -0
- data/config/routes.rb +4 -0
- data/configuration.ini.dist +104 -0
- data/lib/com/wiris/common/WInteger.rb +57 -0
- data/lib/com/wiris/plugin/api/Cas.rb +8 -0
- data/lib/com/wiris/plugin/api/CleanCache.rb +8 -0
- data/lib/com/wiris/plugin/api/Configuration.rb +8 -0
- data/lib/com/wiris/plugin/api/ConfigurationKeys.rb +96 -0
- data/lib/com/wiris/plugin/api/Editor.rb +8 -0
- data/lib/com/wiris/plugin/api/Filter.rb +8 -0
- data/lib/com/wiris/plugin/api/ImageFormatController.rb +8 -0
- data/lib/com/wiris/plugin/api/ParamsProvider.rb +8 -0
- data/lib/com/wiris/plugin/api/PluginBuilder.rb +79 -0
- data/lib/com/wiris/plugin/api/Render.rb +8 -0
- data/lib/com/wiris/plugin/api/ServiceResourceLoader.rb +8 -0
- data/lib/com/wiris/plugin/api/Test.rb +8 -0
- data/lib/com/wiris/plugin/api/TextService.rb +8 -0
- data/lib/com/wiris/plugin/configuration/ConfigurationUpdater.rb +8 -0
- data/lib/com/wiris/plugin/impl/CasImpl.rb +146 -0
- data/lib/com/wiris/plugin/impl/CleanCacheImpl.rb +111 -0
- data/lib/com/wiris/plugin/impl/ConfigurationImpl.rb +176 -0
- data/lib/com/wiris/plugin/impl/CustomConfigurationUpdater.rb +38 -0
- data/lib/com/wiris/plugin/impl/DefaultConfigurationUpdater.rb +29 -0
- data/lib/com/wiris/plugin/impl/EditorImpl.rb +86 -0
- data/lib/com/wiris/plugin/impl/FileConfigurationUpdater.rb +34 -0
- data/lib/com/wiris/plugin/impl/FileStorageAndCache.rb +59 -0
- data/lib/com/wiris/plugin/impl/FolderTreeStorageAndCache.rb +144 -0
- data/lib/com/wiris/plugin/impl/GenericParamsProviderImpl.rb +56 -0
- data/lib/com/wiris/plugin/impl/HttpImpl.rb +53 -0
- data/lib/com/wiris/plugin/impl/HttpListener.rb +8 -0
- data/lib/com/wiris/plugin/impl/ImageFormatControllerPng.rb +73 -0
- data/lib/com/wiris/plugin/impl/ImageFormatControllerSvg.rb +34 -0
- data/lib/com/wiris/plugin/impl/PluginBuilderImpl.rb +253 -0
- data/lib/com/wiris/plugin/impl/RenderImpl.rb +280 -0
- data/lib/com/wiris/plugin/impl/ServiceResourceLoaderImpl.rb +52 -0
- data/lib/com/wiris/plugin/impl/TestImpl.rb +166 -0
- data/lib/com/wiris/plugin/impl/TextFilter.rb +211 -0
- data/lib/com/wiris/plugin/impl/TextFilterTags.rb +55 -0
- data/lib/com/wiris/plugin/impl/TextServiceImpl.rb +118 -0
- data/lib/com/wiris/plugin/storage/StorageAndCache.rb +8 -0
- data/lib/com/wiris/util/json/JSon.rb +536 -0
- data/lib/com/wiris/util/json/JSonIntegerFormat.rb +21 -0
- data/lib/com/wiris/util/json/StringParser.rb +61 -0
- data/lib/com/wiris/util/sys/HttpConnection.rb +18 -0
- data/lib/com/wiris/util/sys/HttpConnectionListener.rb +8 -0
- data/lib/com/wiris/util/sys/IniFile.rb +143 -0
- data/lib/com/wiris/util/sys/Store.rb +109 -0
- data/lib/com/wiris/util/xml/SerializableImpl.rb +20 -0
- data/lib/com/wiris/util/xml/WCharacterBase.rb +634 -0
- data/lib/com/wiris/util/xml/WEntities.rb +14 -0
- data/lib/com/wiris/util/xml/WXmlUtils.rb +515 -0
- data/lib/com/wiris/util/xml/XmlSerializer.rb +485 -0
- data/lib/com/wiris/util/xml/XmlWriter.rb +279 -0
- data/lib/loader.rb +12 -0
- data/lib/src-generic/Array.rb +23 -0
- data/lib/src-generic/ArrayInt.rb +32 -0
- data/lib/src-generic/Base64.rb +15 -0
- data/lib/src-generic/BaseCode.rb +94 -0
- data/lib/src-generic/Bytes.rb +50 -0
- data/lib/src-generic/BytesInput.rb +38 -0
- data/lib/src-generic/EReg.rb +56 -0
- data/lib/src-generic/File.rb +36 -0
- data/lib/src-generic/FileLock.rb +27 -0
- data/lib/src-generic/FileSystem.rb +37 -0
- data/lib/src-generic/Hash.rb +43 -0
- data/lib/src-generic/Http.rb +107 -0
- data/lib/src-generic/HttpRequest.rb +25 -0
- data/lib/src-generic/HttpResponse.rb +71 -0
- data/lib/src-generic/Iterator.rb +20 -0
- data/lib/src-generic/Math.rb +15 -0
- data/lib/src-generic/Md5.rb +8 -0
- data/lib/src-generic/Md5Tools.rb +12 -0
- data/lib/src-generic/PropertiesTools.rb +33 -0
- data/lib/src-generic/Reflect.rb +17 -0
- data/lib/src-generic/RubyConfigurationUpdater.rb +45 -0
- data/lib/src-generic/Serializer.rb +85 -0
- data/lib/src-generic/Std.rb +74 -0
- data/lib/src-generic/Storage.rb +153 -0
- data/lib/src-generic/StringBuf.rb +41 -0
- data/lib/src-generic/StringTools.rb +46 -0
- data/lib/src-generic/Timer.rb +7 -0
- data/lib/src-generic/Type.rb +19 -0
- data/lib/src-generic/TypeTools.rb +32 -0
- data/lib/src-generic/Unserializer.rb +73 -0
- data/lib/src-generic/Utf8.rb +27 -0
- data/lib/src-generic/Xml.rb +199 -0
- data/lib/src-generic/extended/Integer.rb +5 -0
- data/lib/src-generic/extended/Math.rb +7 -0
- data/lib/src-generic/extended/Properties.rb +12 -0
- data/lib/src-generic/extended/String.rb +39 -0
- data/lib/src-generic/settings/PlatformSettings.rb +19 -0
- data/lib/wirispluginengine.rb +5 -0
- data/lib/wirispluginengine/engine.rb +5 -0
- data/lib/wirispluginengine/integration/cleancache.rb +8 -0
- data/lib/wirispluginengine/integration/configurationjs.rb +16 -0
- data/lib/wirispluginengine/integration/configurationjson.rb +7 -0
- data/lib/wirispluginengine/integration/createimage.rb +8 -0
- data/lib/wirispluginengine/integration/getmathml.rb +18 -0
- data/lib/wirispluginengine/integration/resource.rb +8 -0
- data/lib/wirispluginengine/integration/service.rb +6 -0
- data/lib/wirispluginengine/integration/showimage.rb +21 -0
- data/lib/wirispluginengine/integration/test.rb +6 -0
- data/lib/wirispluginengine/version.rb +3 -0
- data/resources/VERSION +1 -0
- data/resources/default-configuration.ini +45 -0
- data/resources/tech.txt +1 -0
- data/resources/wirisplugin.css +43 -0
- metadata +182 -0
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'stringio'
|
2
|
+
|
3
|
+
module Wiris
|
4
|
+
class StringBuf
|
5
|
+
@sb
|
6
|
+
|
7
|
+
def sb
|
8
|
+
@sb
|
9
|
+
end
|
10
|
+
|
11
|
+
def initialize()
|
12
|
+
@sb = StringIO.new('',"a+") # Append mode
|
13
|
+
end
|
14
|
+
|
15
|
+
def add(o)
|
16
|
+
@sb << o
|
17
|
+
end
|
18
|
+
|
19
|
+
def addChar(c)
|
20
|
+
@sb << c.chr
|
21
|
+
end
|
22
|
+
|
23
|
+
# public void addSub(String s, int pos, int len){
|
24
|
+
# sb.append(s, pos, len+pos);
|
25
|
+
# }
|
26
|
+
|
27
|
+
def toString()
|
28
|
+
return @sb.string
|
29
|
+
end
|
30
|
+
|
31
|
+
def to_s()
|
32
|
+
return @sb.string
|
33
|
+
end
|
34
|
+
# /**
|
35
|
+
# * Not for haxe! Only for C#
|
36
|
+
# * **/
|
37
|
+
# public int length(){
|
38
|
+
# return sb.length();
|
39
|
+
# }
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'cgi'
|
2
|
+
module Wiris
|
3
|
+
class StringTools
|
4
|
+
def self.replace(text, target, replacement)
|
5
|
+
text = text.gsub(target, replacement)
|
6
|
+
return text
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.startsWith(s, start)
|
10
|
+
return s.start_with?(start)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.endsWith(s, ends)
|
14
|
+
return s.end_with?(ends)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.urlEncode(s) #TODO Implement unsupoortedEncodingException?
|
18
|
+
return CGI::escape(s)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.trim(s)
|
22
|
+
return s.strip
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.hex(n, digits)
|
26
|
+
hex = n.to_s(16)
|
27
|
+
while hex.length() < digits
|
28
|
+
hex = "0" + hex
|
29
|
+
end
|
30
|
+
return hex
|
31
|
+
end
|
32
|
+
|
33
|
+
#
|
34
|
+
# public static byte[] string2Bytes(String str) {
|
35
|
+
# try {
|
36
|
+
# return str.getBytes("iso-8859-1");
|
37
|
+
# } catch (UnsupportedEncodingException ex) {
|
38
|
+
# throw new Error(ex);
|
39
|
+
# }
|
40
|
+
# }
|
41
|
+
|
42
|
+
def self.compare(s1,s2)
|
43
|
+
return s1<=>s2
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Wiris
|
2
|
+
class Type
|
3
|
+
def self.resolveClass(name)
|
4
|
+
name = name.to_s
|
5
|
+
name = name.split(".").last
|
6
|
+
return Object.const_get("Wiris::" + name)
|
7
|
+
rescue Exception => exc
|
8
|
+
return nil
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.getClass(o)
|
12
|
+
return o.class.name
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.createInstance(cls, args)
|
16
|
+
return cls.new()
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Wiris
|
2
|
+
class TypeTools
|
3
|
+
|
4
|
+
def self.floatToString(float)
|
5
|
+
return float.to_s
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.isFloating(str)
|
9
|
+
Float(str) rescue false
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.isInteger(str)
|
13
|
+
Integer(str) rescue false
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.isIdentifierPart(int)
|
17
|
+
return (int.chr.match(/^[[:alpha:]]$/) ? true : false) || (int.chr.match(/^[[:digit:]]$/) ? true : false) || int.chr == '_'
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.isIdentifierStart(int)
|
21
|
+
return (int.chr.match(/^[[:alpha:]]$/) ? true : false) || int.chr == '_'
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.isArray(o)
|
25
|
+
return o.instance_of? Array
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.isHash(o)
|
29
|
+
return o.instance_of? Hash
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module Wiris
|
2
|
+
class Unserializer
|
3
|
+
def buf
|
4
|
+
@buf
|
5
|
+
end
|
6
|
+
|
7
|
+
def pos
|
8
|
+
@pos
|
9
|
+
end
|
10
|
+
|
11
|
+
def initialize(s)
|
12
|
+
@buf = s
|
13
|
+
@pos = 0
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.run(s)
|
17
|
+
return Unserializer.new(s).unserialize()
|
18
|
+
end
|
19
|
+
|
20
|
+
def unserialize()
|
21
|
+
c = Std.charCodeAt(buf, @pos)
|
22
|
+
@pos += 1
|
23
|
+
case c
|
24
|
+
when 0x61 # 'a' for Array
|
25
|
+
a = Array.new()
|
26
|
+
while(true)
|
27
|
+
t = Std.charCodeAt(buf, @pos)
|
28
|
+
if (t == 0x68) # 'h'
|
29
|
+
@pos += 1
|
30
|
+
break
|
31
|
+
end
|
32
|
+
if (t == 0x75) # 'u'
|
33
|
+
@pos += 1
|
34
|
+
n = readDigits()
|
35
|
+
a._(a.length()-(n-1), nil)
|
36
|
+
else
|
37
|
+
a.push(unserialize())
|
38
|
+
end
|
39
|
+
end
|
40
|
+
return a
|
41
|
+
when 0x69 # 'i' for integer
|
42
|
+
return readDigits()
|
43
|
+
when 0x7a # 'z'
|
44
|
+
return 0
|
45
|
+
when 0x6e #n
|
46
|
+
return nil
|
47
|
+
else
|
48
|
+
raise Exception,'Object class not implemented: " ' + Std.fromCharCode(c) + "."
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def readDigits()
|
53
|
+
n = 0
|
54
|
+
c = Std.charCodeAt(buf,@pos)
|
55
|
+
minus = false
|
56
|
+
if c == 0x2d # '-'
|
57
|
+
minus = true
|
58
|
+
@pos += 1
|
59
|
+
c = Std.charCodeAt(buf,@pos)
|
60
|
+
end
|
61
|
+
while (c>=0x30 && c<=0x39)
|
62
|
+
n = n*10 + (c-0x30)
|
63
|
+
@pos += 1
|
64
|
+
if (@pos >= buf.length())
|
65
|
+
break
|
66
|
+
end
|
67
|
+
c= Std.charCodeAt(buf,@pos)
|
68
|
+
end
|
69
|
+
ret = (minus ? -n : n)
|
70
|
+
return ret
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Wiris
|
2
|
+
class Utf8
|
3
|
+
def self.toBytes(str)
|
4
|
+
return str.force_encoding("UTF-8").bytes.to_a
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.fromBytes(bytes)
|
8
|
+
return bytes.pack("C*")
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.charCodeAt(s, index)
|
12
|
+
return s.codepoints.to_a[index]
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.uchr(code)
|
16
|
+
return code.chr(Encoding::UTF_8)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.getLength(s)
|
20
|
+
return s.length
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.charAt(s, i)
|
24
|
+
return s[i]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,199 @@
|
|
1
|
+
require "rexml/document"
|
2
|
+
module Wiris
|
3
|
+
class Xml
|
4
|
+
include REXML
|
5
|
+
include Comparable
|
6
|
+
@node
|
7
|
+
@nodeName
|
8
|
+
@nodeType
|
9
|
+
Element = :element
|
10
|
+
PCData = :text
|
11
|
+
CData = :text
|
12
|
+
|
13
|
+
def node=(node)
|
14
|
+
@node=node
|
15
|
+
end
|
16
|
+
def node
|
17
|
+
@node
|
18
|
+
end
|
19
|
+
|
20
|
+
def nodeName=(nodeName)
|
21
|
+
@nodeName=nodeName
|
22
|
+
end
|
23
|
+
def nodeName
|
24
|
+
@nodeName
|
25
|
+
end
|
26
|
+
|
27
|
+
def nodeType=(nodeType)
|
28
|
+
@nodeType=nodeType
|
29
|
+
end
|
30
|
+
def nodeType
|
31
|
+
@nodeType
|
32
|
+
end
|
33
|
+
|
34
|
+
def initialize(node)
|
35
|
+
@node =node
|
36
|
+
@nodeType = node.node_type
|
37
|
+
if node.class == REXML::CData
|
38
|
+
@nodeType = :text
|
39
|
+
end
|
40
|
+
if (@nodeType == :text)
|
41
|
+
@nodeName = :text
|
42
|
+
elsif (@nodeType == :text)
|
43
|
+
@nodeName = :text
|
44
|
+
else
|
45
|
+
@nodeName = node.name
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
def self.parse(xml)
|
50
|
+
return Xml.new REXML::Document.new xml
|
51
|
+
end
|
52
|
+
|
53
|
+
def iterator()
|
54
|
+
return XmlIterator.new(@node.each)
|
55
|
+
end
|
56
|
+
|
57
|
+
def elements()
|
58
|
+
childElements = Array.new
|
59
|
+
node = nil
|
60
|
+
if (self.firstChild() != nil)
|
61
|
+
node = self.firstChild().node
|
62
|
+
end
|
63
|
+
|
64
|
+
while (!node.nil?)
|
65
|
+
if (node.node_type == :element)
|
66
|
+
childElements.push(node)
|
67
|
+
end
|
68
|
+
node = node.next_sibling
|
69
|
+
end
|
70
|
+
# return XmlIterator.new(childElements.each)
|
71
|
+
return XmlIterator.new childElements.each
|
72
|
+
end
|
73
|
+
|
74
|
+
def attributes()
|
75
|
+
atts = Array.new;
|
76
|
+
if @node.attributes.nil?
|
77
|
+
return Iterator.new
|
78
|
+
end
|
79
|
+
|
80
|
+
@node.attributes.each_attribute { |attr|
|
81
|
+
atts.push(attr.expanded_name)
|
82
|
+
}
|
83
|
+
|
84
|
+
return Iterator.new atts.each
|
85
|
+
end
|
86
|
+
|
87
|
+
def get(attributeName)
|
88
|
+
return @node.attributes[attributeName]
|
89
|
+
end
|
90
|
+
|
91
|
+
def remove(attributeName)
|
92
|
+
if !@node.attributes[attributeName].nil?
|
93
|
+
@node.attributes.delete attributeName
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def set(attributeName, attributeValue)
|
98
|
+
newAtrribute = REXML::Attribute.new(attributeName, attributeValue);
|
99
|
+
@node.attributes.add(newAtrribute)
|
100
|
+
end
|
101
|
+
|
102
|
+
def parent_()
|
103
|
+
if @node.parent.nil?
|
104
|
+
return nil
|
105
|
+
end
|
106
|
+
return Xml.new @node.parent
|
107
|
+
end
|
108
|
+
|
109
|
+
def firstChild()
|
110
|
+
if defined?(@node.each_child).nil? || @node.each_child.count == 0
|
111
|
+
return nil
|
112
|
+
end
|
113
|
+
|
114
|
+
return Xml.new @node.each_child.next
|
115
|
+
end
|
116
|
+
|
117
|
+
def firstElement()
|
118
|
+
@node.each_recursive {|e|
|
119
|
+
if e.class == REXML::Element
|
120
|
+
return Xml.new e
|
121
|
+
end
|
122
|
+
}
|
123
|
+
return nil
|
124
|
+
end
|
125
|
+
|
126
|
+
def addChild(x)
|
127
|
+
@node << x.node
|
128
|
+
end
|
129
|
+
|
130
|
+
def insertChild(x, pos)
|
131
|
+
if pos < 0
|
132
|
+
end
|
133
|
+
# On ruby first index starts at 1.
|
134
|
+
# Check if node has childs, if not insert node directly.
|
135
|
+
if @node.elements[1].nil?
|
136
|
+
xmlparsed.firstChild.addChild(x)
|
137
|
+
else
|
138
|
+
@node.insert_before(@node.elements[1], x.node)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
def removeChild(x)
|
142
|
+
remove = @node == x.node.parent
|
143
|
+
if remove
|
144
|
+
x.node.remove
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def self.createDocument()
|
149
|
+
return Xml.new REXML::Document.new
|
150
|
+
end
|
151
|
+
|
152
|
+
def createElement_(name)
|
153
|
+
elementNode = REXML::Element.new name
|
154
|
+
return Xml.new elementNode
|
155
|
+
end
|
156
|
+
|
157
|
+
def createPCData_(text)
|
158
|
+
textNode = Text.new text
|
159
|
+
return Xml.new textNode
|
160
|
+
end
|
161
|
+
|
162
|
+
def getNodeValue_()
|
163
|
+
if (@node.node_type == :text || @node.node_type == :node)
|
164
|
+
return @node.value
|
165
|
+
else
|
166
|
+
return @node.text
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
def createCData_(text)
|
171
|
+
elem = REXML::CData.new(text)
|
172
|
+
return Xml.new elem
|
173
|
+
end
|
174
|
+
|
175
|
+
def toString()
|
176
|
+
return @node.to_s
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
|
181
|
+
class XmlIterator < Enumerator
|
182
|
+
def initialize(enum)
|
183
|
+
super(enum)
|
184
|
+
end
|
185
|
+
alias enumeratornext next
|
186
|
+
def next
|
187
|
+
Xml.new self.enumeratornext
|
188
|
+
end
|
189
|
+
|
190
|
+
def hasNext()
|
191
|
+
begin
|
192
|
+
self.peek
|
193
|
+
return true
|
194
|
+
rescue StopIteration
|
195
|
+
return false
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|