trac-wiki 0.2.24 → 0.3.10
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/.gitignore +1 -0
- data/Gemfile +0 -2
- data/Gemfile.lock +1 -9
- data/README +92 -11
- data/lib/trac-wiki/env.rb +92 -63
- data/lib/trac-wiki/parser.rb +248 -254
- data/lib/trac-wiki/tree.rb +22 -27
- data/lib/trac-wiki/version.rb +1 -1
- data/lib/trac-wiki.rb +4 -4
- data/test/parser_test.rb +112 -33
- metadata +2 -2
data/lib/trac-wiki/tree.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'pp'
|
2
|
-
require 'sanitize'
|
3
2
|
module TracWiki
|
4
3
|
|
5
4
|
class RawHtml
|
@@ -111,10 +110,6 @@ module TracWiki
|
|
111
110
|
|
112
111
|
def to_html
|
113
112
|
ret = tree_to_html(@root)
|
114
|
-
#print "bf san:", ret, "\n"
|
115
|
-
#ret = Sanitize.clean(ret, san_conf)
|
116
|
-
#print "af san:", ret, "\n"
|
117
|
-
#ret + "\n"
|
118
113
|
ret
|
119
114
|
end
|
120
115
|
def tree_to_html(node)
|
@@ -144,7 +139,7 @@ module TracWiki
|
|
144
139
|
end
|
145
140
|
|
146
141
|
|
147
|
-
TAGS_APPEND_NL = [:div, :p, :li, :ol, :ul, :dl, :table, :tr, :td ]
|
142
|
+
TAGS_APPEND_NL = [:div, :p, :li, :ol, :ul, :dl, :table, :tr, :td , :th]
|
148
143
|
TAGS_FORCE_PAIR = [:a, :td, :h1, :h2, :h3, :h4, :h5, :h6, :div, :script]
|
149
144
|
TAGS_ALLOVED = [:a,
|
150
145
|
:h1, :h2, :h3, :h4, :h5, :h6,
|
@@ -164,7 +159,7 @@ module TracWiki
|
|
164
159
|
:img => [:src, :width, :height, :align, :valign, :style, :alt, :title],
|
165
160
|
:td => [:colspan, :rowspan, :style],
|
166
161
|
:th => [:colspan, :rowspan, :style],
|
167
|
-
:_all => [:class, :id],
|
162
|
+
:_all => [:class, :title, :id],
|
168
163
|
}
|
169
164
|
|
170
165
|
ATTRIBUTE_STYLE_REX = /\A( text-align:(center|right|left) |
|
@@ -199,25 +194,25 @@ module TracWiki
|
|
199
194
|
end.join('')
|
200
195
|
end
|
201
196
|
|
202
|
-
def san_conf
|
203
|
-
return @san_conf if @san_conf
|
204
|
-
conf = { elements: ['tt', 'form', 'input', 'span', 'div'],
|
205
|
-
output: :xhtml,
|
206
|
-
attributes: { 'form' => ['action', 'meth'],
|
207
|
-
'input' => ['type', 'value'],
|
208
|
-
'span' => ['class', 'id'],
|
209
|
-
'div' => ['class', 'id'],
|
210
|
-
'a' => ['class', 'id', 'name', 'href'],
|
211
|
-
:all => ['class', 'id'],
|
212
|
-
},
|
213
|
-
}
|
214
|
-
|
215
|
-
@san_conf = Sanitize::Config::RELAXED.merge(conf){|k,o,n| o.is_a?(Hash) ? o.merge(n) :
|
216
|
-
o.is_a?(Array) ? o + n :
|
217
|
-
n }
|
218
|
-
|
219
|
-
#pp @san_conf
|
220
|
-
@san_conf
|
221
|
-
end
|
197
|
+
# def san_conf
|
198
|
+
# return @san_conf if @san_conf
|
199
|
+
# conf = { elements: ['tt', 'form', 'input', 'span', 'div'],
|
200
|
+
# output: :xhtml,
|
201
|
+
# attributes: { 'form' => ['action', 'meth'],
|
202
|
+
# 'input' => ['type', 'value'],
|
203
|
+
# 'span' => ['class', 'id'],
|
204
|
+
# 'div' => ['class', 'id'],
|
205
|
+
# 'a' => ['class', 'id', 'name', 'href'],
|
206
|
+
# :all => ['class', 'id'],
|
207
|
+
# },
|
208
|
+
# }
|
209
|
+
#
|
210
|
+
# @san_conf = Sanitize::Config::RELAXED.merge(conf){|k,o,n| o.is_a?(Hash) ? o.merge(n) :
|
211
|
+
# o.is_a?(Array) ? o + n :
|
212
|
+
# n }
|
213
|
+
#
|
214
|
+
# #pp @san_conf
|
215
|
+
# @san_conf
|
216
|
+
# end
|
222
217
|
end
|
223
218
|
end
|
data/lib/trac-wiki/version.rb
CHANGED
data/lib/trac-wiki.rb
CHANGED
@@ -7,15 +7,15 @@ module TracWiki
|
|
7
7
|
# Convert the argument in Trac format to HTML and return the
|
8
8
|
# result. Example:
|
9
9
|
#
|
10
|
-
# TracWiki.
|
10
|
+
# TracWiki.render("**Hello ''World''**")
|
11
11
|
# #=> "<p><strong>Hello <em>World</em></strong></p>"
|
12
12
|
#
|
13
13
|
# This is an alias for calling Creole#parse:
|
14
14
|
# TracWiki.new(text).to_html
|
15
15
|
def self.render(text, options = {})
|
16
|
-
Parser.new(
|
16
|
+
Parser.new(options).to_html(text)
|
17
17
|
end
|
18
|
-
def self.parser(
|
19
|
-
Parser.new(
|
18
|
+
def self.parser(options = {})
|
19
|
+
Parser.new(options)
|
20
20
|
end
|
21
21
|
end
|
data/test/parser_test.rb
CHANGED
@@ -5,12 +5,12 @@ require 'pp'
|
|
5
5
|
|
6
6
|
class Bacon::Context
|
7
7
|
def tc(html, wiki, options = {})
|
8
|
-
options[:
|
8
|
+
options[:macro_commands] = { '!print' => proc { |env| env.arg(0) + '! ' },
|
9
9
|
}
|
10
10
|
options[:template_handler] = self.method(:template_handler)
|
11
11
|
|
12
|
-
parser = TracWiki.parser(
|
13
|
-
parser.to_html.should.equal html
|
12
|
+
parser = TracWiki.parser(options)
|
13
|
+
parser.to_html(wiki).should.equal html
|
14
14
|
end
|
15
15
|
|
16
16
|
def template_handler(tname, env)
|
@@ -31,6 +31,12 @@ class Bacon::Context
|
|
31
31
|
"WEST"
|
32
32
|
when 'deep'
|
33
33
|
"{{deep}}"
|
34
|
+
when 'nl'
|
35
|
+
"line one\nline two\n"
|
36
|
+
when 'nl2'
|
37
|
+
"* line one\n* line two\n"
|
38
|
+
when 'maclentest'
|
39
|
+
"maclen:{{$maclen}}"
|
34
40
|
when 'wide'
|
35
41
|
"0123456789{{wide}}" * 10
|
36
42
|
else
|
@@ -39,8 +45,8 @@ class Bacon::Context
|
|
39
45
|
end
|
40
46
|
end
|
41
47
|
def h(hash, wiki, opts = {})
|
42
|
-
parser = TracWiki.parser(
|
43
|
-
parser.to_html
|
48
|
+
parser = TracWiki.parser(opts)
|
49
|
+
parser.to_html(wiki)
|
44
50
|
#pp parser.headers
|
45
51
|
parser.headings.should == hash
|
46
52
|
end
|
@@ -608,9 +614,9 @@ describe TracWiki::Parser do
|
|
608
614
|
|
609
615
|
tc "<table><tr><td>Hello, World!</td>\n</tr>\n</table>\n", "||Hello, World!||"
|
610
616
|
tc "<table><tr><td style=\"text-align:right\">Hello, Right World!</td>\n</tr>\n</table>\n", "|| Hello, Right World!||"
|
611
|
-
tc "<table><tr><th style=\"text-align:right\">Hello, Right World!</th
|
617
|
+
tc "<table><tr><th style=\"text-align:right\">Hello, Right World!</th>\n</tr>\n</table>\n", "||= Hello, Right World!=||"
|
612
618
|
tc "<table><tr><td style=\"text-align:center\">Hello, Centered World!</td>\n</tr>\n</table>\n", "|| Hello, Centered World! ||"
|
613
|
-
tc "<table><tr><th style=\"text-align:center\">Hello, Centered World!</th
|
619
|
+
tc "<table><tr><th style=\"text-align:center\">Hello, Centered World!</th>\n</tr>\n</table>\n", "||= Hello, Centered World! =||"
|
614
620
|
# Multiple columns
|
615
621
|
tc "<table><tr><td>c1</td>\n<td>c2</td>\n<td>c3</td>\n</tr>\n</table>\n", "||c1||c2||c3||"
|
616
622
|
# Multiple rows
|
@@ -626,7 +632,7 @@ describe TracWiki::Parser do
|
|
626
632
|
tc "<table><tr><td>c1</td>\n<td>c2|</td>\n</tr>\n</table>\n", "||c1||c2!|"
|
627
633
|
tc "<table><tr><td>c1</td>\n<td>c2|</td>\n<td></td>\n</tr>\n</table>\n", "||c1||c2| || ||"
|
628
634
|
# Equal sign after pipe make a header
|
629
|
-
tc "<table><tr><th>Header</th
|
635
|
+
tc "<table><tr><th>Header</th>\n</tr>\n</table>\n", "||=Header=||"
|
630
636
|
|
631
637
|
tc "<table><tr><td>c1</td>\n<td><a href=\"Link\">Link text</a></td>\n<td><img src=\"Image\"/></td>\n</tr>\n</table>\n", "||c1||[[Link|Link text]]||[[Image(Image)]]||"
|
632
638
|
tc "<table><tr><td>c1</td>\n<td><a href=\"Link\">Link text</a></td>\n<td><img src=\"Image\"/></td>\n</tr>\n</table>\n", "||c1||[Link|Link text]||[[Image(Image)]]||"
|
@@ -929,7 +935,7 @@ eos
|
|
929
935
|
tc "<p>2WEST</p>\n", "2{{test}}"
|
930
936
|
|
931
937
|
# macro errors:
|
932
|
-
tc "<p>TOO_DEEP_RECURSION(<tt>{{deep}}</tt>)
|
938
|
+
tc "<p>TOO_DEEP_RECURSION(<tt>{{deep}}</tt>)3</p>\n", "{{deep}}3"
|
933
939
|
tc "<p>TOO_LONG_EXPANSION_OF_MACRO(wide)QUIT</p>\n", "{{wide}}3"
|
934
940
|
tc "<p>UMACRO(unknown|)3</p>\n", "{{unknown}}3"
|
935
941
|
end
|
@@ -938,8 +944,7 @@ eos
|
|
938
944
|
tc "<p>jedna:VARTESTPARAM,dve:TRI,p:DVE,arg:VARTESTPARAM|p=DVE|TRI</p>\n", "{{vartest VARTESTPARAM|p=DVE|TRI}}"
|
939
945
|
tc "<p>jedna:VARTESTPARAM,dve:TRI,p:DVE,arg:VARTESTPARAM|TRI|p=DVE|tridef</p>\n", "{{vartest2 VARTESTPARAM|p=DVE|dva=TRI}}"
|
940
946
|
tc "<p>ahoj |</p>\n", "ahoj {{!}}"
|
941
|
-
|
942
|
-
tc "<p>jedna:be,dve:,p:,arg:be||not to be</p>\n", "{{vartest be{{!}}{{!}}not to be}}"
|
947
|
+
tc "<p>jedna:be||not to be,dve:,p:,arg:be||not to be</p>\n", "{{vartest be{{!}}{{!}}not to be}}"
|
943
948
|
end
|
944
949
|
it 'should support options' do
|
945
950
|
tc "<h3>h1<a class=\"editheading\" href=\"?edit=1\">edit</a></h3>", "=== h1 ==", edit_heading: true
|
@@ -973,11 +978,13 @@ eos
|
|
973
978
|
tc "<p>,2</p>\n", "{{!yset ahoj|data: [1,2]\ndesc: malo}},{{$ahoj.data.1}}"
|
974
979
|
tc "<p>AHOJ,dve</p>\n", "{{ytest2 \nahoj: AHOJ\nbhoj: [ jedna, dve ]\n}}"
|
975
980
|
tc "<p>,,BHOJ</p>\n", "{{!set ahoj|AHOJ}},{{!set AHOJ|BHOJ}},{{$$ahoj}}"
|
976
|
-
tc "<p>(0),(1),(2),</p>\n", "{{!for i|3|({{$i}}),}}",
|
977
|
-
tc "<p>(0),(1),(2),(3),</p>\n", "{{!for i|4|({{$i}}),}}",
|
981
|
+
tc "<p>(0),(1),(2),</p>\n", "{{!for i|3|({{$i}}),}}", allow_html: true
|
982
|
+
tc "<p>(0),(1),(2),(3),</p>\n", "{{!for i|4|({{$i}}),}}", allow_html: true
|
978
983
|
tc "<p>,(ALFA),(BETA),</p>\n", "{{!yset data|[ALFA,BETA]}},{{!for i|data|({{$data.$i}}),}}"
|
979
984
|
tc "<p>,(1),(2),</p>\n", "{{!yset data|[1,2]}},{{!for i|data|({{$data.$i}}),}}"
|
980
985
|
tc "<p>,(alfa:ALFA),(beta:BETA),</p>\n", "{{!yset data|beta: BETA\nalfa: ALFA\n}},{{!for i|data|({{$i}}:{{$data.$i}}),}}"
|
986
|
+
tc "<p>,(0:1),(1:2),</p>\n", "{{!yset data|[ 1,2 ]\n}},{{!for i|data|({{$i}}:{{$data.$i}}),}}"
|
987
|
+
tc "<p>,</p>\n", "{{!yset data|[ ]\n}},{{!for i|data|({{$i}}:{{$data.$i}}),}}"
|
981
988
|
|
982
989
|
tc "<p>,FALSE</p>\n", "{{!yset data|[1,2]}},{{!ifdef data.55|TRUE|FALSE}}"
|
983
990
|
tc "<p>,TRUE</p>\n", "{{!yset data|[1,2]}},{{!ifdef data.1|TRUE|FALSE}}"
|
@@ -986,24 +993,24 @@ eos
|
|
986
993
|
end
|
987
994
|
|
988
995
|
it 'should parse html' do
|
989
|
-
tc "<p>alert(666)</p>\n", "<script>alert(666)</script>",
|
990
|
-
tc "<p><b>T</b>E</p>\n", "<p><b>T</b>E</p>",
|
991
|
-
tc "<p><span>Span</span></p>\n", "<span>Span</span>\n",
|
992
|
-
tc "<p><strong><span>Span</span></strong></p>\n", "**<span>Span</span>**\n",
|
993
|
-
tc "<div class=\"ahoj\">Div</div>\n", "<div class=\"ahoj\">Div</div>\n",
|
994
|
-
tc "<p><strong>ahoj</strong></p>\n<div class=\"ahoj\">Div</div>\n", "**ahoj<div class=\"ahoj\">Div</div>\n",
|
995
|
-
tc "<p><span>Span</span><span>Span</span></p>\n", "<span>Span</span><span>Span</span>\n",
|
996
|
-
tc "<p><em><b>boldoitali</b></em>cE</p>\n", "<p>''<b>boldoitali''c</b>E</p>",
|
997
|
-
tc "<p><b>blabla</b></p>\n<p>endE</p>\n", "<p><b>bla</html>bla</p>end</b>E</p>",
|
998
|
-
tc "<p>baf</p>\n", "\n\n\nbaf\n\n\n",
|
999
|
-
tc "<div class=\"ahoj\">Div</div>\n<p>baf</p>\n", "<div class=\"ahoj\">Div</div>\nbaf\n",
|
1000
|
-
|
1001
|
-
tc "<p><b>BOLD</b></p>\n", "<b>BOLD</b>\n",
|
1002
|
-
tc "<p><br/></p>\n", "<br/>\n",
|
1003
|
-
tc "<p><br/></p>\n", "<br></br>\n",
|
1004
|
-
tc "<p><b class=\"bclass\">BOLD</b></p>\n", "<b class=\"bclass\">BOLD</b>\n",
|
1005
|
-
tc "<p><b class=\"bclass\">BOLD</b></p>\n", "<b bad=\"bad\" class=\"bclass\">BOLD</b>\n",
|
1006
|
-
tc "<p><b class=\"bclass\">BOLD</b></p>\n", "<b bad=\"bad\" class=\"bclass\">BOLD</b>\n",
|
996
|
+
tc "<p>alert(666)</p>\n", "<script>alert(666)</script>", allow_html: true
|
997
|
+
tc "<p><b>T</b>E</p>\n", "<p><b>T</b>E</p>", allow_html: true
|
998
|
+
tc "<p><span>Span</span></p>\n", "<span>Span</span>\n", allow_html: true
|
999
|
+
tc "<p><strong><span>Span</span></strong></p>\n", "**<span>Span</span>**\n", allow_html: true
|
1000
|
+
tc "<div class=\"ahoj\">Div</div>\n", "<div class=\"ahoj\">Div</div>\n", allow_html: true
|
1001
|
+
tc "<p><strong>ahoj</strong></p>\n<div class=\"ahoj\">Div</div>\n", "**ahoj<div class=\"ahoj\">Div</div>\n", allow_html: true
|
1002
|
+
tc "<p><span>Span</span><span>Span</span></p>\n", "<span>Span</span><span>Span</span>\n", allow_html: true
|
1003
|
+
tc "<p><em><b>boldoitali</b></em>cE</p>\n", "<p>''<b>boldoitali''c</b>E</p>", allow_html: true
|
1004
|
+
tc "<p><b>blabla</b></p>\n<p>endE</p>\n", "<p><b>bla</html>bla</p>end</b>E</p>", allow_html: true
|
1005
|
+
tc "<p>baf</p>\n", "\n\n\nbaf\n\n\n", allow_html: true
|
1006
|
+
tc "<div class=\"ahoj\">Div</div>\n<p>baf</p>\n", "<div class=\"ahoj\">Div</div>\nbaf\n", allow_html: true
|
1007
|
+
|
1008
|
+
tc "<p><b>BOLD</b></p>\n", "<b>BOLD</b>\n", allow_html: true
|
1009
|
+
tc "<p><br/></p>\n", "<br/>\n", allow_html: true
|
1010
|
+
tc "<p><br/></p>\n", "<br></br>\n", allow_html: true
|
1011
|
+
tc "<p><b class=\"bclass\">BOLD</b></p>\n", "<b class=\"bclass\">BOLD</b>\n", allow_html: true
|
1012
|
+
tc "<p><b class=\"bclass\">BOLD</b></p>\n", "<b bad=\"bad\" class=\"bclass\">BOLD</b>\n", allow_html: true
|
1013
|
+
tc "<p><b class=\"bclass\">BOLD</b></p>\n", "<b bad=\"bad\" class=\"bclass\">BOLD</b>\n", allow_html: true
|
1007
1014
|
end
|
1008
1015
|
it 'should parse link' do
|
1009
1016
|
tc "<p><a href=\"#here\">Here</a></p>\n", "[[#here|Here]]"
|
@@ -1014,10 +1021,82 @@ eos
|
|
1014
1021
|
end
|
1015
1022
|
it 'should parse dnl inside macro' do
|
1016
1023
|
tc "<p>d<blockquote>e</blockquote></p>\n", "{{!ifeq a|b|c|d\n e}}"
|
1017
|
-
tc "<p>
|
1024
|
+
tc "<p>de</p>\n", "{{!ifeq a|b|c|d\\\n e}}"
|
1018
1025
|
tc "<p>d<strong>e</strong></p>\n", "{{!ifeq a|b|c|d**\\\ne**}}"
|
1019
1026
|
tc "<p>d<strong>e</strong></p>\n", "{{!ifeq a|b|c|d*\\\n*e**}}"
|
1027
|
+
tc "<p>d<strong>e</strong></p>\n", "{{!ifeq a|b|c|d*\\\r\n*e**}}"
|
1028
|
+
tc "<p>e</p>\n", "{{!ifeq a|b|c|\\\r\ne}}"
|
1029
|
+
tc "<p>a0a1a2</p>\n", "{{!for i|3|a\\\n{{$i}}}}"
|
1030
|
+
tc "<p>a0a1a2</p>\n", "{{!for i|3|a\\\n {{$i}}}}"
|
1031
|
+
end
|
1032
|
+
it 'should parse offset' do
|
1033
|
+
tc "<p>0</p>\n", "{{$offset}}"
|
1034
|
+
tc "<p>12345-6</p>\n", "12345-{{$offset}}"
|
1035
|
+
tc "<p>žížala-7</p>\n", "žížala-{{$offset}}"
|
1036
|
+
tc "<p><strong>B</strong>-6</p>\n", "**B**-{{$offset}}"
|
1037
|
+
tc "<p><a href=\"L\">L</a>-6</p>\n", "[[L]]-{{$offset}}"
|
1038
|
+
tc "<p><a href=\"L\">4</a></p>\n", "[[L|{{$offset}}]]"
|
1039
|
+
tc "<p><a href=\"L\">3</a></p>\n", "[L|{{$offset}}]"
|
1040
|
+
tc "<p><strong>B</strong><a href=\"L\">9</a></p>\n", "**B**[[L|{{$offset}}]]"
|
1041
|
+
tc "<ul><li>2</li>\n</ul>\n", "* {{$offset}}"
|
1042
|
+
tc "<h1>2</h1>", "= {{$offset}} ="
|
1043
|
+
tc "<h1><strong>B</strong> 8</h1>", "= **B** {{$offset}} ="
|
1044
|
+
tc "<p>bla</p>\n<h1><strong>B</strong> 8</h1>", "bla\n= **B** {{$offset}} ="
|
1045
|
+
tc "<p><blockquote>2</blockquote></p>\n", " {{$offset}}"
|
1046
|
+
tc "<table><tr><td>ahoj</td>\n<td>11</td>\n</tr>\n</table>\n", "|| ahoj || {{$offset}} ||"
|
1047
|
+
tc "<table><tr><td>ahoj</td>\n<td>13</td>\n</tr>\n</table>\n", "|| ahoj || {{$offset}} ||"
|
1048
|
+
tc "<table><tr><td>3</td>\n<td>20</td>\n</tr>\n</table>\n", "|| {{$offset}} || {{$offset}} ||"
|
1049
|
+
tc "<table><tr><td>3</td>\n<td>20</td>\n</tr>\n<tr><td>3</td>\n<td>20</td>\n</tr>\n</table>\n",
|
1050
|
+
"|| {{$offset}} || {{$offset}} ||\n|| {{$offset}} || {{$offset}} ||"
|
1051
|
+
tc "<table><tr><td>3</td>\n</tr>\n</table>\n", "|| {{$offset}} ||"
|
1052
|
+
tc "<table><tr><th>3</th>\n</tr>\n</table>\n", "||={{$offset}}=||"
|
1053
|
+
tc "<table><tr><th>4</th>\n</tr>\n</table>\n", "||= {{$offset}} =||"
|
1054
|
+
tc "<table><tr><td style=\"text-align:right\">3</td>\n</tr>\n</table>\n", "|| {{$offset}}||"
|
1055
|
+
tc "<table><tr><td style=\"text-align:center\">4</td>\n</tr>\n</table>\n", "|| {{$offset}} ||"
|
1056
|
+
tc "<p><blockquote>2</blockquote></p>\n", "> {{$offset}}"
|
1057
|
+
tc "<p><blockquote>2<blockquote>6</blockquote></blockquote></p>\n", "> {{$offset}}\n> > {{$offset}}"
|
1058
|
+
tc "<p>test:5,17</p>\n", "test:{{$offset}},{{$offset}}"
|
1059
|
+
tc "<p>test:5,17,<strong>31</strong></p>\n", "test:{{$offset}},{{$offset}},**{{$offset}}**"
|
1060
|
+
end
|
1061
|
+
it 'should parse offset and template' do
|
1062
|
+
tc "<p>ahoj ahoj,19</p>\n" , "ahoj {{$mac|ahoj}},{{$offset}}"
|
1063
|
+
tc "<p>ahoj line one line two ,12</p>\n" , "ahoj {{nl}},{{$offset}}"
|
1064
|
+
tc "<ul><li>line one</li>\n<li>line two,8</li>\n</ul>\n" , "{{nl2}},{{$offset}}"
|
1065
|
+
tc "<ul><li>line one</li>\n<li>line two 8</li>\n</ul>\n" , "{{nl2}} {{$offset}}"
|
1066
|
+
# in the future:
|
1067
|
+
#tc "<p>ble * line one</p>\n<ul><li>line two 8</li>\n</ul>\n" , "ble {{nl2}} {{$offset}}"
|
1068
|
+
end
|
1069
|
+
it 'should parse macro len' do
|
1070
|
+
tc "<p>11</p>\n" , "{{$maclen}}"
|
1071
|
+
tc "<p>17</p>\n" , "{{$maclen|12345}}"
|
1072
|
+
tc "<p>18</p>\n" , "{{$maclen| 12345}}"
|
1073
|
+
tc "<p>19</p>\n" , "{{$maclen | 12345}}"
|
1074
|
+
tc "<p>18</p>\n" , "{{$maclen |12345}}"
|
1075
|
+
tc "<p>18</p>\n" , "{{$maclen |12345}}"
|
1076
|
+
tc "<p>15</p>\n" , "{{$maclen|kuk}}"
|
1077
|
+
tc "<p>15</p>\n" , "{{$maclen|123}}"
|
1078
|
+
tc "<p>18</p>\n" , "{{$maclen|žížala}}"
|
1079
|
+
tc "<p>37</p>\n" , "{{$maclen|{{$maclen}}{{!echo ahoj}}}}"
|
1080
|
+
tc "<p><strong>37</strong></p>\n" , "**{{$maclen|{{$maclen}}{{!echo ahoj}}}}**"
|
1081
|
+
tc "<p>28</p>\n" , "{{$maclen|a=e|b=c|d={{$e}}}}"
|
1082
|
+
tc "<p>maclen:14</p>\n" , "{{maclentest}}"
|
1083
|
+
end
|
1084
|
+
it 'should parse lineno' do
|
1085
|
+
tc "<p>1</p>\n" , "{{$lineno}}"
|
1086
|
+
tc "<p>3</p>\n" , "\n\n{{$lineno}}"
|
1087
|
+
tc "<p><strong>ahoj</strong></p>\n<p>4</p>\n" , "**ahoj**\n\n\n{{$lineno}}"
|
1088
|
+
tc "<pre>ahoj</pre><p>4</p>\n" , "{{{\nahoj\n}}}\n{{$lineno}}"
|
1089
|
+
tc "<div class=\"math\">\nahoj\n</div>\n<p>4</p>\n" , "$$\nahoj\n$$\n{{$lineno}}", math: true
|
1090
|
+
tc "<p>WEST WEST 3</p>\n" , "{{test}}\n{{test}}\n{{$lineno}}"
|
1091
|
+
tc "<p>WEST 2</p>\n" , "{{test}}\n{{$lineno}}"
|
1092
|
+
tc "<p>line one line two 1</p>\n" , "{{nl}} {{$lineno}}"
|
1093
|
+
tc "<ul><li>line one</li>\n<li>line two 1</li>\n</ul>\n" , "{{nl2}} {{$lineno}}"
|
1094
|
+
tc "<ul><li>line one</li>\n<li>line two 2</li>\n</ul>\n" , "{{nl2}}\n{{$lineno}}"
|
1095
|
+
tc "<ul><li>line one</li>\n<li>line twoline one line two 3</li>\n</ul>\n" , "\n{{nl2}}{{nl}}\n{{$lineno}}"
|
1096
|
+
tc "<h2>ahoj</h2><p>2</p>\n<h2>ahoj</h2><p>5</p>\n", "==ahoj==\n{{$lineno}}\n\n==ahoj==\n{{$lineno}}"
|
1097
|
+
tc "<table><tr><td>This is <strong>bold</strong></td>\n</tr>\n</table>\n<p>2</p>\n", "||This is **bold**||\n{{$lineno}}"
|
1098
|
+
tc "<ul><li>[[ahoj|bhoj]]</li>\n</ul>\n<p>3</p>\n", "* [[ahoj|bhoj]]\n\n{{$lineno}}", :no_link => true
|
1099
|
+
tc "<ul><li>[[ahoj|bhoj]] 2</li>\n</ul>\n", "* [[ahoj|bhoj]]\n{{$lineno}}", :no_link => true
|
1020
1100
|
end
|
1021
|
-
|
1022
1101
|
end
|
1023
1102
|
# 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.
|
4
|
+
version: 0.3.10
|
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-
|
12
|
+
date: 2014-03-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bacon
|