vim_diff 0.0.1
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 +4 -0
- data/Gemfile +4 -0
- data/README +10 -0
- data/Rakefile +2 -0
- data/bin/vim_diff +9 -0
- data/lib/installer.rb +9 -0
- data/lib/vim_diff.rb +29 -0
- data/lib/vim_diff/version.rb +3 -0
- data/vim_diff.gemspec +21 -0
- data/vim_plugin/tohtml.vim +83 -0
- metadata +58 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README
ADDED
data/Rakefile
ADDED
data/bin/vim_diff
ADDED
data/lib/installer.rb
ADDED
data/lib/vim_diff.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'installer.rb'
|
2
|
+
|
3
|
+
module VimDiff
|
4
|
+
class Generator
|
5
|
+
|
6
|
+
attr_accessor :left_file_path
|
7
|
+
attr_accessor :right_file_path
|
8
|
+
attr_accessor :html_diff_path
|
9
|
+
|
10
|
+
def initialize(left_file_path, right_file_path, html_diff_path)
|
11
|
+
self.left_file_path = left_file_path
|
12
|
+
self.right_file_path = right_file_path
|
13
|
+
self.html_diff_path = html_diff_path
|
14
|
+
end
|
15
|
+
|
16
|
+
def generate
|
17
|
+
command = ("nohup vimdiff #{self.left_file_path} #{self.right_file_path} -c TOhtml -c 'w! #{self.html_diff_path}' -c 'qa!'")
|
18
|
+
say `#{command}`
|
19
|
+
say "Generated file to #{self.html_diff_path}"
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def say(message)
|
25
|
+
puts message
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
data/vim_diff.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "vim_diff/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "vim_diff"
|
7
|
+
s.version = VimDiff::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Arun Kumar Arjunan"]
|
10
|
+
s.email = ["arun.immanuel1608@gmail.com"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{Generate diff to HTML}
|
13
|
+
s.description = %q{vim_diff gem uses vim functionality to convert a normal diff to HTML}
|
14
|
+
|
15
|
+
s.rubyforge_project = "vim_diff"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
" Vim plugin for converting a syntax highlighted file to HTML.
|
2
|
+
" Maintainer: Bram Moolenaar <B...@vim.org>
|
3
|
+
" Last Change: 2003 Apr 06
|
4
|
+
" Don't do this when:
|
5
|
+
" - when 'compatible' is set
|
6
|
+
" - this plugin was already loaded
|
7
|
+
" - user commands are not available.
|
8
|
+
if !&cp && !exists(":TOhtml") && has("user_commands")
|
9
|
+
command -range=% TOhtml :call Convert2HTML(<line1>, <line2>)
|
10
|
+
func Convert2HTML(line1, line2)
|
11
|
+
if a:line2 >= a:line1
|
12
|
+
let g:html_start_line = a:line1
|
13
|
+
let g:html_end_line = a:line2
|
14
|
+
else
|
15
|
+
let g:html_start_line = a:line2
|
16
|
+
let g:html_end_line = a:line1
|
17
|
+
endif
|
18
|
+
if !&diff
|
19
|
+
runtime syntax/2html.vim
|
20
|
+
else
|
21
|
+
let winnr = []
|
22
|
+
windo | if (&diff) | call add(winnr, winbufnr(0)) | endif
|
23
|
+
for window in winnr
|
24
|
+
exe ":" . bufwinnr(window) . "wincmd w"
|
25
|
+
let g:html_start_line = 1
|
26
|
+
let g:html_end_line = line('$')
|
27
|
+
runtime syntax/2html.vim
|
28
|
+
endfor
|
29
|
+
call Diff2HTML(winnr)
|
30
|
+
endif
|
31
|
+
unlet g:html_start_line
|
32
|
+
unlet g:html_end_line
|
33
|
+
endfunc
|
34
|
+
func Diff2HTML(vars)
|
35
|
+
let bufnr = []
|
36
|
+
for wind in a:vars
|
37
|
+
let name=bufname(wind) . '.html'
|
38
|
+
if name == '.html'
|
39
|
+
let name='Untitled.html'
|
40
|
+
endif
|
41
|
+
call add(bufnr, bufnr(name))
|
42
|
+
endfor
|
43
|
+
let html = []
|
44
|
+
call add(html, '<html>')
|
45
|
+
call add(html, '<head>')
|
46
|
+
call add(html, '<title>diff</title>')
|
47
|
+
call add(html, '<meta name="Generator" content="Vim/7.2">')
|
48
|
+
call add(html, '<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">')
|
49
|
+
call add(html, '</head>')
|
50
|
+
call add(html, '<body bgcolor="#333333" text="#ffffff"><font face="monospace">')
|
51
|
+
call add(html, '<table border="1" width="100%">')
|
52
|
+
call add(html, '<tr>')
|
53
|
+
for buf in a:vars
|
54
|
+
call add(html, '<th>'.bufname(buf).'</th>')
|
55
|
+
endfor
|
56
|
+
call add(html, '</tr><tr>')
|
57
|
+
for buf in bufnr
|
58
|
+
let temp=[]
|
59
|
+
exe ":" . bufwinnr(buf) . 'wincmd w'
|
60
|
+
1,/<body/d_
|
61
|
+
$
|
62
|
+
?</body>?,$d_
|
63
|
+
let temp=getline(1,'$')
|
64
|
+
call add(html, '<td nowrap valign="top">')
|
65
|
+
let html+=temp
|
66
|
+
call add(html, '</td>')
|
67
|
+
endfor
|
68
|
+
call add(html, '</tr>')
|
69
|
+
call add(html, '</table>')
|
70
|
+
call add(html, '</font>')
|
71
|
+
call add(html, '</body>')
|
72
|
+
call add(html, '</html>')
|
73
|
+
let i=1
|
74
|
+
let name="Diff" . ".html"
|
75
|
+
while filereadable(name)
|
76
|
+
let name = substitute(name, '\d*\.html$', '', '') . i . ".html"
|
77
|
+
let i+=1
|
78
|
+
endw
|
79
|
+
exe ":new " . name
|
80
|
+
set modifiable
|
81
|
+
call append(0,html)
|
82
|
+
endfunc
|
83
|
+
endif
|
metadata
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vim_diff
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Arun Kumar Arjunan
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-06-30 00:00:00.000000000 +05:30
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
description: vim_diff gem uses vim functionality to convert a normal diff to HTML
|
16
|
+
email:
|
17
|
+
- arun.immanuel1608@gmail.com
|
18
|
+
executables:
|
19
|
+
- vim_diff
|
20
|
+
extensions: []
|
21
|
+
extra_rdoc_files: []
|
22
|
+
files:
|
23
|
+
- .gitignore
|
24
|
+
- Gemfile
|
25
|
+
- README
|
26
|
+
- Rakefile
|
27
|
+
- bin/vim_diff
|
28
|
+
- lib/installer.rb
|
29
|
+
- lib/vim_diff.rb
|
30
|
+
- lib/vim_diff/version.rb
|
31
|
+
- vim_diff.gemspec
|
32
|
+
- vim_plugin/tohtml.vim
|
33
|
+
has_rdoc: true
|
34
|
+
homepage: ''
|
35
|
+
licenses: []
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
requirements: []
|
53
|
+
rubyforge_project: vim_diff
|
54
|
+
rubygems_version: 1.6.2
|
55
|
+
signing_key:
|
56
|
+
specification_version: 3
|
57
|
+
summary: Generate diff to HTML
|
58
|
+
test_files: []
|