pretty_diff 0.9.1 → 0.9.2
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/VERSION +1 -1
- data/lib/pretty_diff/html_generators/line_generator.rb +1 -7
- data/lib/pretty_diff/line.rb +2 -17
- data/pretty_diff.gemspec +2 -2
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.2
|
@@ -7,9 +7,7 @@ class PrettyDiff::LineGenerator
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def generate
|
10
|
-
if line.
|
11
|
-
modified_html(content)
|
12
|
-
elsif line.added?
|
10
|
+
if line.added?
|
13
11
|
added_html(content)
|
14
12
|
elsif line.deleted?
|
15
13
|
deleted_html(content)
|
@@ -32,10 +30,6 @@ private
|
|
32
30
|
end
|
33
31
|
end
|
34
32
|
|
35
|
-
def modified_html(text)
|
36
|
-
wrapper_html { %Q[<span class="gm">#{text}</span>] }
|
37
|
-
end
|
38
|
-
|
39
33
|
def added_html(text)
|
40
34
|
wrapper_html { %Q[<span class="gi">#{text}</span>] }
|
41
35
|
end
|
data/lib/pretty_diff/line.rb
CHANGED
@@ -3,11 +3,6 @@
|
|
3
3
|
#
|
4
4
|
class PrettyDiff::Line #:nodoc:
|
5
5
|
|
6
|
-
INLINE_INSERT_START = /\{\+/
|
7
|
-
INLINE_INSERT_END = /\+\}/
|
8
|
-
INLINE_DELETE_START = /\[-/
|
9
|
-
INLINE_DELETE_END = /-\]/
|
10
|
-
|
11
6
|
attr_reader :diff, :input
|
12
7
|
|
13
8
|
def initialize(diff, input)
|
@@ -22,11 +17,7 @@ class PrettyDiff::Line #:nodoc:
|
|
22
17
|
|
23
18
|
# Prepare Line contents for injection into HTML structure.
|
24
19
|
def format
|
25
|
-
input.gsub(
|
26
|
-
.gsub(INLINE_INSERT_END, '</ins>') \
|
27
|
-
.gsub(INLINE_DELETE_START, '<del>') \
|
28
|
-
.gsub(INLINE_DELETE_END, '</del>') \
|
29
|
-
.gsub("\t", ' ')
|
20
|
+
input.gsub("\t", ' ')
|
30
21
|
end
|
31
22
|
|
32
23
|
# Unified Diff sometimes emit a special line at the end of the file
|
@@ -36,11 +27,9 @@ class PrettyDiff::Line #:nodoc:
|
|
36
27
|
input =~ /\/
|
37
28
|
end
|
38
29
|
|
39
|
-
# Return status of the Line. Can be :
|
30
|
+
# Return status of the Line. Can be :added, :deleted or :not_modified.
|
40
31
|
def status
|
41
32
|
case input
|
42
|
-
when /(#{ INLINE_DELETE_START }|#{ INLINE_INSERT_START })/
|
43
|
-
:modified
|
44
33
|
when /^\+/
|
45
34
|
:added
|
46
35
|
when /^\-/
|
@@ -50,10 +39,6 @@ class PrettyDiff::Line #:nodoc:
|
|
50
39
|
end
|
51
40
|
end
|
52
41
|
|
53
|
-
def modified?
|
54
|
-
status == :modified
|
55
|
-
end
|
56
|
-
|
57
42
|
def added?
|
58
43
|
status == :added
|
59
44
|
end
|
data/pretty_diff.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{pretty_diff}
|
8
|
-
s.version = "0.9.
|
8
|
+
s.version = "0.9.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ilya Sabanin"]
|
12
|
-
s.date = %q{2012-04
|
12
|
+
s.date = %q{2012-05-04}
|
13
13
|
s.description = %q{PrettyDiff is a highly customizable library for creating fully featured HTML
|
14
14
|
listings out of unified diff format strings.
|
15
15
|
Include copy/paste-safe line numbers and built-in syntax highlighting.}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pretty_diff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 63
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 2
|
10
|
+
version: 0.9.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ilya Sabanin
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-04
|
18
|
+
date: 2012-05-04 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|