public
Fork of sr/git-wiki
Description: A wiki engine that uses a Git repository as its data store.
Homepage: http://atonie.org/2008/02/git-wiki
Clone URL: git://github.com/al3x/git-wiki.git
remove dependency on ultraviolet and code highlighting; too much hackery 
for a disappointing result
al3x (author)
Fri Mar 14 23:54:16 -0700 2008
commit  14d211cfcdcf1c171e2bd7b469c0649bcb68acec
tree    ec98fda94395549d9b5bc0a9c911a5cb568f2c09
parent  06f53f5f3843797f2ebba6408b730f2c7442a7d1
0
...
1
2
3
4
5
 
6
7
8
...
23
24
25
 
26
27
28
29
30
 
 
31
32
33
...
1
2
 
3
 
4
5
6
7
...
22
23
24
25
26
27
28
 
 
29
30
31
32
33
0
@@ -1,8 +1,7 @@
0
 = SOON
0
   * repo stats/info/maintenance page
0
- * in-place editing
0
   * deleting pages
0
- * pushing repo
0
+ * pushing repo from web interface
0
 
0
 = CHACON IDEAS
0
   * inter-branch links
0
@@ -23,11 +22,12 @@
0
   * working launchd plist
0
   
0
 = DONE
0
+ * in-place editing
0
   * fix duplication of routes/methods to accommodate file extensions
0
   * "append selected text/link to page" bookmarklet (shamelessly cribbed
0
     from Trsly/Instapaper)
0
- * allow "code pages" by supporting file extensions, applying syntax
0
- highlighting
0
+ * allow "code pages" by supporting file extensions, applying syntax
0
+ highlighting (removed March 14 2008 by al3x, may add back in)
0
   * next/previous commit links on pages
0
   * pretty stylesheet
0
   
...
2
3
4
5
 
6
7
8
9
10
11
 
12
13
14
...
2
3
4
 
5
6
7
8
9
 
 
10
11
12
13
0
@@ -2,13 +2,12 @@ require 'rubygems'
0
 require 'extensions'
0
 require 'page'
0
 
0
-%w(git redcloth rubypants uv).each do |gem|
0
+%w(git redcloth rubypants).each do |gem|
0
   require_gem_with_feedback gem
0
 end
0
 
0
 GIT_REPO = ARGV[0] || ENV['HOME'] + '/wiki'
0
-HOMEPAGE = 'Home'
0
-UV_THEME = 'idle'
0
+HOMEPAGE = 'home'
0
 
0
 unless File.exists?(GIT_REPO) && File.directory?(GIT_REPO)
0
   puts "Initializing repository in #{GIT_REPO}..."
...
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
...
18
19
20
 
 
 
 
 
 
 
 
 
 
 
 
 
21
0
@@ -18,16 +18,3 @@ class Time
0
     "#{(self.to_i * 1000)}"
0
   end
0
 end
0
-
0
-module Uv
0
- def Uv.syntax_for_file_extension(ext)
0
- ext.delete!(".")
0
- return ext if Uv.syntaxes.include?(ext)
0
-
0
- equivs = { 'js' => 'javascript',
0
- 'pl' => 'perl',
0
- 'py' => 'python',
0
- 'rb' => 'ruby' }
0
- equivs[ext]
0
- end
0
-end
0
\ No newline at end of file
...
12
13
14
15
 
16
17
18
...
22
23
24
25
 
26
27
28
29
30
31
 
32
33
34
35
36
 
37
38
39
40
41
42
 
43
44
 
45
46
47
48
49
 
50
51
52
53
54
55
56
57
 
 
 
58
59
60
61
62
63
64
 
 
 
65
66
67
68
 
69
70
71
...
145
146
147
148
149
150
151
152
153
154
155
156
...
12
13
14
 
15
16
17
18
...
22
23
24
 
25
26
27
28
29
30
 
31
32
33
34
35
 
36
37
38
39
40
41
 
42
43
 
44
45
46
47
48
 
49
50
51
52
 
 
 
 
 
53
54
55
56
57
 
 
 
 
 
58
59
60
61
62
63
 
64
65
66
67
...
141
142
143
 
 
 
 
 
 
144
145
146
0
@@ -12,7 +12,7 @@ end
0
 
0
 get '/:page' do
0
   @page_url = page_url
0
- @page = Page.new(page_with_ext)
0
+ @page = Page.new(params[:page])
0
   @page.tracked? ? show(:show, @page.name) : redirect('/e/' + @page.name)
0
 end
0
 
0
@@ -22,50 +22,46 @@ get '/:page/raw' do
0
 end
0
 
0
 get '/:page/append' do
0
- @page = Page.new(page_with_ext)
0
+ @page = Page.new(params[:page])
0
   @page.body = @page.raw_body + "\n\n" + params[:text]
0
   redirect '/' + @page.name
0
 end
0
 
0
 get '/e/:page' do
0
- @page = Page.new(page_with_ext)
0
+ @page = Page.new(params[:page])
0
   show :edit, "Editing #{@page.name}"
0
 end
0
 
0
 post '/e/:page' do
0
- @page = Page.new(page_with_ext)
0
+ @page = Page.new(params[:page])
0
   @page.update(params[:body], params[:message])
0
   redirect '/' + @page.name
0
 end
0
 
0
 post '/eip/:page' do
0
- @page = Page.new(page_with_ext)
0
+ @page = Page.new(params[:page])
0
   @page.update(params[:body])
0
- @page = Page.new(page_with_ext)
0
+ @page = Page.new(params[:page])
0
   @page.body
0
 end
0
 
0
 get '/h/:page' do
0
- @page = Page.new(page_with_ext)
0
+ @page = Page.new(params[:page])
0
   show :history, "History of #{@page.name}"
0
 end
0
 
0
-['/h/:page/:rev', '/h/:page.:format/:rev'].each do |r|
0
- get r do
0
- @page = Page.new(page_with_ext, params[:rev])
0
- show :show, "#{@page.name} (version #{params[:rev]})"
0
- end
0
+get '/h/:page/:rev' do
0
+ @page = Page.new(params[:page], params[:rev])
0
+ show :show, "#{@page.name} (version #{params[:rev]})"
0
 end
0
 
0
-['/d/:page/:rev', '/d/:page.:format/:rev'].each do |r|
0
- get r do
0
- @page = Page.new(page_with_ext)
0
- show :delta, "Diff of #{@page.name}"
0
- end
0
+get '/d/:page/:rev' do
0
+ @page = Page.new(params[:page])
0
+ show :delta, "Diff of #{@page.name}"
0
 end
0
 
0
 get '/a/patch/:page/:rev' do
0
- @page = Page.new(page_with_ext)
0
+ @page = Page.new(params[:page])
0
   header 'Content-Type' => 'text/x-diff'
0
   header 'Content-Disposition' => 'filename=patch.diff'
0
   @page.delta(params[:rev])
0
@@ -145,12 +141,6 @@ def page_url
0
   "#{request.env["rack.url_scheme"]}://#{request.env["HTTP_HOST"]}#{request.env["REQUEST_PATH"]}"
0
 end
0
 
0
-def page_with_ext
0
- return params[:page] unless params[:format]
0
- puts "FORMAT #{params[:format]}"
0
- "#{params[:page]}.#{params[:format]}"
0
-end
0
-
0
 private
0
 
0
   def show(template, title)
...
1
2
3
4
5
...
10
11
12
13
14
15
16
17
18
 
19
20
21
...
 
 
1
2
3
...
8
9
10
 
 
 
 
 
 
11
12
13
14
0
@@ -1,5 +1,3 @@
0
-require 'uv'
0
-
0
 class Page
0
   attr_reader :name
0
 
0
@@ -10,12 +8,7 @@ class Page
0
   end
0
 
0
   def body
0
- ext = File.extname(@filename)
0
- unless ext.empty?
0
- @body ||= Uv.parse(raw_body, "xhtml", Uv.syntax_for_file_extension(ext), false, UV_THEME)
0
- else
0
- @body ||= RubyPants.new(RedCloth.new(raw_body).to_html).to_html.wiki_linked
0
- end
0
+ @body ||= RubyPants.new(RedCloth.new(raw_body).to_html).to_html.wiki_linked
0
   end
0
   
0
   def branch_name
...
73
74
75
76
77
78
 
 
 
79
80
81
...
73
74
75
 
 
76
77
78
79
80
81
82
0
@@ -73,9 +73,10 @@ ul {
0
 }
0
 
0
 .edit textarea {
0
- min-width: 100%;
0
- max-height: 300px;
0
   display: block;
0
+ margin-bottom: 5px;
0
+ max-height: 300px;
0
+ min-width: 100%;
0
 }
0
 
0
 .nav_link, .nav_link:visited {
...
9
10
11
12
 
13
14
15
...
9
10
11
 
12
13
14
15
0
@@ -9,7 +9,7 @@
0
 </div>
0
 
0
 <div class="content">
0
- <form method="post" action="/e/<%= page_with_ext %>">
0
+ <form method="post" action="/e/<%= @page.name %>">
0
     <textarea name="body" id="edit_textarea"><%= @page.raw_body %></textarea>
0
     Message:
0
     <textarea name="message" rows="4" id="message_textarea"></textarea>
...
13
14
15
 
16
17
18
...
13
14
15
16
17
18
19
0
@@ -13,6 +13,7 @@
0
     });
0
   });
0
 </script>
0
+
0
 <h1><%= @page.name %></h1>
0
 
0
 <%= @env %>

Comments

    No one has commented yet.