Pimki 1.3.092 → 1.4.092

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.
Files changed (88) hide show
  1. data/README +145 -131
  2. data/README-PIMKI +15 -5
  3. data/app/controllers/wiki.rb +167 -54
  4. data/app/models/author.rb +3 -3
  5. data/app/models/chunks/chunk.rb +3 -3
  6. data/app/models/chunks/engines.rb +18 -21
  7. data/app/models/chunks/include.rb +29 -29
  8. data/app/models/chunks/literal.rb +20 -20
  9. data/app/models/chunks/match.rb +19 -19
  10. data/app/models/chunks/nowiki.rb +31 -31
  11. data/app/models/chunks/nowiki_test.rb +14 -14
  12. data/app/models/chunks/test.rb +18 -18
  13. data/app/models/chunks/todo.rb +44 -23
  14. data/app/models/chunks/uri.rb +97 -97
  15. data/app/models/chunks/uri_test.rb +92 -92
  16. data/app/models/chunks/wiki.rb +4 -4
  17. data/app/models/chunks/wiki_symbols.rb +22 -22
  18. data/app/models/chunks/wiki_test.rb +36 -36
  19. data/app/models/page.rb +39 -7
  20. data/app/models/page_lock.rb +23 -23
  21. data/app/models/page_set.rb +72 -72
  22. data/app/models/page_test.rb +75 -75
  23. data/app/models/revision.rb +1 -1
  24. data/app/models/revision_test.rb +251 -251
  25. data/app/models/web.rb +19 -6
  26. data/app/models/web_test.rb +52 -52
  27. data/app/models/wiki_content.rb +131 -119
  28. data/app/models/wiki_service.rb +31 -16
  29. data/app/models/wiki_service_test.rb +15 -15
  30. data/app/models/wiki_words.rb +1 -1
  31. data/app/models/wiki_words_test.rb +12 -12
  32. data/app/views/bottom.rhtml +3 -3
  33. data/app/views/markdown_help.rhtml +15 -15
  34. data/app/views/menu.rhtml +20 -20
  35. data/app/views/navigation.rhtml +26 -26
  36. data/app/views/rdoc_help.rhtml +15 -15
  37. data/app/views/static_style_sheet.rhtml +237 -237
  38. data/app/views/style.rhtml +178 -178
  39. data/app/views/textile_help.rhtml +27 -27
  40. data/app/views/top.rhtml +7 -2
  41. data/app/views/wiki/authors.rhtml +15 -15
  42. data/app/views/wiki/bliki.rhtml +101 -101
  43. data/app/views/wiki/bliki_edit.rhtml +3 -0
  44. data/app/views/wiki/bliki_new.rhtml +3 -0
  45. data/app/views/wiki/bliki_revision.rhtml +90 -90
  46. data/app/views/wiki/edit.rhtml +12 -3
  47. data/app/views/wiki/edit_menu.rhtml +64 -47
  48. data/app/views/wiki/edit_web.rhtml +65 -18
  49. data/app/views/wiki/export.rhtml +14 -14
  50. data/app/views/wiki/feeds.rhtml +10 -10
  51. data/app/views/wiki/list.rhtml +17 -15
  52. data/app/views/wiki/locked.rhtml +13 -13
  53. data/app/views/wiki/login.rhtml +10 -10
  54. data/app/views/wiki/mind.rhtml +0 -1
  55. data/app/views/wiki/new.rhtml +8 -3
  56. data/app/views/wiki/new_system.rhtml +77 -77
  57. data/app/views/wiki/new_web.rhtml +63 -63
  58. data/app/views/wiki/page.rhtml +88 -82
  59. data/app/views/wiki/print.rhtml +15 -15
  60. data/app/views/wiki/published.rhtml +2 -1
  61. data/app/views/wiki/recently_revised.rhtml +31 -31
  62. data/app/views/wiki/revision.rhtml +1 -7
  63. data/app/views/wiki/rollback.rhtml +31 -0
  64. data/app/views/wiki/rss_feed.rhtml +21 -21
  65. data/app/views/wiki/search.rhtml +48 -48
  66. data/app/views/wiki/tex.rhtml +22 -22
  67. data/app/views/wiki/tex_web.rhtml +34 -34
  68. data/app/views/wiki/todo.rhtml +90 -67
  69. data/app/views/wiki/web_list.rhtml +12 -12
  70. data/app/views/wiki_words_help.rhtml +1 -1
  71. data/favicon.png +0 -0
  72. data/libraries/action_controller_servlet.rb +17 -2
  73. data/libraries/bluecloth.rb +1127 -1127
  74. data/libraries/diff/diff.rb +474 -474
  75. data/libraries/diff/diff_test.rb +79 -79
  76. data/libraries/erb.rb +490 -490
  77. data/libraries/madeleine/automatic.rb +418 -357
  78. data/libraries/madeleine/clock.rb +94 -94
  79. data/libraries/madeleine/files.rb +19 -0
  80. data/libraries/madeleine/zmarshal.rb +60 -0
  81. data/libraries/madeleine_service.rb +14 -15
  82. data/libraries/rdocsupport.rb +155 -155
  83. data/libraries/redcloth_for_tex.rb +869 -869
  84. data/libraries/redcloth_for_tex_test.rb +40 -40
  85. data/libraries/view_helper.rb +32 -32
  86. data/libraries/web_controller_server.rb +96 -94
  87. data/pimki.rb +47 -6
  88. metadata +18 -4
@@ -1,92 +1,92 @@
1
- require 'chunks/uri'
2
- require 'chunks/match'
3
- require 'test/unit'
4
-
5
- class URITest < Test::Unit::TestCase
6
- include ChunkMatch
7
-
8
- def test_non_matches
9
- assert_no_match(URIChunk.pattern, 'There is no URI here')
10
- assert_no_match(URIChunk.pattern, 'One gemstone is the garnet:reddish in colour, like ruby')
11
- end
12
-
13
- def test_simple_uri
14
- match(URIChunk, 'http://www.example.com',
15
- :scheme =>'http', :host =>'www.example.com', :path => nil,
16
- :link_text => 'http://www.example.com'
17
- )
18
- match(URIChunk, 'http://www.example.com/',
19
- :scheme =>'http', :host =>'www.example.com', :path => '/',
20
- :link_text => 'http://www.example.com/'
21
- )
22
- match(URIChunk, 'www.example.com',
23
- :scheme =>'http', :host =>'www.example.com', :link_text => 'www.example.com'
24
- )
25
- match(URIChunk, 'example.com',
26
- :scheme =>'http',:host =>'example.com', :link_text => 'example.com'
27
- )
28
- match(URIChunk, 'http://example.com.au/',
29
- :scheme =>'http', :host =>'example.com.au', :link_text => 'http://example.com.au/'
30
- )
31
- match(URIChunk, 'example.com.au',
32
- :scheme =>'http', :host =>'example.com.au', :link_text => 'example.com.au'
33
- )
34
- match(URIChunk, 'http://www.example.co.uk/',
35
- :scheme =>'http', :host =>'www.example.co.uk',
36
- :link_text => 'http://www.example.co.uk/'
37
- )
38
- match(URIChunk, 'example.co.uk',
39
- :scheme =>'http', :host =>'example.co.uk', :link_text => 'example.co.uk'
40
- )
41
- match(URIChunk, 'http://moinmoin.wikiwikiweb.de/HelpOnNavigation',
42
- :scheme => 'http', :host => 'moinmoin.wikiwikiweb.de', :path => '/HelpOnNavigation',
43
- :link_text => 'http://moinmoin.wikiwikiweb.de/HelpOnNavigation'
44
- )
45
- match(URIChunk, 'moinmoin.wikiwikiweb.de/HelpOnNavigation',
46
- :scheme => 'http', :host => 'moinmoin.wikiwikiweb.de', :path => '/HelpOnNavigation',
47
- :link_text => 'moinmoin.wikiwikiweb.de/HelpOnNavigation'
48
- )
49
- end
50
-
51
- def test_email_uri
52
- match(URIChunk, 'mail@example.com',
53
- :user => 'mail', :host => 'example.com', :link_text => 'mail@example.com'
54
- )
55
- end
56
-
57
- def test_non_email
58
- # The @ is part of the normal text, but 'example.com' is marked up.
59
- match(URIChunk, 'Not an email: @example.com', :user => nil, :uri => 'http://example.com')
60
- end
61
-
62
- def test_non_uri
63
- assert_no_match(URIChunk.pattern, 'httpd.conf')
64
- assert_no_match(URIChunk.pattern, 'libproxy.so')
65
- end
66
-
67
- def test_uri_in_text
68
- match(URIChunk, 'Go to: http://www.example.com/', :host => 'www.example.com', :path =>'/')
69
- match(URIChunk, 'http://www.example.com/ is a link.', :host => 'www.example.com')
70
- match(URIChunk,
71
- 'Email david@loudthinking.com',
72
- :scheme =>'mailto', :user =>'david', :host =>'loudthinking.com'
73
- )
74
- end
75
-
76
- def test_uri_in_parentheses
77
- match(URIChunk, 'URI (http://brackets.com.de) in brackets', :host => 'brackets.com.de')
78
- match(URIChunk, 'because (as shown at research.net) the results', :host => 'research.net')
79
- match(URIChunk,
80
- 'A wiki (http://wiki.org/wiki.cgi?WhatIsWiki) page',
81
- :scheme => 'http', :host => 'wiki.org', :path => '/wiki.cgi', :query => 'WhatIsWiki'
82
- )
83
- end
84
-
85
- def test_uri_list_item
86
- match(
87
- URIChunk,
88
- '* http://www.btinternet.com/~mail2minh/SonyEricssonP80xPlatform.sis',
89
- :path => '/~mail2minh/SonyEricssonP80xPlatform.sis'
90
- )
91
- end
92
- end
1
+ require 'chunks/uri'
2
+ require 'chunks/match'
3
+ require 'test/unit'
4
+
5
+ class URITest < Test::Unit::TestCase
6
+ include ChunkMatch
7
+
8
+ def test_non_matches
9
+ assert_no_match(URIChunk.pattern, 'There is no URI here')
10
+ assert_no_match(URIChunk.pattern, 'One gemstone is the garnet:reddish in colour, like ruby')
11
+ end
12
+
13
+ def test_simple_uri
14
+ match(URIChunk, 'http://www.example.com',
15
+ :scheme =>'http', :host =>'www.example.com', :path => nil,
16
+ :link_text => 'http://www.example.com'
17
+ )
18
+ match(URIChunk, 'http://www.example.com/',
19
+ :scheme =>'http', :host =>'www.example.com', :path => '/',
20
+ :link_text => 'http://www.example.com/'
21
+ )
22
+ match(URIChunk, 'www.example.com',
23
+ :scheme =>'http', :host =>'www.example.com', :link_text => 'www.example.com'
24
+ )
25
+ match(URIChunk, 'example.com',
26
+ :scheme =>'http',:host =>'example.com', :link_text => 'example.com'
27
+ )
28
+ match(URIChunk, 'http://example.com.au/',
29
+ :scheme =>'http', :host =>'example.com.au', :link_text => 'http://example.com.au/'
30
+ )
31
+ match(URIChunk, 'example.com.au',
32
+ :scheme =>'http', :host =>'example.com.au', :link_text => 'example.com.au'
33
+ )
34
+ match(URIChunk, 'http://www.example.co.uk/',
35
+ :scheme =>'http', :host =>'www.example.co.uk',
36
+ :link_text => 'http://www.example.co.uk/'
37
+ )
38
+ match(URIChunk, 'example.co.uk',
39
+ :scheme =>'http', :host =>'example.co.uk', :link_text => 'example.co.uk'
40
+ )
41
+ match(URIChunk, 'http://moinmoin.wikiwikiweb.de/HelpOnNavigation',
42
+ :scheme => 'http', :host => 'moinmoin.wikiwikiweb.de', :path => '/HelpOnNavigation',
43
+ :link_text => 'http://moinmoin.wikiwikiweb.de/HelpOnNavigation'
44
+ )
45
+ match(URIChunk, 'moinmoin.wikiwikiweb.de/HelpOnNavigation',
46
+ :scheme => 'http', :host => 'moinmoin.wikiwikiweb.de', :path => '/HelpOnNavigation',
47
+ :link_text => 'moinmoin.wikiwikiweb.de/HelpOnNavigation'
48
+ )
49
+ end
50
+
51
+ def test_email_uri
52
+ match(URIChunk, 'mail@example.com',
53
+ :user => 'mail', :host => 'example.com', :link_text => 'mail@example.com'
54
+ )
55
+ end
56
+
57
+ def test_non_email
58
+ # The @ is part of the normal text, but 'example.com' is marked up.
59
+ match(URIChunk, 'Not an email: @example.com', :user => nil, :uri => 'http://example.com')
60
+ end
61
+
62
+ def test_non_uri
63
+ assert_no_match(URIChunk.pattern, 'httpd.conf')
64
+ assert_no_match(URIChunk.pattern, 'libproxy.so')
65
+ end
66
+
67
+ def test_uri_in_text
68
+ match(URIChunk, 'Go to: http://www.example.com/', :host => 'www.example.com', :path =>'/')
69
+ match(URIChunk, 'http://www.example.com/ is a link.', :host => 'www.example.com')
70
+ match(URIChunk,
71
+ 'Email david@loudthinking.com',
72
+ :scheme =>'mailto', :user =>'david', :host =>'loudthinking.com'
73
+ )
74
+ end
75
+
76
+ def test_uri_in_parentheses
77
+ match(URIChunk, 'URI (http://brackets.com.de) in brackets', :host => 'brackets.com.de')
78
+ match(URIChunk, 'because (as shown at research.net) the results', :host => 'research.net')
79
+ match(URIChunk,
80
+ 'A wiki (http://wiki.org/wiki.cgi?WhatIsWiki) page',
81
+ :scheme => 'http', :host => 'wiki.org', :path => '/wiki.cgi', :query => 'WhatIsWiki'
82
+ )
83
+ end
84
+
85
+ def test_uri_list_item
86
+ match(
87
+ URIChunk,
88
+ '* http://www.btinternet.com/~mail2minh/SonyEricssonP80xPlatform.sis',
89
+ :path => '/~mail2minh/SonyEricssonP80xPlatform.sis'
90
+ )
91
+ end
92
+ end
@@ -43,14 +43,14 @@ module WikiChunk
43
43
 
44
44
  def initialize(match_data, revision)
45
45
  super(match_data, revision)
46
- @escape = match_data[1] || match_data[3]
47
- # @chunk_text = match_data[2] || ''
46
+ @escaped = match_data[1] || match_data[3]
47
+ @text.delete! '\\' if @escaped
48
48
  @page_name = @link_text = match_data[2]
49
49
  end
50
50
 
51
51
  def mask(content) pre_mask + post_mask; end
52
52
  def regexp() Regexp.new(pre_mask + post_mask) end
53
- def escaped_text() (@escape.nil? ? nil : page_name) end
53
+ def escaped_text() (@escaped.nil? ? nil : page_name) end
54
54
  def link_text() WikiWords.separate(page_name) end
55
55
  end
56
56
 
@@ -84,7 +84,7 @@ module WikiChunk
84
84
 
85
85
  def mask(content) pre_mask + post_mask; end
86
86
  def regexp() Regexp.new(pre_mask + post_mask) end
87
- def escaped_text() (@escape.nil? ? nil : page_name) end
87
+ def escaped_text() (@escape.nil? ? nil : page_name) end # TODO: never set?
88
88
  def link_text() WikiWords.separate(page_name) end
89
89
  end
90
90
 
@@ -1,22 +1,22 @@
1
-
2
- class WikiSymbol < Chunk::Abstract
3
- def self.pattern() /<:(.*?)>/ end
4
-
5
- attr_accessor :symbol_code
6
-
7
- def initialize(match_data, revision)
8
- super(match_data, revision)
9
- @symbol_code = match_data[1]
10
- end
11
-
12
- def unmask(content)
13
- tag = case symbol_code
14
- when 'cbx' then '<input type="checkbox" disabled />'
15
- when 'cbxc' then '<input type="checkbox" disabled checked />'
16
- else symbol_code
17
- end
18
-
19
- return self if content.gsub!( Regexp.new(mask(content)), tag )
20
- end
21
- end
22
-
1
+
2
+ class WikiSymbol < Chunk::Abstract
3
+ def self.pattern() /<:(.*?)>/ end
4
+
5
+ attr_accessor :symbol_code
6
+
7
+ def initialize(match_data, revision)
8
+ super(match_data, revision)
9
+ @symbol_code = match_data[1]
10
+ end
11
+
12
+ def unmask(content)
13
+ tag = case symbol_code
14
+ when 'cbx' then '<input type="checkbox" disabled />'
15
+ when 'cbxc' then '<input type="checkbox" disabled checked />'
16
+ else symbol_code
17
+ end
18
+
19
+ return self if content.gsub!( Regexp.new(mask(content)), tag )
20
+ end
21
+ end
22
+
@@ -1,36 +1,36 @@
1
- require 'chunks/wiki'
2
- require 'chunks/match'
3
- require 'test/unit'
4
-
5
- class WikiTest < Test::Unit::TestCase
6
- include ChunkMatch
7
-
8
- def test_simple
9
- match(WikiChunk::Word, 'This is a WikiWord okay?', :page_name => 'WikiWord')
10
- end
11
-
12
- def test_escaped
13
- match(WikiChunk::Word, 'Do not link to an \EscapedWord',
14
- :page_name => 'EscapedWord', :escaped_text => 'EscapedWord'
15
- )
16
- end
17
-
18
- def test_simple_brackets
19
- match(WikiChunk::Link, 'This is a [[bracketted link]]',
20
- :page_name => 'bracketted link', :escaped_text => nil
21
- )
22
- end
23
-
24
- def test_complex_brackets
25
- match(WikiChunk::Link, 'This is a tricky link [[Sperberg-McQueen]]',
26
- :page_name => 'Sperberg-McQueen', :escaped_text => nil
27
- )
28
- end
29
-
30
- # MDR: I'm not sure how to deal with this case just yet...
31
- #
32
- # def test_textile_link
33
- # assert_no_match(WikiChunk::Word.pattern, '"Here is a special link":SpecialLink')
34
- # end
35
-
36
- end
1
+ require 'chunks/wiki'
2
+ require 'chunks/match'
3
+ require 'test/unit'
4
+
5
+ class WikiTest < Test::Unit::TestCase
6
+ include ChunkMatch
7
+
8
+ def test_simple
9
+ match(WikiChunk::Word, 'This is a WikiWord okay?', :page_name => 'WikiWord')
10
+ end
11
+
12
+ def test_escaped
13
+ match(WikiChunk::Word, 'Do not link to an \EscapedWord',
14
+ :page_name => 'EscapedWord', :escaped_text => 'EscapedWord'
15
+ )
16
+ end
17
+
18
+ def test_simple_brackets
19
+ match(WikiChunk::Link, 'This is a [[bracketted link]]',
20
+ :page_name => 'bracketted link', :escaped_text => nil
21
+ )
22
+ end
23
+
24
+ def test_complex_brackets
25
+ match(WikiChunk::Link, 'This is a tricky link [[Sperberg-McQueen]]',
26
+ :page_name => 'Sperberg-McQueen', :escaped_text => nil
27
+ )
28
+ end
29
+
30
+ # MDR: I'm not sure how to deal with this case just yet...
31
+ #
32
+ # def test_textile_link
33
+ # assert_no_match(WikiChunk::Word.pattern, '"Here is a special link":SpecialLink')
34
+ # end
35
+
36
+ end
@@ -17,13 +17,27 @@ class Page
17
17
  revise(content, created_at, author)
18
18
  end
19
19
 
20
- def revise(content, created_at, author)
21
- if !@revisions.empty? && continous_revision?(created_at, author)
22
- @revisions.last.created_at = Time.now
23
- @revisions.last.content = content
24
- @revisions.last.clear_display_cache
25
- else
26
- @revisions << Revision.new(self, @revisions.length, content, created_at, author)
20
+ def revise(content, created_at, author, edit_type='default')
21
+ case edit_type
22
+ when 'major'
23
+ revise_major(content, created_at, author)
24
+
25
+ when 'minor'
26
+ if !@revisions.empty? # sanity check
27
+ revise_minor(content, created_at, author)
28
+ else
29
+ revise_major(content, created_at, author)
30
+ end
31
+
32
+ when 'default'
33
+ if !@revisions.empty? && continous_revision?(created_at, author)
34
+ revise_minor(content, created_at, author)
35
+ else
36
+ revise_major(content, created_at, author)
37
+ end
38
+
39
+ else
40
+ revise_major(content, created_at, author)
27
41
  end
28
42
 
29
43
  web.refresh_pages_with_references(name) if @revisions.length == 1
@@ -61,6 +75,10 @@ class Page
61
75
  def references
62
76
  web.select.pages_that_reference(name)
63
77
  end
78
+
79
+ def bliki_references
80
+ web.select_bliki.pages_that_reference(name)
81
+ end
64
82
 
65
83
  # Returns the original wiki-word name as separate words, so "MyPage" becomes "My Page".
66
84
  def plain_name
@@ -78,6 +96,9 @@ class Page
78
96
  def last_visited() @last_visited || revisions.last.created_at end
79
97
  def viewed() @viewed ||= 0 end
80
98
 
99
+ def has_todos?
100
+ not display_content.find_chunks(Todo).empty?
101
+ end
81
102
 
82
103
  private
83
104
  def continous_revision?(created_at, author)
@@ -88,6 +109,17 @@ class Page
88
109
  def method_missing(method_symbol)
89
110
  revisions.last.send(method_symbol)
90
111
  end
112
+
113
+ def revise_minor(content, created_at, author) #{{{
114
+ @revisions.last.created_at = Time.now
115
+ @revisions.last.content = content
116
+ @revisions.last.clear_display_cache
117
+ end #}}}
118
+
119
+ def revise_major(content, created_at, author) #{{{
120
+ @revisions << Revision.new(self, @revisions.length, content, created_at, author)
121
+ end #}}}
122
+
91
123
  end
92
124
 
93
125
  # jEdit :folding=indent:collapseFolds=1:
@@ -1,24 +1,24 @@
1
- # Contains all the lock methods to be mixed in with the page
2
- module PageLock
3
- LOCKING_PERIOD = 30 * 60 # 30 minutes
4
-
5
- def lock(time, locked_by)
6
- @locked_at, @locked_by = time, locked_by
7
- end
8
-
9
- def lock_duration(time)
10
- ((time - @locked_at) / 60).to_i unless @locked_at.nil?
11
- end
12
-
13
- def unlock
14
- @locked_at = nil
15
- end
16
-
17
- def locked?(comparison_time)
18
- @locked_at + LOCKING_PERIOD > comparison_time unless @locked_at.nil?
19
- end
20
-
21
- def locked_by_link
22
- web.make_link(@locked_by)
23
- end
1
+ # Contains all the lock methods to be mixed in with the page
2
+ module PageLock
3
+ LOCKING_PERIOD = 30 * 60 # 30 minutes
4
+
5
+ def lock(time, locked_by)
6
+ @locked_at, @locked_by = time, locked_by
7
+ end
8
+
9
+ def lock_duration(time)
10
+ ((time - @locked_at) / 60).to_i unless @locked_at.nil?
11
+ end
12
+
13
+ def unlock
14
+ @locked_at = nil
15
+ end
16
+
17
+ def locked?(comparison_time)
18
+ @locked_at + LOCKING_PERIOD > comparison_time unless @locked_at.nil?
19
+ end
20
+
21
+ def locked_by_link
22
+ web.make_link(@locked_by)
23
+ end
24
24
  end