soywiki 0.5.5 → 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.markdown +2 -1
  2. data/lib/soywiki.rb +1 -1
  3. data/lib/soywiki.vim +13 -12
  4. metadata +2 -2
@@ -181,7 +181,8 @@ commands:
181
181
  while the cursor is on the top line to close the new window
182
182
  * `CTRL-h` does the same, but in a regular split window
183
183
  * `q` closes a split window
184
- * `,H` takes you to the `HomePage` of the current namespace if it exists and you're not already on it. Otherwise, it takes you to `main.HomePage`.
184
+ * `,h` takes you to the `HomePage` of the current namespace
185
+ * `,H` takes you to `main.HomePage`
185
186
 
186
187
  These key mappings may not be very mnemonic, but they are easy to
187
188
  memorize through muscle memory and were chosen to keep the hands
@@ -1,7 +1,7 @@
1
1
  require 'string_ext'
2
2
 
3
3
  module Soywiki
4
- VERSION = '0.5.5'
4
+ VERSION = '0.5.6'
5
5
  WIKI_WORD = /\b([a-z][\w_]+\.)?[A-Z][a-z]+[A-Z]\w*\b/
6
6
  HYPERLINK = %r|\bhttps?://[^ >)\n\]]+|
7
7
 
@@ -24,11 +24,11 @@ func! s:page_title()
24
24
  return substitute(bufname(''), '\/', '.', '')
25
25
  endfunc
26
26
 
27
- func! s:display_missing_namespace_error(num_segments)
27
+ func! s:display_missing_namespace_error(num_segments, page_title)
28
28
  if a:num_segments == 1
29
- call s:error("Invalid wiki page: missing a namespace. Put it in a namespace subdirectory.")
29
+ call s:error("Invalid wiki page: ".a:page_title." is missing a namespace. Put it in a namespace subdirectory.")
30
30
  elseif a:num_segments > 2
31
- call s:error("Invalid wiki page: nested too deeply. Namespaces are limited to one level.")
31
+ call s:error("Invalid wiki page: ".a:page_title." is nested too deeply. Namespaces are limited to one level.")
32
32
  endif
33
33
  endfunc
34
34
 
@@ -37,12 +37,12 @@ func! s:display_invalid_wiki_word_error(word)
37
37
  endfunc
38
38
 
39
39
  func! s:namespace_of_title(page_title)
40
- let segments = split(a:page_title, '\.')
40
+ let segments = split(a:page_title, '[./]')
41
41
  " page must have namespace
42
42
  if len(segments) == 2
43
43
  return get(segments, 0)
44
44
  else
45
- call s:display_missing_namespace_error(len(segments))
45
+ call s:display_missing_namespace_error(len(segments), a:page_title)
46
46
  return ""
47
47
  endif
48
48
  endfunc
@@ -56,7 +56,7 @@ func! s:title_without_namespace(page_title)
56
56
  if len(segments) == 2
57
57
  return "." . get(segments, 1)
58
58
  else
59
- call s:display_missing_namespace_error(len(segments))
59
+ call s:display_missing_namespace_error(len(segments), a:page_title)
60
60
  endif
61
61
  endfunc
62
62
 
@@ -556,12 +556,12 @@ func! s:find_next_href_and_open()
556
556
  endif
557
557
  endfunc
558
558
 
559
- func! s:goto_homepage()
560
- let namespace_home = s:page_namespace()."/HomePage"
561
- if (filereadable(namespace_home)) && bufname('%') != namespace_home
562
- call s:load_page(namespace_home, 0)
563
- else
559
+ func! s:goto_homepage(main)
560
+ if a:main
564
561
  call s:load_page("main.HomePage", 0)
562
+ else
563
+ let namespace_home = s:page_namespace()."/HomePage"
564
+ call s:load_page(namespace_home, 0)
565
565
  endif
566
566
  endfunc
567
567
 
@@ -622,7 +622,8 @@ func! s:prep_buffer()
622
622
  noremap <buffer> <leader>hx :call <SID>expand(0,0)<CR>
623
623
  noremap <buffer> <leader>hX :call <SID>expand(1,0)<CR>
624
624
 
625
- noremap <buffer> <leader>H :call <SID>goto_homepage()<CR>
625
+ noremap <buffer> <leader>h :call <SID>goto_homepage(0)<CR>
626
+ noremap <buffer> <leader>H :call <SID>goto_homepage(1)<CR>
626
627
 
627
628
  noremap <silent> <leader>? :call <SID>show_help()<cr>
628
629
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 5
9
- version: 0.5.5
8
+ - 6
9
+ version: 0.5.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Daniel Choi