soywiki 0.2.9 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -4,7 +4,7 @@ SoyWiki turns Vim into a powerful, lean, and fast wiki. It's got all the
4
4
  protein of a more conventional wiki, but less saturated fat and no
5
5
  cholesterol.
6
6
 
7
- A quick overview of its characteristics and features:
7
+ A quick overview of SoyWiki's characteristics and features:
8
8
 
9
9
  * flat text files
10
10
  * maximum data portability
@@ -112,16 +112,18 @@ link them together. You'll be surprised at how powerful this simple mechanism
112
112
  is for organizing your notes.
113
113
 
114
114
  In SoyWiki, a wiki page is a simple text file that has a WikiWord title
115
- on the first line (don't alter this line) and any text your want to
116
- insert below that. SoyWiki will create stub WikiPages for you
117
- automatically as you traverse WikiLinks that don't yet reference any
118
- content.
115
+ on the first line and any text your want to insert below that. (You may
116
+ alter the title line at the top, but it helps you see what wiki page
117
+ you're on.) SoyWiki will create stub WikiPages for you automatically as
118
+ you traverse WikiLinks that don't yet reference any content.
119
119
 
120
120
  That's all you need to know to get started.
121
121
 
122
122
  ## Namespaced WikiWords
123
123
 
124
124
  Every WikiWord in SoyWiki is implicitly or explicitly namespaced.
125
+ SoyWiki's namespaced WikiWords help organize your wiki space
126
+ conceptually. They also help reduce clutter in your wiki directory.
125
127
 
126
128
  An explicitly namespaced WikiWord looks like this:
127
129
 
@@ -134,13 +136,18 @@ The implicitly namespaced form looks just like a conventional WikiWord:
134
136
  A namespace must start with a lower-case letter and consist only of letters,
135
137
  numbers, and underscore characters.
136
138
 
137
- Within a WikiWord namespace you can use unqualified WikiWords to link pages
138
- within that namespace together. For example, if you are editing a page called
139
- `recipes.SoyMacaroni` and you want to link to a page called
139
+ Within a WikiWord namespace you can use unqualified WikiWords to link
140
+ pages within that namespace together. For example, if you are editing a
141
+ page called `recipes.SoyMacaroni` and you want to link to a page called
140
142
  `recipes.SoyRaspberrySmoothie`, you can type a link called
141
143
  `SoyRaspberrySmoothie`. SoyWiki will treat this link as an implicitly
142
144
  namespaced link to another page in the `recipes` namespace.
143
145
 
146
+ SoyWiki wiki pages are stored as text files named by WikiWord within
147
+ subdirectories named after their namespace. So
148
+ `recipes.SoyRaspberrySmoothie` would be written to
149
+ `recipes/SoyRaspberrySmoothie`.
150
+
144
151
  You can't chain namespace words together. The maximum nesting level is 1. More
145
152
  nesting would imply hierarchical relationships, and permitting hierarchical
146
153
  nesting goes against the grain of what a wiki is, which is an [undirected
@@ -151,8 +158,6 @@ wiki page" below to see how you can use SoyWiki like an outliner program.
151
158
 
152
159
  [graph]:http://en.wikipedia.org/wiki/Graph_theory
153
160
 
154
- SoyWiki's namespaced WikiWords help organize your wiki space conceptually.
155
- They also help reduce clutter in your wiki directory.
156
161
 
157
162
  When you start SoyWiki for the first time, the active namespace is the default
158
163
  namespace `main`. `main.HomePage` is the first page you will see.
@@ -180,6 +185,9 @@ and forth in your jump history. See `:help jump-motions` for more on
180
185
  this. You can press `CTRL-^` to toggle between the current page and the
181
186
  last page you looked at.
182
187
 
188
+ * `,m` opens the page list
189
+ * `,M` opens the inbound links page list
190
+
183
191
  You can view all the pages in your wiki, most recently modified first,
184
192
  by pressing `,m`. This opens both a page list and autocompletion window.
185
193
  You can use the standard Vim autocompletion commands here to find the
@@ -190,8 +198,11 @@ When you're on a wiki page and you want to see all the other wiki pages
190
198
  that link in to it, press `,M`. If there is only one page that links in,
191
199
  you'll be taken there automatically.
192
200
 
193
- `,o` opens the first normal web hyperlink -- the ones that begin with http://
194
- or https:// -- on or after the cursor in your default web browser.
201
+ * `,o` opens the first web hyperlink on or after the cursor
202
+
203
+ `,o` opens the next hyperlink on or after the cursor. These are the URLs
204
+ that begin with http:// or https://. You can also use `ENTER` when the
205
+ cursor is over a web hyperlink.
195
206
 
196
207
  Under the covers, SoyWiki uses the command `gnome-open` or `open` to
197
208
  launch your web browser. This should cover Linux Gnome desktop and OS X
@@ -202,8 +213,14 @@ adding this to your `~/.vimrc`:
202
213
 
203
214
  If your Vim has `netrw`, you can open a hyperlink directly in same Vim
204
215
  window by putting the cursor at the beginning of a hyperlink and typing
205
- `gf`, or `C-w f` if you want to open the webpage in a split window. See
206
- `:help netrw` for more information.
216
+ `gf`, or `C-w f` if you want to open the webpage in a split window.
217
+ See `:help netrw` for more information.
218
+
219
+ Tip: I personally like using `netrw` (configured to use elinks) a lot
220
+ more than using a conventional web browser, because it lets me keep all
221
+ my URL bookmarks in regular text files and open, clip, and annotate them
222
+ all in SoyWiki and Vim.
223
+
207
224
 
208
225
  ## WikiLink autocompletion
209
226
 
@@ -268,8 +285,8 @@ same wiki page.
268
285
 
269
286
  ## Search
270
287
 
271
- * `:SWSearch` [term]
272
- * `:SWNamespaceSearch` [term]
288
+ * `:SWSearch [term]`
289
+ * `:SWNamespaceSearch [term]`
273
290
 
274
291
  These commands search your SoyWiki wiki. `:SWNamespaceSearch` confines
275
292
  your search to the current namespace.
@@ -282,11 +299,11 @@ QuickFix commands.
282
299
 
283
300
  Examples:
284
301
 
285
- :SWSearch Gnu
286
- :SWNamespaceSearch Gnu
302
+ :SWSearch gnu
303
+ :SWNamespaceSearch gnu
287
304
 
288
305
  You can use `:SWS` as a shortcut for `:SWSearch`. You can also
289
- tab-complete `:SWNS` to `:SWSNamespaceSearch`.
306
+ tab-complete `:SWN` to `:SWNamespaceSearch`.
290
307
 
291
308
  Searches are case-insensitve.
292
309
 
@@ -318,9 +335,9 @@ You can always bypass Vim and SoyWiki altogether and use Git directly to
318
335
  inspect your revision history. The Git repo for your SoyWiki wiki will
319
336
  be located in the same directory as your wiki files.
320
337
 
321
- To sync your SoyWiki wiki between two personal computers, you can follow the
322
- instructions [here][git-sync] or you can set up an bare Git repository
323
- upstream on some server for all your computers to push to and pull from.
338
+ To sync your SoyWiki wiki between two personal computers, you can follow
339
+ the instructions [here][git-sync] and set up an bare Git repository on
340
+ some server for all your computers to push to and pull from.
324
341
 
325
342
  [git-sync]:http://www-cs-students.stanford.edu/~blynn/gitmagic/ch03.html
326
343
 
@@ -397,10 +414,10 @@ following reasons:
397
414
  * Besides being the original, CamelCase is the most elegantly minimalist approach to linking wiki pages together -- "with no additional markup whatsoever," [as Ward Cunninghamb put it][ward].
398
415
  * It encourages you more than other wiki link patterns to create wiki pages with succinctly descriptive names that are easy to remember.
399
416
  * Because the link pattern is so minimal and succinct, writing
400
- them interrupts your flow of thought a lot less than other wiki patterns.
417
+ them interrupts your flow of thought less than other wiki link patterns.
401
418
  * It is very conducive to storing
402
419
  wiki pages in plain text files: the page names can map directly to Unix
403
- file names without any awkward character escaping.
420
+ file names without any awkward character escaping or munging.
404
421
 
405
422
  [ward]:http://c2.com/cgi/wiki?WikiCase
406
423
 
data/bin/soywiki-rename CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # encoding: UTF-8
2
3
  require 'soywiki'
3
4
 
4
5
  oldname, newname = *ARGV
@@ -14,11 +15,15 @@ def change_all_absolute_links(oldname, newname)
14
15
  target_files = `grep -rlF '#{oldname.to_page_title}' *`.strip.split(/\n/)
15
16
  target_files.each do |file|
16
17
  text = File.read(file)
17
- regex = /\b#{oldname.to_page_title}\b/
18
- matches = text.scan(regex)
19
- text.gsub!(regex, newname.to_page_title)
20
- File.open(file, 'w') {|f| f.puts text}
21
- report file, oldname.to_page_title, newname.to_page_title
18
+ begin
19
+ regex = /\b#{oldname.to_page_title}\b/
20
+ matches = text.scan(regex)
21
+ text.gsub!(regex, newname.to_page_title)
22
+ File.open(file, 'w') {|f| f.puts text}
23
+ report file, oldname.to_page_title, newname.to_page_title
24
+ rescue
25
+ puts "Error processing #{file}: #$!"
26
+ end
22
27
  end
23
28
  end
24
29
 
@@ -27,9 +32,13 @@ def change_unqualified_inbound_links_in_same_namespace(oldname, newname)
27
32
  target_files = `grep -rlF '[^.]#{oldname.short_page_title}' #{oldname.namespace}/*`.strip.split(/\n/)
28
33
  target_files.each do |file|
29
34
  text = File.read(file)
30
- text.gsub!(/(\A|\s)#{oldname.short_page_title}\b/, "." + newname)
31
- File.open(file, 'w') {|f| f.puts text}
32
- report file, oldname.short_page_title, newname
35
+ begin
36
+ text.gsub!(/(\A|\s)#{oldname.short_page_title}\b/, "." + newname)
37
+ File.open(file, 'w') {|f| f.puts text}
38
+ report file, oldname.short_page_title, newname
39
+ rescue
40
+ puts "Error processing #{file}: #$!"
41
+ end
33
42
  end
34
43
  end
35
44
 
@@ -40,10 +49,14 @@ def absolutize_unqualified_outbound_links(oldname, newname)
40
49
  target_file = newname.to_file_path
41
50
  if File.exist?(target_file)
42
51
  text = File.read(target_file)
43
- matches = text.scan(RELATIVE_LINK_REGEX)
44
- text.gsub!(RELATIVE_LINK_REGEX, oldname.namespace + '.\1')
45
- File.open(target_file, 'w') {|f| f.puts text}
46
- MEMO << " - In file #{target_file}: Absolutized these unqualified links: #{matches.inspect}"
52
+ begin
53
+ matches = text.scan(RELATIVE_LINK_REGEX)
54
+ text.gsub!(RELATIVE_LINK_REGEX, oldname.namespace + '.\1')
55
+ File.open(target_file, 'w') {|f| f.puts text}
56
+ MEMO << " - In file #{target_file}: Absolutized these unqualified links: #{matches.inspect}"
57
+ rescue
58
+ puts "Error processing #{file}: #$!"
59
+ end
47
60
  end
48
61
  end
49
62
 
@@ -60,9 +73,13 @@ if oldname.namespace == newname.namespace
60
73
  target_files = `grep -rlF '#{oldname.short_page_title}' #{oldname.namespace}/*`.strip.split(/\n/)
61
74
  target_files.each do |file|
62
75
  text = File.read(file)
63
- text.gsub!(/(\A\s)(#{oldname.short_page_title})\b/, newname.short_page_title)
64
- File.open(file, 'w') {|f| f.puts text}
65
- report file, oldname.short_page_title, newname.short_page_title
76
+ begin
77
+ text.gsub!(/(\A\s)(#{oldname.short_page_title})\b/, newname.short_page_title)
78
+ File.open(file, 'w') {|f| f.puts text}
79
+ report file, oldname.short_page_title, newname.short_page_title
80
+ rescue
81
+ puts "Error processing #{file}: #$!"
82
+ end
66
83
  end
67
84
  end
68
85
 
data/lib/soywiki.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'string_ext'
2
2
 
3
3
  module Soywiki
4
- VERSION = '0.2.9'
4
+ VERSION = '0.3.0'
5
5
  WIKI_WORD = /\b([a-z][\w_]+\.)?[A-Z][a-z]+[A-Z]\w*\b/
6
6
  HYPERLINK = %r|\bhttps?://[^ >)\n\]]+|
7
7
 
data/lib/soywiki.vim CHANGED
@@ -236,6 +236,7 @@ func! s:rename_page(page_path_or_title)
236
236
  return
237
237
  endif
238
238
  if s:valid_wiki_word(page_title)
239
+ write!
239
240
  let original_file = bufname('')
240
241
  echo system("git mv " . original_file . " " . newfile)
241
242
  exec "!" . s:rename_links_command . original_file . " " . newfile
@@ -45,6 +45,11 @@
45
45
  <span class="st_twitter_large" displayText="Tweet"></span><span class="st_facebook_large" displayText="Facebook"></span><span class="st_ybuzz_large" displayText="Yahoo! Buzz"></span><span class="st_gbuzz_large" displayText="Google Buzz"></span><span class="st_email_large" displayText="Email"></span><span class="st_sharethis_large" displayText="ShareThis"></span>
46
46
 
47
47
  <iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fdanielchoi.com%2Fsoftware%2Fsoywiki.html&amp;layout=button_count&amp;show_faces=false&amp;width=50&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:120px; height:25px; margin-top:6px;"></iframe>
48
+ <br/>
49
+ <a href="http://twitter.com/share"
50
+ class="twitter-share-button"
51
+ data-url="http://danielchoi.com/software/soywiki.html"
52
+ data-text="SoyWiki" data-count="horizontal">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
48
53
 
49
54
  <div class="also-by">
50
55
  <h4>also by this developer</h4>
@@ -1,5 +1,3 @@
1
- ## Screenshots
2
-
3
1
  <a href="images-soywiki/page-select.png" rel="lightbox[screens]"><img src="images-soywiki/sm-page-select.png" /></a>
4
2
  <a href="images-soywiki/search.png" rel="lightbox[screens]"><img src="images-soywiki/sm-search.png" /></a>
5
3
  <a href="images-soywiki/expand.png" rel="lightbox[screens]"><img src="images-soywiki/sm-expand.png" /></a>
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
8
- - 9
9
- version: 0.2.9
7
+ - 3
8
+ - 0
9
+ version: 0.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Daniel Choi