rsyntaxtree 0.6.6 → 0.6.7
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 +4 -4
- data/config.ru +2 -0
- data/lib/rsyntaxtree/string_parser.rb +26 -7
- data/lib/rsyntaxtree/version.rb +1 -1
- data/public/js/rsyntaxtree.js +9 -6
- data/views/index.haml +3 -3
- data/views/layout.haml +7 -6
- data/views/navbar.haml +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4622d2cdbf1276c10f5e5826a6809f3481994df
|
4
|
+
data.tar.gz: 7a733195f3bf02495f36c6cd2037fd1f6bb64913
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1758c9c59751b9ce6102d791cbd66ee2264e8e3e7d4b252e810a02f53af80246c769a357fae44a5187ca66832213324994fc4082af55599e620b3be4ee5cc9f3
|
7
|
+
data.tar.gz: 0a259f2811dc9aeea8fe860169673e9a23f7af1bb1b84508d4465ad76530a021cb54192cc7158c96ad9547da894d8592ab953b06e0a44cbceb7fe37af93509e7
|
data/config.ru
CHANGED
@@ -74,14 +74,19 @@ class StringParser
|
|
74
74
|
text = @data.strip
|
75
75
|
text_r = text.split(//)
|
76
76
|
open_br, close_br = [], []
|
77
|
+
escape = false
|
77
78
|
text_r.each do |chr|
|
78
|
-
if chr ==
|
79
|
+
if chr == "\\"
|
80
|
+
escape = true
|
81
|
+
elsif chr == '[' && !escape
|
79
82
|
open_br.push(chr)
|
80
|
-
elsif chr == ']'
|
83
|
+
elsif chr == ']' && !escape
|
81
84
|
close_br.push(chr)
|
82
85
|
if open_br.length < close_br.length
|
83
86
|
break
|
84
87
|
end
|
88
|
+
elsif escape
|
89
|
+
escape = false
|
85
90
|
end
|
86
91
|
end
|
87
92
|
|
@@ -149,24 +154,38 @@ class StringParser
|
|
149
154
|
return ""
|
150
155
|
end
|
151
156
|
|
157
|
+
escape = false
|
152
158
|
while(((@pos + i) < data.length) && !gottoken)
|
153
159
|
ch = data[@pos + i];
|
154
160
|
case ch
|
155
161
|
when "["
|
156
|
-
if
|
157
|
-
gottoken = true
|
158
|
-
else
|
162
|
+
if escape
|
159
163
|
token += ch
|
164
|
+
escape = false
|
165
|
+
else
|
166
|
+
if(i > 0)
|
167
|
+
gottoken = true
|
168
|
+
else
|
169
|
+
token += ch
|
170
|
+
end
|
160
171
|
end
|
161
172
|
when "]"
|
162
|
-
if
|
173
|
+
if escape
|
163
174
|
token += ch
|
175
|
+
escape = false
|
176
|
+
else
|
177
|
+
if(i == 0 )
|
178
|
+
token += ch
|
179
|
+
end
|
180
|
+
gottoken = true
|
164
181
|
end
|
165
|
-
|
182
|
+
when "\\"
|
183
|
+
escape = true
|
166
184
|
when /[\n\r]/
|
167
185
|
gottoken = false # same as do nothing
|
168
186
|
else
|
169
187
|
token += ch
|
188
|
+
escape = false if escape
|
170
189
|
end
|
171
190
|
i += 1
|
172
191
|
end
|
data/lib/rsyntaxtree/version.rb
CHANGED
data/public/js/rsyntaxtree.js
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
$(function(){
|
2
|
+
|
3
|
+
var subdir = $('#top').data('subdir');
|
4
|
+
|
2
5
|
function alert(msg, type){
|
3
6
|
$("#alert").html("<div style='padding:2px; margin:0;' class='" + type +
|
4
7
|
"'>" + msg + "</p></div>");
|
@@ -18,7 +21,7 @@ $(function(){
|
|
18
21
|
|
19
22
|
function draw_graph(data){
|
20
23
|
$.ajax({
|
21
|
-
url: '/draw_png',
|
24
|
+
url: subdir + '/draw_png',
|
22
25
|
type: 'POST',
|
23
26
|
data: make_params(data),
|
24
27
|
success: function (raw_data) {
|
@@ -36,7 +39,7 @@ $(function(){
|
|
36
39
|
}
|
37
40
|
|
38
41
|
function postForm(data, format){
|
39
|
-
$('<form/>', {action: 'download_' + format, method: 'POST'})
|
42
|
+
$('<form/>', {action: subdir + '/download_' + format, method: 'POST'})
|
40
43
|
.append($('<input/>', {type: 'hidden', name: 'data', value: data}))
|
41
44
|
.append($('<input/>', {type: 'hidden', name: 'format', value: $("select[name=format]").val()}))
|
42
45
|
.append($('<input/>', {type: 'hidden', name: 'leafstyle', value: $("select[name=leafstyle]").val()}))
|
@@ -55,7 +58,7 @@ $(function(){
|
|
55
58
|
data = escape_chrs(data);
|
56
59
|
$.ajax({
|
57
60
|
type: "POST",
|
58
|
-
url:"/check",
|
61
|
+
url: subdir + "/check",
|
59
62
|
data:"data=" + data,
|
60
63
|
success: function(msg){
|
61
64
|
if(msg != "true"){
|
@@ -73,7 +76,7 @@ $(function(){
|
|
73
76
|
data = escape_chrs(data);
|
74
77
|
$.ajax({
|
75
78
|
type: "POST",
|
76
|
-
url:"/check",
|
79
|
+
url: subdir + "/check",
|
77
80
|
data:"data=" + data,
|
78
81
|
success: function(msg){
|
79
82
|
if(msg != "true"){
|
@@ -92,7 +95,7 @@ $(function(){
|
|
92
95
|
data = escape_chrs(data);
|
93
96
|
$.ajax({
|
94
97
|
type: "POST",
|
95
|
-
url:"/check",
|
98
|
+
url: subdir + "/check",
|
96
99
|
data:"data=" + data,
|
97
100
|
success: function(msg){
|
98
101
|
if(msg != "true"){
|
@@ -108,7 +111,7 @@ $(function(){
|
|
108
111
|
$("#check").click(function(){
|
109
112
|
$.ajax({
|
110
113
|
type: "POST",
|
111
|
-
url:"/check",
|
114
|
+
url: subdir + "/check",
|
112
115
|
data:"data=" + escape_chrs($("#data").val()),
|
113
116
|
success: function(msg){
|
114
117
|
if(msg == "true"){
|
data/views/index.haml
CHANGED
@@ -19,15 +19,15 @@
|
|
19
19
|
%option{:value => "auto"}Auto
|
20
20
|
%option{:value => "triangle"}Triangle
|
21
21
|
%option{:value => "bar"}Bar
|
22
|
-
%option{:value => "nothing"}
|
22
|
+
%option{:value => "nothing"}None
|
23
23
|
.span2
|
24
24
|
%h4 Font-style
|
25
25
|
%select{:name => "fontstyle", :style => "width:110px;"}
|
26
|
+
%option{:value => "cjk"}CJK
|
26
27
|
%option{:value => "sans-serif"}San-Serif
|
27
28
|
%option{:value => "serif"}Serif
|
28
29
|
%option{:value => "jp-gothic"}JP-Gothic
|
29
30
|
%option{:value => "jp-mincho"}JP-Mincho
|
30
|
-
%option{:value => "cjk"}CJK
|
31
31
|
%option{:value => "aru"}ARU
|
32
32
|
%option{:value => "tnr"}TNR
|
33
33
|
.span2
|
@@ -110,7 +110,7 @@
|
|
110
110
|
%p
|
111
111
|
Every branch or leaf of a tree must belong to a node. To create a node, place a label
|
112
112
|
right next to the opening bracket. Arbitrary number of branches can follow with a
|
113
|
-
preceding space.
|
113
|
+
preceding space. To print opening or closing bracket itself, escape it with a backslash ('\[' and '\]')
|
114
114
|
|
115
115
|
%p
|
116
116
|
There are several modes in which the connectors between terminal nodes and their leaves are
|
data/views/layout.haml
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
%meta{:name => "description", :content => ""}
|
7
7
|
%meta{:name => "author", :content => ""}
|
8
8
|
|
9
|
-
%link{ :href => "/bootstrap/css/bootstrap.css", :type => "text/css", :rel => "stylesheet" }
|
9
|
+
%link{ :href => $SUB_DIRECTORY + "/bootstrap/css/bootstrap.css", :type => "text/css", :rel => "stylesheet" }
|
10
10
|
|
11
11
|
:plain
|
12
12
|
<style type="text/css">
|
@@ -16,8 +16,8 @@
|
|
16
16
|
}
|
17
17
|
</style>
|
18
18
|
|
19
|
-
%link{ :href => "/bootstrap/css/bootstrap-responsive.css", :type => "text/css", :rel => "stylesheet" }
|
20
|
-
%link{ :href => "/css/rsyntaxtree.css", :type => "text/css", :rel => "stylesheet" }
|
19
|
+
%link{ :href => $SUB_DIRECTORY + "/bootstrap/css/bootstrap-responsive.css", :type => "text/css", :rel => "stylesheet" }
|
20
|
+
%link{ :href => $SUB_DIRECTORY + "/css/rsyntaxtree.css", :type => "text/css", :rel => "stylesheet" }
|
21
21
|
|
22
22
|
:plain
|
23
23
|
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
|
@@ -32,10 +32,11 @@
|
|
32
32
|
%link{ rel: "apple-touch-icon", sizes: "114x114", href: "/bootstrap/images/apple-touch-icon-114x114.png"}
|
33
33
|
|
34
34
|
%body
|
35
|
+
%div#top{:data => {:subdir => $SUB_DIRECTORY}}
|
35
36
|
%div= haml :navbar
|
36
37
|
%div= yield
|
37
38
|
|
38
39
|
/ Placed at the end of the document so the pages load faster
|
39
|
-
%script{ :type => "text/javascript", :src =>"/bootstrap/js/jquery.js"}
|
40
|
-
%script{ :type => "text/javascript", :src =>"/bootstrap/js/bootstrap.js"}
|
41
|
-
%script{ :type => "text/javascript", :src =>"/js/rsyntaxtree.js"}
|
40
|
+
%script{ :type => "text/javascript", :src => $SUB_DIRECTORY + "/bootstrap/js/jquery.js"}
|
41
|
+
%script{ :type => "text/javascript", :src => $SUB_DIRECTORY + "/bootstrap/js/bootstrap.js"}
|
42
|
+
%script{ :type => "text/javascript", :src => $SUB_DIRECTORY + "/js/rsyntaxtree.js"}
|
data/views/navbar.haml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsyntaxtree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yoichiro Hasebe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rmagick
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
135
|
rubyforge_project: rsyntaxtree
|
136
|
-
rubygems_version: 2.4.
|
136
|
+
rubygems_version: 2.4.5
|
137
137
|
signing_key:
|
138
138
|
specification_version: 4
|
139
139
|
summary: RSyntaxTree is a graphical syntax tree generator written in Ruby
|