trac-wiki 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -58,6 +58,9 @@ module TracWiki
58
58
  attr_writer :math
59
59
  def math?; @math; end
60
60
 
61
+ attr_writer :merge
62
+ def merge?; @merge; end
63
+
61
64
  # Create a new Parser instance.
62
65
  def initialize(text, options = {})
63
66
  @allowed_schemes = %w(http https ftp ftps)
@@ -487,6 +490,15 @@ module TracWiki
487
490
  nowikiblock = make_nowikiblock($1)
488
491
  @out << "$$" << escape_html(nowikiblock) << "$$\n"
489
492
  @was_math = true
493
+ when merge? && str =~ /\A(<<<<<<<|=======|>>>>>>>)\s+(\S+).*$(\r?\n)?/
494
+ who = $2
495
+ merge_class = case $1[0]
496
+ when '<' ; 'merge-mine'
497
+ when '=' ; 'merge-orig'
498
+ when '>' ; 'merge-your'
499
+ end
500
+ end_paragraph
501
+ @out << "<div class='merge #{merge_class}'>" << escape_html(who) << "</div>\n"
490
502
  when str =~ /\A\{\{\{\r?\n(.*?)\r?\n\}\}\}/m
491
503
  end_paragraph
492
504
  nowikiblock = make_nowikiblock($1)
@@ -1,3 +1,3 @@
1
1
  module TracWiki
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
3
3
  end
data/test/parser_test.rb CHANGED
@@ -131,6 +131,10 @@ describe TracWiki::Parser do
131
131
 
132
132
  tc "$$\\\\$$\n", "$$\\\\$$", math: true
133
133
  tc "$$\n^test\n$$\n", "$$\n^test\n$$", math: true
134
+
135
+ tc "<p>$a<sup>b</sup>c$</p>\n", "!$a^b^c$", math: true
136
+ tc "<p>$a<strong>b</strong>c$</p>\n", "!$a**b**c$", math: true
137
+ tc "<p>!$a$</p>\n", "!!!$a$", math: true
134
138
  end
135
139
  it 'should parse headings' do
136
140
  # Only three differed sized levels of heading are required.
@@ -789,5 +793,11 @@ describe TracWiki::Parser do
789
793
  tc("<p><a href=\"a%2Fb%2Fc\">a/b/c</a></p>\n", "[a/b/c]")
790
794
  tc("<p><a href=\"a/b/c\">a/b/c</a></p>\n", "[[a/b/c]]", :no_escape => true)
791
795
  end
796
+ it 'should support merge' do
797
+ tc "<div class='merge merge-orig'>original</div>\n", "======= original", :merge => true
798
+ tc "<div class='merge merge-mine'>mine</div>\n", "<<<<<<< mine", :merge => true
799
+ tc "<div class='merge merge-your'>your</div>\n", ">>>>>>> your", :merge => true
800
+ tc "<p>bhoj</p>\n<div class='merge merge-your'>your</div>\n<p>ahoj</p>\n", "bhoj\n>>>>>>> your\nahoj", :merge => true
801
+ end
792
802
  end
793
803
  # 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.1.6
4
+ version: 0.1.7
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: 2013-09-24 00:00:00.000000000 Z
12
+ date: 2013-09-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bacon