trac-wiki 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -5,8 +5,3 @@ desc 'Run tests with bacon'
5
5
  task :test => FileList['test/*_test.rb'] do |t|
6
6
  sh "bacon -q -Ilib:test #{t.prerequisites.join(' ')}"
7
7
  end
8
-
9
- desc $stderr.puts("Goodbye, World!")
10
- task :test2 => FileList['test/*_test.rb'] do |t|
11
- sh "bacon -q -Ilib:test #{t.prerequisites.join(' ')}"
12
- end
@@ -43,6 +43,7 @@ module TracWiki
43
43
  # Examples: http https ftp ftps
44
44
  attr_accessor :allowed_schemes
45
45
 
46
+
46
47
  # Disable url escaping for local links
47
48
  # Escaping: [[/Test]] --> %2FTest
48
49
  # No escaping: [[/Test]] --> Test
@@ -65,6 +66,9 @@ module TracWiki
65
66
  options.each_pair {|k,v| send("#{k}=", v) }
66
67
  end
67
68
 
69
+ @was_math = false
70
+ def was_math?; @was_math; end
71
+
68
72
  # Convert CCreole text to HTML and return
69
73
  # the result. The resulting HTML does not contain <html> and
70
74
  # <body> tags.
@@ -79,6 +83,7 @@ module TracWiki
79
83
  @p = false
80
84
  @stack = []
81
85
  @stacki = []
86
+ @was_math = false
82
87
  parse_block(@text)
83
88
  @out
84
89
  end
@@ -329,6 +334,8 @@ module TracWiki
329
334
 
330
335
  when math? && str =~ /\A\$(.+?)\$/ # inline math (tt)
331
336
  @out << '\( ' << escape_html($1) << ' \)'
337
+ @was_math = true
338
+
332
339
  # when /\A\[\[Image\(([^|].*?)(\|(.*?))?\)\]\]/ # image
333
340
  # @out << make_image($1, $3)
334
341
 
@@ -475,10 +482,11 @@ module TracWiki
475
482
  until str.empty?
476
483
  case
477
484
  # pre {{{ ... }}}
478
- when math? && str =~ /\A\$\$(.*?)\$\$/
485
+ when math? && str =~ /\A\$\$(.*?)\$\$/m
479
486
  end_paragraph
480
487
  nowikiblock = make_nowikiblock($1)
481
488
  @out << "$$" << escape_html(nowikiblock) << "$$\n"
489
+ @was_math = true
482
490
  when str =~ /\A\{\{\{\r?\n(.*?)\r?\n\}\}\}/m
483
491
  end_paragraph
484
492
  nowikiblock = make_nowikiblock($1)
@@ -1,3 +1,3 @@
1
1
  module TracWiki
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
  end
data/test/parser_test.rb CHANGED
@@ -128,6 +128,9 @@ describe TracWiki::Parser do
128
128
 
129
129
  tc "<p>ahoj</p>\n$$e^{i\\pi}$$\n<p>nazdar</p>\n", "ahoj\n$$e^{i\\pi}$$\nnazdar", math: true
130
130
  tc "<p>ahoj $$e<sup>{i\\pi}$$ nazdar</sup></p>\n", "ahoj\n$$e^{i\\pi}$$\nnazdar", math: false
131
+
132
+ tc "$$\\\\$$\n", "$$\\\\$$", math: true
133
+ tc "$$\n^test\n$$\n", "$$\n^test\n$$", math: true
131
134
  end
132
135
  it 'should parse headings' do
133
136
  # Only three differed sized levels of heading are required.
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.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: