soywiki 0.9.7 → 0.9.8

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6c1e6152993b6e0820791c73ebdea116eef9efff
4
+ data.tar.gz: 7ade48e0f2a70e0f238d2cc6e15f1d7f9c195718
5
+ SHA512:
6
+ metadata.gz: 51957fd552e2ddae5997da054797930e43739a83f2e8edd28d11ecb0e4448af5afdb705e3517c4836b52fc8a59dbb4afd576cebca58a8ffbb5eca30821651313
7
+ data.tar.gz: 4bf43baa95088be55aec5e4d047a1cf6b5005c9be544b1284018e9e117d2c6dcefe6eeb32e44fa4cd04051e83228c65a7a20d0ade060a3aa087ef8d3f7a492bf
File without changes
data/bin/soywiki-rename CHANGED
@@ -1,26 +1,39 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: UTF-8
3
3
  require 'soywiki'
4
+ require 'pathname'
4
5
 
5
- oldname, newname = *ARGV
6
+ repo_path, oldname, newname = *ARGV
7
+ repo_path = Pathname.new(repo_path)
6
8
 
7
9
  MEMO = ["Updating inbound and outbound links..."]
8
10
 
11
+ define_method :portion do |full_path|
12
+ full_path = Pathname.new(full_path) if full_path.is_a?(String)
13
+ full_path.relative_path_from(repo_path).to_s
14
+ end
15
+
16
+ define_method :full do |path|
17
+ path = Pathname.new(path) if path.is_a?(String)
18
+ return path.to_s if path.absolute?
19
+ repo_path.join(path).to_s
20
+ end
21
+
9
22
  def report(file, oldname, newname)
10
23
  MEMO << " - In #{file}: #{oldname.to_page_title} -> #{newname.to_page_title}"
11
24
  end
12
25
 
13
26
  def change_all_absolute_links(oldname, newname)
14
27
  MEMO << "- Updating all absolute links"
15
- target_files = `grep -rlF '#{oldname.to_page_title}' *`.strip.split(/\n/)
28
+ target_files = `grep -rlF '#{portion(oldname).to_page_title}' #{full('')}`.strip.split(/\n/)
16
29
  target_files.select {|f| f !~ /(\.swp|\.swo)$/}.each do |file|
17
30
  text = File.read(file)
18
31
  begin
19
- regex = /\b#{oldname.to_page_title}\b/
32
+ regex = /\b#{portion(oldname).to_page_title}\b/
20
33
  matches = text.scan(regex)
21
- text = text.gsub(regex, newname.to_page_title)
34
+ text = text.gsub(regex, portion(newname).to_page_title)
22
35
  File.open(file, 'w') {|f| f.puts text}
23
- report file, oldname.to_page_title, newname.to_page_title
36
+ report file, portion(oldname).to_page_title, portion(newname).to_page_title
24
37
  rescue
25
38
  puts "Error processing #{file}: #$!"
26
39
  end
@@ -29,13 +42,13 @@ end
29
42
 
30
43
  def change_unqualified_inbound_links_in_same_namespace(oldname, newname)
31
44
  MEMO << "- Updating unqualified inbound links"
32
- target_files = `grep -rlF '#{oldname.short_page_title}' #{oldname.namespace}/*`.strip.split(/\n/)
45
+ target_files = `grep -rlF '#{portion(oldname).short_page_title}' #{full(portion(oldname).namespace)}`.strip.split(/\n/)
33
46
  target_files.select {|f| f !~ /(\.swp|\.swo)$/}.each do |file|
34
47
  text = File.read(file)
35
48
  begin
36
- text = text.gsub(/(\A|\s)(#{oldname.short_page_title}\b)/, '\1' + newname.to_page_title)
49
+ text = text.gsub(/(\A|\s)(#{portion(oldname).short_page_title}\b)/, '\1' + portion(newname).to_page_title)
37
50
  File.open(file, 'w') {|f| f.puts text}
38
- report file, oldname.short_page_title, newname
51
+ report file, portion(oldname).short_page_title, portion(newname)
39
52
  rescue
40
53
  puts "Error processing #{file}: #$!"
41
54
  end
@@ -46,18 +59,18 @@ RELATIVE_LINK_REGEX = /(\A|\s)([A-Z][a-z]+[A-Z0-9]\w*)/
46
59
 
47
60
  def absolutize_unqualified_outbound_links(oldname, newname)
48
61
  MEMO << "Absolutizing unqualified inbound links"
49
- target_file = newname.to_file_path
62
+ target_file = full(newname).to_file_path
50
63
  if File.exist?(target_file)
51
64
  text = File.read(target_file)
52
65
  begin
53
66
  matches = text.scan(RELATIVE_LINK_REGEX).map {|x| x[1]}.
54
67
  select {|match| match.strip != "" }.
55
- select {|match| File.exist?( oldname.namespace + "/#{match}" ) }
68
+ select {|match| File.exist?( portion(oldname).namespace + "/#{match}" ) }
56
69
  puts MEMO << " - In file #{target_file}: matches: #{matches.inspect}"
57
70
 
58
71
  text = text.gsub(RELATIVE_LINK_REGEX) do |match|
59
72
  if matches.include?($2)
60
- res = "#$1#{oldname.namespace}.#{$2}"
73
+ res = "#$1#{portion(oldname).namespace}.#{$2}"
61
74
  MEMO << " - In file #{target_file}: #{$2} -> #{res.strip}"
62
75
  res
63
76
  else
@@ -80,23 +93,22 @@ end
80
93
  # In the directory for OldName's namespace, change all unqualified referenecs to
81
94
  # OldName to NewName
82
95
 
83
- if oldname.namespace == newname.namespace
96
+ if portion(oldname).namespace == portion(newname).namespace
84
97
  MEMO << "- Updating unqualified links in same namespace"
85
- target_files = `grep -rlF '#{oldname.short_page_title}' #{oldname.namespace}/*`.strip.split(/\n/)
98
+ target_files = `grep -rlF '#{portion(oldname).short_page_title}' #{full(portion(oldname).namespace)}`.strip.split(/\n/)
86
99
  target_files.select {|f| f !~ /(\.swp|\.swo)$/}.each do |file|
87
100
  text = File.read(file)
88
101
  begin
89
- text = text.gsub(/(\A|\s)(#{oldname.short_page_title})\b/, '\1' + newname.short_page_title)
102
+ text = text.gsub(/(\A|\s)(#{portion(oldname).short_page_title})\b/, '\1' + portion(newname).short_page_title)
90
103
  File.open(file, 'w') {|f| f.puts text}
91
- report file, oldname.short_page_title, newname.short_page_title
104
+ report file, portion(oldname).short_page_title, portion(newname).short_page_title
92
105
  rescue
93
106
  puts "Error processing #{file}: #$!"
94
107
  end
95
108
  end
96
- end
97
-
98
109
  # Case 2: newname is in different namespace from oldname
99
- if oldname.namespace != newname.namespace
110
+ # oldname.namespace != newname.namespace
111
+ else
100
112
  # In the directory for OldName's namespace, change all unqualified references to
101
113
  # OldName to newnamespace.NewName (i.e. NewName).
102
114
  change_unqualified_inbound_links_in_same_namespace(oldname, newname)
data/lib/soywiki.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'string_ext'
2
2
  module Template_Substitution; end
3
3
  module Soywiki
4
- VERSION = '0.9.7'
4
+ VERSION = '0.9.8'
5
5
  WIKI_WORD = /\b([a-z0-9][\w_]+\.)?[A-Z][a-z]+[A-Z0-9]\w*\b/
6
6
  SCHEMES = %w{https http file soyfile}
7
7
  HYPERLINK = %r|\b(?:#{SCHEMES.join('|')})://[^ >)\n\]]+|
data/lib/soywiki.vim CHANGED
@@ -22,6 +22,10 @@ let s:expand_command = 'soywiki-expand '
22
22
  let s:ls_command = 'soywiki-ls-t '
23
23
  let s:search_for_link = ""
24
24
 
25
+ if !exists("g:soywiki_filetype")
26
+ let g:soywiki_filetype = 'txt'
27
+ endif
28
+
25
29
  func! s:trimString(string)
26
30
  let string = substitute(a:string, '\s\+$', '', '')
27
31
  return substitute(string, '^\s\+', '', '')
@@ -293,7 +297,8 @@ func! s:rename_page(page_path_or_title)
293
297
  echo system("mv " . original_file . " " . newfile)
294
298
  endif
295
299
  call system("git commit -am 'rename wiki page'")
296
- exec "!" . s:rename_links_command . original_file . " " . newfile
300
+ let &buftype = "nofile"
301
+ exec "!" . s:rename_links_command . s:wiki_root() . " " . original_file . " " . newfile
297
302
  call system("git commit -am 'rename wiki links'")
298
303
  exec "e " . newfile
299
304
  else
@@ -690,7 +695,7 @@ endfunc
690
695
  func! s:prep_buffer()
691
696
  if (s:is_wiki_page() && !exists("b:mappings_loaded"))
692
697
  " let user decide on the textwidth
693
- set filetype=txt
698
+ let &filetype=g:soywiki_filetype
694
699
  nnoremap <buffer> <cr> :call <SID>follow_link_under_cursor(0)<cr>
695
700
  nnoremap <buffer> <c-l> :call <SID>follow_link_under_cursor(2)<cr>
696
701
  nnoremap <buffer> <c-h> :call <SID>follow_link_under_cursor(1)<cr>
data/soywiki.gemspec CHANGED
@@ -6,6 +6,7 @@ Gem::Specification.new do |s|
6
6
  s.name = "soywiki"
7
7
  s.version = Soywiki::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
+ s.licenses = ['MIT']
9
10
  s.authors = ["Daniel Choi"]
10
11
  s.email = ["dhchoi@gmail.com"]
11
12
  s.homepage = "http://danielchoi.com/software/soywiki.html"
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soywiki
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.7
5
- prerelease:
4
+ version: 0.9.8
6
5
  platform: ruby
7
6
  authors:
8
7
  - Daniel Choi
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-09-21 00:00:00.000000000 Z
11
+ date: 2014-01-24 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: A personal and collaborative wiki for Vim users
15
14
  email:
@@ -23,7 +22,7 @@ executables:
23
22
  extensions: []
24
23
  extra_rdoc_files: []
25
24
  files:
26
- - .gitignore
25
+ - ".gitignore"
27
26
  - Gemfile
28
27
  - Gemfile.lock
29
28
  - MIT-LICENSE.txt
@@ -44,31 +43,37 @@ files:
44
43
  - plugin/soywiki_starter.vim
45
44
  - soywiki.gemspec
46
45
  homepage: http://danielchoi.com/software/soywiki.html
47
- licenses: []
48
- post_install_message: ! "For optional compilation of the wiki to html you will need:\n
49
- - haml\nand for markdown support:\n - rdiscount\n"
46
+ licenses:
47
+ - MIT
48
+ metadata: {}
49
+ post_install_message: |
50
+ For optional compilation of the wiki to html you will need:
51
+ - haml
52
+ and for markdown support:
53
+ - rdiscount
50
54
  rdoc_options: []
51
55
  require_paths:
52
56
  - lib
53
57
  required_ruby_version: !ruby/object:Gem::Requirement
54
- none: false
55
58
  requirements:
56
- - - ! '>='
59
+ - - ">="
57
60
  - !ruby/object:Gem::Version
58
61
  version: '0'
59
62
  required_rubygems_version: !ruby/object:Gem::Requirement
60
- none: false
61
63
  requirements:
62
- - - ! '>='
64
+ - - ">="
63
65
  - !ruby/object:Gem::Version
64
66
  version: '0'
65
67
  requirements:
66
- - ! "For optional compilation of the wiki to html you will need:\n - haml\nand for
67
- markdown support:\n - rdiscount\n"
68
+ - |
69
+ For optional compilation of the wiki to html you will need:
70
+ - haml
71
+ and for markdown support:
72
+ - rdiscount
68
73
  rubyforge_project: soywiki
69
- rubygems_version: 1.8.23
74
+ rubygems_version: 2.2.0
70
75
  signing_key:
71
- specification_version: 3
76
+ specification_version: 4
72
77
  summary: Wiki with Vim interface and Git repo
73
78
  test_files: []
74
79
  has_rdoc: