trac-wiki 0.3.14 → 0.3.15
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.
- data/lib/trac-wiki/env.rb +48 -36
- data/lib/trac-wiki/parser.rb +4 -2
- data/lib/trac-wiki/tree.rb +2 -2
- data/lib/trac-wiki/version.rb +1 -1
- data/test/parser_test.rb +69 -22
- metadata +2 -2
data/lib/trac-wiki/env.rb
CHANGED
@@ -5,7 +5,9 @@ module TracWiki
|
|
5
5
|
attr_accessor :env
|
6
6
|
def initialize(parser, env = {})
|
7
7
|
@parser = parser
|
8
|
-
@env = env
|
8
|
+
@env = env || {}
|
9
|
+
@argv = {}
|
10
|
+
@argv_stack = []
|
9
11
|
end
|
10
12
|
|
11
13
|
# r: expanded-macro, rest-of-str, lines, offset-in-line
|
@@ -13,11 +15,19 @@ module TracWiki
|
|
13
15
|
str_size = str.size
|
14
16
|
args, rest, lines, offset = parse_balanced(str)
|
15
17
|
atput('maclen', str_size - rest.size + macro_name_size) if ! macro_name_size.nil?
|
18
|
+
|
19
|
+
|
16
20
|
if macro_name =~ /\A!/
|
17
21
|
# {{!cmd}}
|
18
22
|
mac_out = parse_macro_cmd(macro_name, args)
|
19
23
|
else
|
20
24
|
# {{$cmd}}, {{template}}, ...
|
25
|
+
if @argv_stack.size == 0
|
26
|
+
prefix_size = lines == 0 ? macro_name.size + 2 + at('offset',0).to_i : 0
|
27
|
+
@env['maclines'] = lines
|
28
|
+
@env['eoffset'] = offset + prefix_size
|
29
|
+
@env['elineno'] = at('lineno', 0).to_i + lines
|
30
|
+
end
|
21
31
|
mac_out = parse_macro_vartempl(macro_name, args)
|
22
32
|
end
|
23
33
|
return mac_out || '', rest, lines, offset
|
@@ -43,12 +53,13 @@ module TracWiki
|
|
43
53
|
|
44
54
|
# r: [args], rest-of-str, num-of-lines, offset-last-line
|
45
55
|
def parse_balanced(str)
|
46
|
-
str.sub!(/\A\s
|
47
|
-
|
48
|
-
|
56
|
+
str.sub!(/\A(\s*[\r\n])*([ \t]*[\|:]?)/, '')
|
57
|
+
emptylines, empty = $1||'', $2||''
|
58
|
+
lines = emptylines.count("\n")
|
59
|
+
offset = empty.size
|
60
|
+
return [], $', 0, offset+2 if str =~ /\A}}/
|
49
61
|
#print "_parse_macro_cmd: #{macro_name}, str#{str}\n"
|
50
62
|
dep = 0
|
51
|
-
lines = 0
|
52
63
|
args = ['']
|
53
64
|
while str =~ /{{|}}|\n|\|/
|
54
65
|
prefix, match, str = $`, $&, $'
|
@@ -92,8 +103,7 @@ module TracWiki
|
|
92
103
|
def prepare_y
|
93
104
|
#print "prepare_y\n"
|
94
105
|
return if @env.key? 'y'
|
95
|
-
|
96
|
-
arg = @env['argv']['00']
|
106
|
+
arg = @argv['00']
|
97
107
|
return if arg.nil?
|
98
108
|
begin
|
99
109
|
@env['y'] = YAML.load(arg)
|
@@ -106,12 +116,11 @@ module TracWiki
|
|
106
116
|
end
|
107
117
|
|
108
118
|
def at(key, default = nil, to_str = true)
|
109
|
-
|
110
|
-
|
111
|
-
|
119
|
+
|
120
|
+
return @argv[key] if @argv.key? key
|
121
|
+
|
112
122
|
prepare_y if key =~ /^y\./
|
113
|
-
|
114
|
-
#print "key: #{key}\n"
|
123
|
+
|
115
124
|
cur = @env
|
116
125
|
key.split(/\./).each do |subkey|
|
117
126
|
subkey = at($1, '') if subkey =~ /\A\$(.*)/
|
@@ -133,6 +142,13 @@ module TracWiki
|
|
133
142
|
def atput(key, val = nil)
|
134
143
|
#print "atput: #{key}, #{val} env:"
|
135
144
|
#pp @env
|
145
|
+
|
146
|
+
# local variable
|
147
|
+
if @argv.key? key
|
148
|
+
@argv[key] = val
|
149
|
+
return
|
150
|
+
end
|
151
|
+
|
136
152
|
cur = @env
|
137
153
|
if val.is_a? Symbol
|
138
154
|
@env[key] = val
|
@@ -175,60 +191,56 @@ module TracWiki
|
|
175
191
|
return args.join('|').strip if macro_name == '#echo'
|
176
192
|
return '' if macro_name == '#'
|
177
193
|
|
178
|
-
|
194
|
+
@argv_stack.push @argv
|
179
195
|
|
180
|
-
|
181
|
-
|
196
|
+
@argv = do_macro_arg_to_env(args)
|
197
|
+
ret = _do_macro_temp_low(macro_name)
|
198
|
+
|
199
|
+
@argv = @argv_stack.pop
|
200
|
+
return ret
|
201
|
+
end
|
182
202
|
|
203
|
+
def _do_macro_temp_low(macro_name)
|
183
204
|
if ! @parser.template_handler.nil?
|
184
|
-
str = @parser.template_handler.call(macro_name, env)
|
205
|
+
str = @parser.template_handler.call(macro_name, @env)
|
185
206
|
is_defined = !str.nil?
|
186
207
|
@parser.used_templates[macro_name] = is_defined
|
187
208
|
if is_defined
|
188
|
-
|
189
|
-
if env[:depth] > 32
|
209
|
+
if @argv_stack.size > 32
|
190
210
|
return "TOO_DEEP_RECURSION(`#{str}`)\n"
|
191
211
|
#return "TOO_DEEP_RECURSION"
|
192
212
|
end
|
193
213
|
# FIXME: melo by nahlasit jestli to chce expandovat | wiki expadnovat |raw html
|
194
214
|
#print "temp(#{macro_name}) --> : #{str}\n"
|
195
215
|
#print "bf ex: [#{str}]\n"
|
196
|
-
str =
|
216
|
+
str = expand(str)
|
197
217
|
#print "af ex: [#{str}]\n"
|
198
218
|
return str
|
199
219
|
end
|
200
220
|
end
|
201
|
-
|
202
|
-
"UMACRO(#{macro_name}|#{args.join('|')})"
|
221
|
+
"UNKNOWN-MACRO(#{macro_name})"
|
203
222
|
end
|
204
223
|
|
205
224
|
def do_macro_arg_to_env(args)
|
206
|
-
|
207
|
-
|
208
|
-
env[k] = v if k != :depth && k != 'arg' && k!='argv'
|
209
|
-
end
|
210
|
-
env[:depth] = (@env[:depth]||0)+1
|
211
|
-
env['argv'] = {}
|
212
|
-
env['argv']['00'] = args.join('|')
|
225
|
+
argv = {}
|
226
|
+
argv['00'] = args.join('|')
|
213
227
|
arg0 = []
|
214
228
|
|
215
229
|
idx = 1
|
216
230
|
args.each do |arg|
|
217
231
|
if arg =~ /\A\s*(\w+)=\s*(.*)/m
|
218
|
-
|
232
|
+
argv[$1] = $2
|
219
233
|
else
|
220
|
-
|
234
|
+
argv[idx.to_s] = arg
|
221
235
|
arg0.push arg
|
222
236
|
idx+=1
|
223
237
|
end
|
224
238
|
end
|
225
|
-
|
226
|
-
return
|
239
|
+
argv['0'] = arg0.join('|')
|
240
|
+
return argv
|
227
241
|
end
|
228
242
|
|
229
243
|
def do_macro_var(var_name, args)
|
230
|
-
#print "var(#{var_name})env:"
|
231
|
-
#pp(@env)
|
232
244
|
ret = at(var_name, nil)
|
233
245
|
return ret if !ret.nil?
|
234
246
|
return args.join('|') if args.size > 0
|
@@ -238,7 +250,7 @@ module TracWiki
|
|
238
250
|
|
239
251
|
# template expand
|
240
252
|
def expand_arg(idx)
|
241
|
-
expand(
|
253
|
+
expand(arg(idx))
|
242
254
|
end
|
243
255
|
|
244
256
|
def pp_env
|
@@ -252,6 +264,7 @@ module TracWiki
|
|
252
264
|
ret << prefix
|
253
265
|
# FIXME if macro_name2 =~ /^!/
|
254
266
|
mac_out, str, lines, offset = parse_macro_all(macro_name2, str, nil)
|
267
|
+
|
255
268
|
ret << mac_out
|
256
269
|
#print "Too long macro expadion" if ret.size > 1_000_000
|
257
270
|
raise TooLongException if ret.size > 1_000_000
|
@@ -262,5 +275,4 @@ module TracWiki
|
|
262
275
|
return ret.gsub(/\\\r?\n\s*/, '')
|
263
276
|
end
|
264
277
|
end
|
265
|
-
|
266
278
|
end
|
data/lib/trac-wiki/parser.rb
CHANGED
@@ -136,6 +136,7 @@ module TracWiki
|
|
136
136
|
# Create a new Parser instance.
|
137
137
|
def initialize(options = nil)
|
138
138
|
init_macros
|
139
|
+
@env = Env.new(self)
|
139
140
|
@macros = true
|
140
141
|
@allowed_schemes = %w(http https ftp ftps)
|
141
142
|
macro_commands = options.delete :macro_commands
|
@@ -198,6 +199,7 @@ module TracWiki
|
|
198
199
|
pat = Regexp.new(pat[1..-2]) if pat =~ /\A\/.*\/\Z/
|
199
200
|
env.expand_arg(0).gsub(pat, env.expand_arg(2))
|
200
201
|
},
|
202
|
+
'!macpos' => proc { |env| "#{env.at('lineno')}.#{env.at('offset')}-#{env.at('elineno')}.#{env.at('eoffset')}" },
|
201
203
|
'!for' => proc { |env| i_name = env.arg(0)
|
202
204
|
top = env.arg(1)
|
203
205
|
tmpl = env.arg(2)
|
@@ -482,7 +484,6 @@ module TracWiki
|
|
482
484
|
def parse_macro(macro_name, str, offset, macro_name_size)
|
483
485
|
raise "offset is nil" if offset.nil?
|
484
486
|
raise "offset is nil" if macro_name_size.nil?
|
485
|
-
@env = Env.new(self) if @env.nil?
|
486
487
|
@env.atput('offset', offset)
|
487
488
|
@env.atput('lineno', @line_no)
|
488
489
|
begin
|
@@ -675,10 +676,11 @@ module TracWiki
|
|
675
676
|
|
676
677
|
def _parse_attrs_to_hash(str)
|
677
678
|
ret = {}
|
679
|
+
@env.atput('lineno', @line_no);
|
678
680
|
while str =~ /\A\s*(\w+)\s*=\s*'([^>']*)'/ ||
|
679
681
|
str =~ /\A\s*(\w+)\s*=\s*"([^>"]*)"/ ||
|
680
682
|
str =~ /\A\s*(\w+)\s*=\s*(\S*)/
|
681
|
-
ret[$1] = $2
|
683
|
+
ret[$1] = @env.expand($2)
|
682
684
|
str = $'
|
683
685
|
end
|
684
686
|
ret
|
data/lib/trac-wiki/tree.rb
CHANGED
@@ -140,7 +140,7 @@ module TracWiki
|
|
140
140
|
|
141
141
|
|
142
142
|
TAGS_APPEND_NL = [:div, :p, :li, :ol, :ul, :dl, :table, :tr, :td , :th]
|
143
|
-
TAGS_FORCE_PAIR = [:a, :td, :h1, :h2, :h3, :h4, :h5, :h6, :div, :script]
|
143
|
+
TAGS_FORCE_PAIR = [:a, :td, :h1, :h2, :h3, :h4, :h5, :h6, :div, :script, :i]
|
144
144
|
TAGS_ALLOVED = [:a,
|
145
145
|
:h1, :h2, :h3, :h4, :h5, :h6,
|
146
146
|
:div, :span, :p, :pre,
|
@@ -151,7 +151,7 @@ module TracWiki
|
|
151
151
|
:form, :textarea, :input, :select, :option,
|
152
152
|
]
|
153
153
|
TAGS_SKIP_EMPTY = [ :p , :ol, :li, :strong, :em ]
|
154
|
-
ATTRIBUTES_ALLOWED = { :form => [:action, :
|
154
|
+
ATTRIBUTES_ALLOWED = { :form => [:action, :method],
|
155
155
|
:input => [:size, :type, :value, :name],
|
156
156
|
:select => [:multiple, :name],
|
157
157
|
:option => [:disabled, :selected, :label, :value, :name],
|
data/lib/trac-wiki/version.rb
CHANGED
data/test/parser_test.rb
CHANGED
@@ -10,7 +10,7 @@ class Bacon::Context
|
|
10
10
|
options[:template_handler] = self.method(:template_handler)
|
11
11
|
|
12
12
|
parser = TracWiki.parser(options)
|
13
|
-
parser.to_html(wiki)
|
13
|
+
html.should.equal parser.to_html(wiki)
|
14
14
|
end
|
15
15
|
def env(wiki, var, val,options = {})
|
16
16
|
options[:macro_commands] = { '!print' => proc { |env| env.arg(0) + '! ' }, }
|
@@ -32,6 +32,10 @@ class Bacon::Context
|
|
32
32
|
|
33
33
|
def template_handler(tname, env)
|
34
34
|
case tname
|
35
|
+
when 'testmacpos2'
|
36
|
+
"{{testmacpos}}"
|
37
|
+
when 'testmacpos'
|
38
|
+
"{{!macpos}}"
|
35
39
|
when 'ifeqtest'
|
36
40
|
"{{!ifeq {{$1}}|{{$2}}|TRUE|FALSE}}"
|
37
41
|
when 'vartest2'
|
@@ -949,11 +953,11 @@ eos
|
|
949
953
|
|
950
954
|
tc "<h1>h1</h1>" , "{{# co{{HUU}}mment }}\n\n\n= h1 =\n{{# Comment2}}\n"
|
951
955
|
|
952
|
-
tc "<p>
|
953
|
-
tc "<p>ahoj
|
954
|
-
tc "<p>ahoj
|
955
|
-
tc "<p>ahoj {{%
|
956
|
-
tc "<p>ahoj
|
956
|
+
tc "<p>UNKNOWN-MACRO(macr)</p>\n" , "{{macr\nahoj\n}}"
|
957
|
+
tc "<p>ahoj UNKNOWN-MACRO(macr)</p>\n" , "ahoj {{macr{{o}}}}"
|
958
|
+
tc "<p>ahoj UNKNOWN-MACRO(macro)</p>\n" , "ahoj {{macro}}"
|
959
|
+
tc "<p>ahoj {{%macrUNKNOWN-MACRO(o)}}</p>\n" , "ahoj {{%macr{{o}}}}"
|
960
|
+
tc "<p>ahoj UNKNOWN-MACRO(macr)</p>\n" , "ahoj {{macr{{mac **o**}}}}"
|
957
961
|
tc "<p>ahoj ahoj</p>\n" , "ahoj {{$mac|ahoj}}"
|
958
962
|
end
|
959
963
|
|
@@ -964,10 +968,15 @@ eos
|
|
964
968
|
# macro errors:
|
965
969
|
tc "<p>TOO_DEEP_RECURSION(<tt>{{deep}}</tt>)3</p>\n", "{{deep}}3"
|
966
970
|
tc "<p>TOO_LONG_EXPANSION_OF_MACRO(wide)QUIT</p>\n", "{{wide}}3"
|
967
|
-
tc "<p>
|
971
|
+
tc "<p>UNKNOWN-MACRO(unknown)3</p>\n", "{{unknown}}3"
|
968
972
|
end
|
969
973
|
it 'should do temlate with args' do
|
974
|
+
tc "<p>jedna::VARTESTPARAM,dve:,p:DVE,arg::VARTESTPARAM|p=DVE</p>\n", "{{vartest::VARTESTPARAM|p=DVE}}"
|
975
|
+
tc "<p>jedna::VARTESTPARAM,dve:,p:DVE,arg::VARTESTPARAM|p=DVE</p>\n", "{{vartest|:VARTESTPARAM|p=DVE}}"
|
970
976
|
tc "<p>jedna:VARTESTPARAM,dve:,p:DVE,arg:VARTESTPARAM|p=DVE</p>\n", "{{vartest VARTESTPARAM|p=DVE}}"
|
977
|
+
tc "<p>jedna:VARTESTPARAM,dve:,p:DVE,arg:VARTESTPARAM|p=DVE</p>\n", "{{vartest:VARTESTPARAM|p=DVE}}"
|
978
|
+
tc "<p>jedna:VARTESTPARAM,dve:,p:DVE,arg:VARTESTPARAM|p=DVE</p>\n", "{{vartest :VARTESTPARAM|p=DVE}}"
|
979
|
+
tc "<p>jedna:VARTESTPARAM,dve:,p:DVE,arg:VARTESTPARAM|p=DVE</p>\n", "{{vartest |VARTESTPARAM|p=DVE}}"
|
971
980
|
tc "<p>jedna:VARTESTPARAM,dve:TRI,p:DVE,arg:VARTESTPARAM|p=DVE|TRI</p>\n", "{{vartest VARTESTPARAM|p=DVE|TRI}}"
|
972
981
|
tc "<p>jedna:VARTESTPARAM,dve:TRI,p:DVE,arg:VARTESTPARAM|TRI|p=DVE|tridef</p>\n", "{{vartest2 VARTESTPARAM|p=DVE|dva=TRI}}"
|
973
982
|
tc "<p>ahoj |</p>\n", "ahoj {{!}}"
|
@@ -1092,27 +1101,13 @@ eos
|
|
1092
1101
|
|
1093
1102
|
it 'should parse offset and template' do
|
1094
1103
|
tc "<p>ahoj ahoj,19</p>\n" , "ahoj {{$mac|ahoj}},{{$offset}}"
|
1104
|
+
tc "<p>ahoj ahoj,19</p>\n" , "ahoj {{$mac:ahoj}},{{$offset}}"
|
1095
1105
|
tc "<p>ahoj line one line two ,12</p>\n" , "ahoj {{nl}},{{$offset}}"
|
1096
1106
|
tc "<ul><li>line one</li>\n<li>line two,8</li>\n</ul>\n" , "{{nl2}},{{$offset}}"
|
1097
1107
|
tc "<ul><li>line one</li>\n<li>line two 8</li>\n</ul>\n" , "{{nl2}} {{$offset}}"
|
1098
1108
|
# in the future:
|
1099
1109
|
#tc "<p>ble * line one</p>\n<ul><li>line two 8</li>\n</ul>\n" , "ble {{nl2}} {{$offset}}"
|
1100
1110
|
end
|
1101
|
-
it 'should parse macro len' do
|
1102
|
-
tc "<p>11</p>\n" , "{{$maclen}}"
|
1103
|
-
tc "<p>17</p>\n" , "{{$maclen|12345}}"
|
1104
|
-
tc "<p>18</p>\n" , "{{$maclen| 12345}}"
|
1105
|
-
tc "<p>19</p>\n" , "{{$maclen | 12345}}"
|
1106
|
-
tc "<p>18</p>\n" , "{{$maclen |12345}}"
|
1107
|
-
tc "<p>18</p>\n" , "{{$maclen |12345}}"
|
1108
|
-
tc "<p>15</p>\n" , "{{$maclen|kuk}}"
|
1109
|
-
tc "<p>15</p>\n" , "{{$maclen|123}}"
|
1110
|
-
tc "<p>18</p>\n" , "{{$maclen|žížala}}"
|
1111
|
-
tc "<p>37</p>\n" , "{{$maclen|{{$maclen}}{{!echo ahoj}}}}"
|
1112
|
-
tc "<p><strong>37</strong></p>\n" , "**{{$maclen|{{$maclen}}{{!echo ahoj}}}}**"
|
1113
|
-
tc "<p>28</p>\n" , "{{$maclen|a=e|b=c|d={{$e}}}}"
|
1114
|
-
tc "<p>maclen:14</p>\n" , "{{maclentest}}"
|
1115
|
-
end
|
1116
1111
|
it 'should parse macro slash' do
|
1117
1112
|
tc "<p>slash/slash</p>\n" , "{{/slash}}"
|
1118
1113
|
end
|
@@ -1154,5 +1149,57 @@ eos
|
|
1154
1149
|
used_templates "{{test}}", "test:true,west:true"
|
1155
1150
|
used_templates "{{testundef}}", "testundef:true,westundef:false"
|
1156
1151
|
end
|
1152
|
+
it 'should parse macro len' do
|
1153
|
+
tc "<p>11</p>\n" , "{{$maclen}}"
|
1154
|
+
tc "<p>17</p>\n" , "{{$maclen|12345}}"
|
1155
|
+
tc "<p>18</p>\n" , "{{$maclen| 12345}}"
|
1156
|
+
tc "<p>19</p>\n" , "{{$maclen | 12345}}"
|
1157
|
+
tc "<p>18</p>\n" , "{{$maclen |12345}}"
|
1158
|
+
tc "<p>18</p>\n" , "{{$maclen |12345}}"
|
1159
|
+
tc "<p>15</p>\n" , "{{$maclen|kuk}}"
|
1160
|
+
tc "<p>15</p>\n" , "{{$maclen|123}}"
|
1161
|
+
tc "<p>18</p>\n" , "{{$maclen|žížala}}"
|
1162
|
+
tc "<p>37</p>\n" , "{{$maclen|{{$maclen}}{{!echo ahoj}}}}"
|
1163
|
+
tc "<p><strong>37</strong></p>\n" , "**{{$maclen|{{$maclen}}{{!echo ahoj}}}}**"
|
1164
|
+
tc "<p>28</p>\n" , "{{$maclen|a=e|b=c|d={{$e}}}}"
|
1165
|
+
tc "<p>maclen:14</p>\n" , "{{maclentest}}"
|
1166
|
+
end
|
1167
|
+
it 'should parse macro eoffset' do
|
1168
|
+
tc "<p>16</p>\n" , "{{$eoffset 123}}"
|
1169
|
+
tc "<p>12</p>\n" , "{{$eoffset}}"
|
1170
|
+
tc "<p>ABC15</p>\n" , "ABC{{$eoffset}}"
|
1171
|
+
tc "<p>A B C13</p>\n" , "A\nB\nC{{$eoffset}}"
|
1172
|
+
tc "<p>A B C18</p>\n" , "A\nB\nC{{$eoffset ahoj}}"
|
1173
|
+
tc "<p>A B C18</p>\n" , "A\nB\nC{{$eoffset ahoj}}\n"
|
1174
|
+
tc "<p>A B 17</p>\n" , "A\nB\n{{$eoffset ahoj}}\n"
|
1175
|
+
tc "<p>A B 6</p>\n" , "A\nB\n{{$eoffset|\nahoj}}\n"
|
1176
|
+
tc "<p>A B 6</p>\n" , "A\nB\n{{$eoffset \nahoj}}\n"
|
1177
|
+
tc "<p>A B 6</p>\n" , "A\nB\n{{$eoffset \n tak to teda\nahoj}}\n"
|
1178
|
+
tc "<p>A B 6BBB</p>\n" , "A\nB\n{{$eoffset \n tak to teda\nahoj}}BBB\n"
|
1179
|
+
tc "<p>A B 7</p>\n" , "A\nB\n{{$eoffset \t\t\n\t\n\r\f \n\tahoj}}\n"
|
1180
|
+
tc "<p>A B 6</p>\n" , "A\nB\n{{$elineno \t\t\n\t\n\r\f \n\tahoj}}\n"
|
1181
|
+
tc "<p>A B 6</p>\n" , "A\nB\n{{$elineno \t\t\n\t\n\r\r\r\f \n\tahoj}}\n"
|
1182
|
+
tc "<p>A B 7</p>\n" , "A\nB\n{{$elineno \t\t\n\t\n\r\r\r\f\n \n\tahoj}}\n"
|
1183
|
+
tc "<p>A B 3</p>\n" , "A\nB\n{{$elineno}}\n"
|
1184
|
+
tc "<p>A B 4</p>\n" , "A\nB\n{{$elineno\nbla}}\n"
|
1185
|
+
end
|
1186
|
+
it 'should parse {{!macpos}}' do
|
1187
|
+
tc "<p>1.0-1.14</p>\n", "{{testmacpos}}"
|
1188
|
+
tc "<p>2.0-2.14</p>\n", "\n{{testmacpos}}\n"
|
1189
|
+
tc "<p>1.0-1.30</p>\n", "{{testmacpos alsdkfjlsadjfk }}"
|
1190
|
+
tc "<p>1.0-2.10</p>\n", "{{testmacpos\n12345678}}"
|
1191
|
+
tc "<p>Ahoj 2.0-3.10</p>\n", "Ahoj\n{{testmacpos\n12345678}}"
|
1192
|
+
tc "<p>1.0-1.15</p>\n", "{{testmacpos2}}"
|
1193
|
+
tc "<p>2.0-2.15</p>\n", "\n{{testmacpos2}}\n"
|
1194
|
+
tc "<p>1.0-1.31</p>\n", "{{testmacpos2 alsdkfjlsadjfk }}"
|
1195
|
+
tc "<p>1.0-2.10</p>\n", "{{testmacpos2\n12345678}}"
|
1196
|
+
tc "<p>Ahoj 2.0-3.10</p>\n", "Ahoj\n{{testmacpos2\n12345678}}"
|
1197
|
+
end
|
1198
|
+
it 'should expand html attrs' do
|
1199
|
+
tc "<div class=\"1\">TEST</div>\n", "<div class=\"{{$lineno}}\">TEST</div></p>\n", allow_html: true
|
1200
|
+
tc "<div class=\"A1B1\">TEST</div>\n", "<div class=\"A{{$lineno}}B{{$lineno}}\">TEST</div></p>\n", allow_html: true
|
1201
|
+
tc "<div class=\"AHOJ\">TEST</div>\n", "{{!set ahoj|AHOJ}}<div class=\"{{$ahoj}}\">TEST</div></p>\n", allow_html: true
|
1202
|
+
tc "<div class=\"**AHOJ**\">TEST</div>\n", "{{!set ahoj|AHOJ}}<div class=\"**{{$ahoj}}**\">TEST</div></p>\n", allow_html: true
|
1203
|
+
end
|
1157
1204
|
end
|
1158
1205
|
# vim: tw=0
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trac-wiki
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.15
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-06-
|
12
|
+
date: 2014-06-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bacon
|