Pimki 1.3.092 → 1.4.092

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -7,7 +7,10 @@ require "zip/zip"
7
7
  class Web
8
8
  attr_accessor :pages, :name, :address, :password, :menu_type, :menu_content, :rendered_menu, :menu_limit, :menu_category
9
9
  attr_accessor :markup, :color, :safe_mode, :additional_style, :published, :brackets_only, :count_pages
10
- attr_accessor :mind_map_size, :symbols_map, :links_map
10
+ attr_accessor :mind_map_size, :symbols_map, :links_map, :enable_dclick_edit, :check_pass_on_edit
11
+
12
+ # Mind Map defaults
13
+ attr_accessor :mm_prog, :mm_graph_type, :mm_show_missing, :mm_show_authors, :mm_show_leaves, :mm_selected_categories
11
14
 
12
15
  @@BLIKI_TEMPLATE = "Try a weekly worksheet:\n\n| / | *Morning* | *Afternoon* |\n" +
13
16
  "| *Mon* | - | - |\n| *Tue* | - | - |\n| *Wed* | - | - |\n" +
@@ -38,6 +41,10 @@ class Web
38
41
  PageSet.new(self, @pages.values, accept)
39
42
  end
40
43
 
44
+ def select_bliki(&accept)
45
+ PageSet.new(self, bliki.values, accept)
46
+ end
47
+
41
48
  def revised_on
42
49
  select.most_recent_revision
43
50
  end
@@ -63,7 +70,7 @@ class Web
63
70
  if page then "<a class=\"existingWikiWord\" href=\"#{link}.html\">#{text}</a>"
64
71
  else "<span class=\"newWikiWord\">#{text}</span>" end
65
72
  when :publish
66
- if page then "<a class=\"existingWikiWord\" href=\"../show/#{link}\">#{text}</a>"
73
+ if page then "<a class=\"existingWikiWord\" href=\"../published/#{link}\">#{text}</a>"
67
74
  else "<span class=\"newWikiWord\">#{text}</span>" end
68
75
  else
69
76
  if page then "<a class=\"existingWikiWord\" href=\"../show/#{link}\">#{text}</a>"
@@ -81,6 +88,7 @@ class Web
81
88
 
82
89
  def refresh_revisions
83
90
  select.each { |page| page.revisions.each { |revision| revision.clear_display_cache } }
91
+ select_bliki.each { |page| page.revisions.each { |revision| revision.clear_display_cache } }
84
92
  end
85
93
 
86
94
  # Default values
@@ -88,14 +96,19 @@ class Web
88
96
  def color() @color || "008B26" end
89
97
  def brackets_only() @brackets_only || false end
90
98
  def count_pages() @count_pages || false end
91
- def menu_content() @menu_content || '' end
99
+ def menu_content() @menu_content || nil end
92
100
  def menu_limit() @menu_limit || 20 end
93
101
  def menu_type()
94
102
  (@menu_type.nil? || @menu_type.empty?) ? 'linkers' : @menu_type
95
103
  end
96
- def mind_map_size() (@mind_map_size == '0,0' ? '6,5' : @mind_map_size) end
97
-
98
-
104
+ def mind_map_size() (@mind_map_size == '0,0' ? '6,5' : @mind_map_size) end
105
+ def mm_prog() @mm_prog || 'neato' end
106
+ def mm_graph_type() @mm_graph_type || 'normal' end
107
+ def mm_show_missing() @mm_show_missing || false end
108
+ def mm_show_authors() @mm_show_authors || false end
109
+ def mm_show_leaves() @mm_show_leaves || true end
110
+ def mm_selected_categories() @mm_selected_categories || [] end
111
+
99
112
  # create a Mind Map graph and return the PNG and HTML map files generated
100
113
  def create_mind_map(prog, missing, show_authors, show_leaves, selected_categories)
101
114
  dotFile = File.expand_path("#{WikiService.storage_path}/graph.dot")
@@ -1,53 +1,53 @@
1
- require "test/unit"
2
- require "wiki_service"
3
-
4
- class WebTest < Test::Unit::TestCase
5
- def setup
6
- @web = Web.new "Instiki", "instiki"
7
- end
8
-
9
- def test_wiki_word_linking
10
- @web.add_page(Page.new(@web, "SecondPage", "Yo, yo. Have you EverBeenHated", Time.now, "DavidHeinemeierHansson"))
11
- assert_equal(
12
- "<p>Yo, yo. Have you <span class=\"newWikiWord\">Ever Been Hated<a href=\"../show/EverBeenHated\">?</a></span></p>",
13
- @web.pages["SecondPage"].display_content
14
- )
15
-
16
- @web.add_page(Page.new(@web, "EverBeenHated", "Yo, yo. Have you EverBeenHated", Time.now, "DavidHeinemeierHansson"))
17
- assert_equal(
18
- "<p>Yo, yo. Have you <a class=\"existingWikiWord\" href=\"../show/EverBeenHated\">Ever Been Hated</a></p>",
19
- @web.pages["SecondPage"].display_content
20
- )
21
- end
22
-
23
- def test_pages_by_revision
24
- add_sample_pages
25
- assert_equal "EverBeenHated", @web.select.by_revision.first.name
26
- end
27
-
28
- def test_pages_by_match
29
- add_sample_pages
30
- assert_equal 2, @web.select { |page| page.content =~ /me/i }.length
31
- assert_equal 1, @web.select { |page| page.content =~ /Who/i }.length
32
- assert_equal 0, @web.select { |page| page.content =~ /none/i }.length
33
- end
34
-
35
- def test_references
36
- add_sample_pages
37
- assert_equal 1, @web.select.pages_that_reference("EverBeenHated").length
38
- assert_equal 0, @web.select.pages_that_reference("EverBeenInLove").length
39
- end
40
-
41
- def test_delete
42
- add_sample_pages
43
- assert_equal 2, @web.pages.length
44
- @web.remove_pages([ @web.pages["EverBeenInLove"] ])
45
- assert_equal 1, @web.pages.length
46
- end
47
-
48
- private
49
- def add_sample_pages
50
- @web.add_page(Page.new(@web, "EverBeenInLove", "Who am I me", Time.local(2004, 4, 4, 16, 50), "DavidHeinemeierHansson"))
51
- @web.add_page(Page.new(@web, "EverBeenHated", "I am me EverBeenHated", Time.local(2004, 4, 4, 16, 51), "DavidHeinemeierHansson"))
52
- end
1
+ require "test/unit"
2
+ require "wiki_service"
3
+
4
+ class WebTest < Test::Unit::TestCase
5
+ def setup
6
+ @web = Web.new "Instiki", "instiki"
7
+ end
8
+
9
+ def test_wiki_word_linking
10
+ @web.add_page(Page.new(@web, "SecondPage", "Yo, yo. Have you EverBeenHated", Time.now, "DavidHeinemeierHansson"))
11
+ assert_equal(
12
+ "<p>Yo, yo. Have you <span class=\"newWikiWord\">Ever Been Hated<a href=\"../show/EverBeenHated\">?</a></span></p>",
13
+ @web.pages["SecondPage"].display_content
14
+ )
15
+
16
+ @web.add_page(Page.new(@web, "EverBeenHated", "Yo, yo. Have you EverBeenHated", Time.now, "DavidHeinemeierHansson"))
17
+ assert_equal(
18
+ "<p>Yo, yo. Have you <a class=\"existingWikiWord\" href=\"../show/EverBeenHated\">Ever Been Hated</a></p>",
19
+ @web.pages["SecondPage"].display_content
20
+ )
21
+ end
22
+
23
+ def test_pages_by_revision
24
+ add_sample_pages
25
+ assert_equal "EverBeenHated", @web.select.by_revision.first.name
26
+ end
27
+
28
+ def test_pages_by_match
29
+ add_sample_pages
30
+ assert_equal 2, @web.select { |page| page.content =~ /me/i }.length
31
+ assert_equal 1, @web.select { |page| page.content =~ /Who/i }.length
32
+ assert_equal 0, @web.select { |page| page.content =~ /none/i }.length
33
+ end
34
+
35
+ def test_references
36
+ add_sample_pages
37
+ assert_equal 1, @web.select.pages_that_reference("EverBeenHated").length
38
+ assert_equal 0, @web.select.pages_that_reference("EverBeenInLove").length
39
+ end
40
+
41
+ def test_delete
42
+ add_sample_pages
43
+ assert_equal 2, @web.pages.length
44
+ @web.remove_pages([ @web.pages["EverBeenInLove"] ])
45
+ assert_equal 1, @web.pages.length
46
+ end
47
+
48
+ private
49
+ def add_sample_pages
50
+ @web.add_page(Page.new(@web, "EverBeenInLove", "Who am I me", Time.local(2004, 4, 4, 16, 50), "DavidHeinemeierHansson"))
51
+ @web.add_page(Page.new(@web, "EverBeenHated", "I am me EverBeenHated", Time.local(2004, 4, 4, 16, 51), "DavidHeinemeierHansson"))
52
+ end
53
53
  end
@@ -1,120 +1,132 @@
1
- require 'cgi'
2
- require 'chunks/engines'
3
- require 'chunks/category'
4
- require 'chunks/include'
5
- require 'chunks/todo'
6
- require 'chunks/wiki'
7
- require 'chunks/literal'
8
- require 'chunks/uri'
9
- require 'chunks/nowiki'
10
- require 'chunks/wiki_symbols'
11
-
12
- # Wiki content is just a string that can process itself with a chain of
13
- # actions. The actions can modify wiki content so that certain parts of
14
- # it are protected from being rendered by later actions.
15
- #
16
- # When wiki content is rendered, it can be interrogated to find out
17
- # which chunks were rendered. This means things like categories, wiki
18
- # links, can be determined.
19
- #
20
- # Exactly how wiki content is rendered is determined by a number of
21
- # settings that are optionally passed in to a constructor. The current
22
- # options are:
23
- # * :engine
24
- # => The structural markup engine to use (Textile, Markdown, RDoc)
25
- # * :engine_opts
26
- # => A list of options to pass to the markup engines (safe modes, etc)
27
- # * :pre_engine_actions
28
- # => A list of render actions or chunks to be processed before the
29
- # markup engine is applied. By default this is:
30
- # Category, Include, URIChunk, WikiChunk::Link
31
- # * :post_engine_actions
32
- # => A list of render actions or chunks to apply after the markup
33
- # engine. By default these are:
34
- # Literal::Pre, Literal::Tags, WikiChunk::Word
35
- # ToDo items
36
- # * :mode
37
- # => How should the content be rendered? For normal display (:display),
38
- # publishing (:publish) or export (:export)?
39
- #
40
- # AUTHOR: Mark Reid <mark @ threewordslong . com>
41
- # CREATED: 15th May 2004
42
- # UPDATED: 22nd May 2004
43
- class WikiContent < String
44
-
45
- # Moved URIChunk from pre-engine to post-engine, as it clashed with the textile
46
- # markup of "link":URL.
47
- PRE_ENGINE_ACTIONS = [ NoWiki, Category, Include, Literal::Pre, WikiSymbol,
48
- WikiChunk::Link, WikiChunk::BlikiLink ]
49
- POST_ENGINE_ACTIONS = [ Literal::Tags, WikiChunk::Word, URIChunk, Todo ]
50
-
51
-
52
- DEFAULT_OPTS = {
53
- :pre_engine_actions => PRE_ENGINE_ACTIONS,
54
- :post_engine_actions => POST_ENGINE_ACTIONS,
55
- :engine => Engines::Textile,
56
- :engine_opts => [],
57
- :mode => [:display]
58
- }
59
-
60
- if RedCloth::VERSION >= '3.0.0'
61
- # RedCloth v3 changes the default behaviour from not folding lines.
62
- DEFAULT_OPTS[:engine_opts] = [:hard_breaks]
63
- end
64
-
65
- attr_reader :web, :options, :rendered
66
-
67
- # Create a new wiki content string from the given one.
68
- # The options are explained at the top of this file.
69
- def initialize(revision, options = {})
70
- @revision = revision
71
- @web = @revision.page.web
72
-
73
- # Deep copy of DEFAULT_OPTS to ensure that changes to PRE/POST_ENGINE_ACTIONS stay local
74
- @options = Marshal.load(Marshal.dump(DEFAULT_OPTS)).update(options)
75
- @options[:engine] = Engines::MAP[@web.markup] || Engines::Textile
76
- @options[:engine_opts] += (@web.safe_mode ? [:filter_html, :filter_styles] : [])
77
-
78
- @options[:post_engine_actions].delete(WikiChunk::Word) if @web.brackets_only
79
-
80
- super(@revision.content)
81
-
82
- begin
83
- render!(@options[:pre_engine_actions] + [@options[:engine]] + @options[:post_engine_actions])
84
- rescue => e
85
- @rendered = "<strong>#{e.message}</strong><br/><br/>#{e.backtrace.join('<br/>')}"
86
- end
87
- end
88
-
89
- # Call @web.page_link using current options.
90
- def page_link(name, text)
91
- @web.make_link(name, text, @options)
92
- end
93
-
94
- # Find all the chunks of the given types
95
- def find_chunks(chunk_type)
96
- rendered.select { |chunk| chunk.kind_of?(chunk_type) }
97
- end
98
-
99
- # Render this content using the specified actions.
100
- def render!(chunk_types)
101
- @chunks = []
102
- chunk_types.each { |chunk_type| self.apply_type!(chunk_type) }
103
-
104
- # unmasking order is reversed to allow chuncks that encapsulate other chunks,
105
- # e.g. a ToDo item with a WikiWork link.
106
- @rendered = @chunks.reverse.map { |chunk| chunk.unmask(self) }.compact
107
- (@chunks - @rendered).each { |chunk| chunk.revert(self) }
108
- end
109
-
110
- # Find all the chunks of the given type in this content
111
- # Each time the type's pattern is matched, create a new
112
- # chunk for it, and replace the occurance of the chunk
113
- # in this content with its mask.
114
- def apply_type!(chunk_type)
115
- self.gsub!( chunk_type.pattern ) do |match|
116
- @chunks << chunk_type.new($~, @revision)
117
- @chunks.last.mask(self)
118
- end
119
- end
1
+ require 'cgi'
2
+ require 'chunks/engines'
3
+ require 'chunks/category'
4
+ require 'chunks/include'
5
+ require 'chunks/todo'
6
+ require 'chunks/wiki'
7
+ require 'chunks/literal'
8
+ require 'chunks/uri'
9
+ require 'chunks/nowiki'
10
+ require 'chunks/wiki_symbols'
11
+
12
+ # Wiki content is just a string that can process itself with a chain of
13
+ # actions. The actions can modify wiki content so that certain parts of
14
+ # it are protected from being rendered by later actions.
15
+ #
16
+ # When wiki content is rendered, it can be interrogated to find out
17
+ # which chunks were rendered. This means things like categories, wiki
18
+ # links, can be determined.
19
+ #
20
+ # Exactly how wiki content is rendered is determined by a number of
21
+ # settings that are optionally passed in to a constructor. The current
22
+ # options are:
23
+ # * :engine
24
+ # => The structural markup engine to use (Textile, Markdown, RDoc)
25
+ # * :engine_opts
26
+ # => A list of options to pass to the markup engines (safe modes, etc)
27
+ # * :pre_engine_actions
28
+ # => A list of render actions or chunks to be processed before the
29
+ # markup engine is applied. By default this is:
30
+ # Category, Include, URIChunk, WikiChunk::Link
31
+ # * :post_engine_actions
32
+ # => A list of render actions or chunks to apply after the markup
33
+ # engine. By default these are:
34
+ # Literal::Pre, Literal::Tags, WikiChunk::Word
35
+ # ToDo items
36
+ # * :mode
37
+ # => How should the content be rendered? For normal display (:display),
38
+ # publishing (:publish) or export (:export)?
39
+ #
40
+ # AUTHOR: Mark Reid <mark @ threewordslong . com>
41
+ # CREATED: 15th May 2004
42
+ # UPDATED: 22nd May 2004
43
+ class WikiContent < String
44
+
45
+ # Moved URIChunk from pre-engine to post-engine, as it clashed with the textile
46
+ # markup of "link":URL.
47
+ PRE_ENGINE_ACTIONS = [ NoWiki, Category, Include, Literal::Pre, WikiSymbol,
48
+ WikiChunk::Link, WikiChunk::BlikiLink ]
49
+ POST_ENGINE_ACTIONS = [ Literal::Tags, WikiChunk::Word, URIChunk, Todo ]
50
+
51
+
52
+ DEFAULT_OPTS = {
53
+ :pre_engine_actions => PRE_ENGINE_ACTIONS,
54
+ :post_engine_actions => POST_ENGINE_ACTIONS,
55
+ :engine => Engines::Textile,
56
+ :engine_opts => [],
57
+ :mode => [:display]
58
+ }
59
+
60
+ attr_reader :web, :options, :rendered
61
+
62
+ # Create a new wiki content string from the given one.
63
+ # The options are explained at the top of this file.
64
+ def initialize(revision, options = {})
65
+ @revision = revision
66
+ @web = @revision.page.web
67
+
68
+ # Deep copy of DEFAULT_OPTS to ensure that changes to PRE/POST_ENGINE_ACTIONS stay local
69
+ @options = Marshal.load(Marshal.dump(DEFAULT_OPTS)).update(options)
70
+ @options[:engine] = Engines::MAP[@web.markup] || Engines::Textile
71
+
72
+ @options[:engine_opts] = []
73
+ case @options[:engine]
74
+ when Engines::Textile
75
+ if RedCloth::VERSION >= '3.0.0'
76
+ # RedCloth v3 changes the default behaviour from not folding lines.
77
+ DEFAULT_OPTS[:engine_opts] = [:hard_breaks]
78
+ end
79
+ @options[:engine_opts] += (@web.safe_mode ? [:filter_html, :filter_styles] : [])
80
+
81
+ when Engines::BlueMarkdown, Engines::RedMarkdown
82
+ @options[:engine_opts] += (@web.safe_mode ? [:filter_html, :filter_styles] : [])
83
+
84
+ when Engines::RDoc
85
+ nil
86
+
87
+ end
88
+
89
+
90
+ @options[:post_engine_actions].delete(WikiChunk::Word) if @web.brackets_only
91
+
92
+ super(@revision.content)
93
+
94
+ begin
95
+ render!(@options[:pre_engine_actions] + [@options[:engine]] + @options[:post_engine_actions])
96
+ rescue => e
97
+ @rendered = "<strong>#{e.message}</strong><br/><br/>#{e.backtrace.join('<br/>')}"
98
+ end
99
+ end
100
+
101
+ # Call @web.page_link using current options.
102
+ def page_link(name, text)
103
+ @web.make_link(name, text, @options)
104
+ end
105
+
106
+ # Find all the chunks of the given types
107
+ def find_chunks(chunk_type)
108
+ rendered.select { |chunk| chunk.kind_of?(chunk_type) }
109
+ end
110
+
111
+ # Render this content using the specified actions.
112
+ def render!(chunk_types)
113
+ @chunks = []
114
+ chunk_types.each { |chunk_type| self.apply_type!(chunk_type) }
115
+
116
+ # unmasking order is reversed to allow chuncks that encapsulate other chunks,
117
+ # e.g. a ToDo item with a WikiWork link.
118
+ @rendered = @chunks.reverse.map { |chunk| chunk.unmask(self) }.compact
119
+ (@chunks - @rendered).each { |chunk| chunk.revert(self) }
120
+ end
121
+
122
+ # Find all the chunks of the given type in this content
123
+ # Each time the type's pattern is matched, create a new
124
+ # chunk for it, and replace the occurance of the chunk
125
+ # in this content with its mask.
126
+ def apply_type!(chunk_type)
127
+ self.gsub!( chunk_type.pattern ) do |match|
128
+ @chunks << chunk_type.new($~, @revision)
129
+ @chunks.last.mask(self)
130
+ end
131
+ end
120
132
  end
@@ -1,4 +1,5 @@
1
1
 
2
+
2
3
  require "madeleine_service"
3
4
  require "web"
4
5
  require "page"
@@ -30,7 +31,10 @@ class WikiService < MadeleineService
30
31
 
31
32
  def update_web(old_address, new_address, name, markup, color, additional_style, safe_mode = false,
32
33
  password = nil, published = false, brackets_only = false, count_pages = false,
33
- mind_map_size="7,7", symbols_map=nil, links_map=nil)
34
+ mind_map_size="7,7", symbols_map=nil, links_map=nil,
35
+ enable_dclick_edit=nil, check_pass_on_edit=false,
36
+ prog=nil, graph_type=nil, missing=nil, show_authors=nil, show_leaves=nil, selected_categories=nil)
37
+
34
38
  if old_address != new_address
35
39
  @webs[new_address] = @webs[old_address]
36
40
  @webs.delete(old_address)
@@ -46,12 +50,20 @@ class WikiService < MadeleineService
46
50
  web.password, web.published, web.brackets_only, web.count_pages =
47
51
  password, published, brackets_only, count_pages
48
52
 
49
- web.mind_map_size, web.symbols_map, web.links_map =
50
- mind_map_size, symbols_map, links_map
53
+ web.enable_dclick_edit, web.check_pass_on_edit = enable_dclick_edit, check_pass_on_edit
54
+
55
+ web.mind_map_size, web.mm_prog, web.mm_graph_type, web.mm_show_missing =
56
+ mind_map_size, prog, graph_type, missing
57
+
58
+ web.mm_show_authors, web.mm_show_leaves, web.mm_selected_categories =
59
+ show_authors, show_leaves, selected_categories
60
+
61
+ web.symbols_map, web.links_map = symbols_map, links_map
51
62
  end
52
63
 
53
64
  def read_page(web_address, page_name)
54
- @webs[web_address].pages[page_name]
65
+ web = @webs[web_address]
66
+ web ? web.pages[page_name] : nil
55
67
  end
56
68
 
57
69
  def write_page(web_address, page_name, content, written_on, author)
@@ -60,9 +72,9 @@ class WikiService < MadeleineService
60
72
  page
61
73
  end
62
74
 
63
- def revise_page(web_address, page_name, content, revised_on, author)
75
+ def revise_page(web_address, page_name, content, revised_on, author, edit_type)
64
76
  page = read_page(web_address, page_name)
65
- page.revise(content, revised_on, author)
77
+ page.revise(content, revised_on, author, edit_type)
66
78
  page
67
79
  end
68
80
 
@@ -90,18 +102,21 @@ class WikiService < MadeleineService
90
102
  web.pages[new_page_name] = page
91
103
  end #}}}
92
104
 
93
- def save_menu_pref(web_address, type, limit, content, category) #{{{
105
+ def save_menu_pref(web_address, type, limit, content, category, author) #{{{
94
106
  web = @webs[web_address]
95
- web.menu_type = type
96
- web.menu_limit = limit
97
- web.menu_category = category
98
- # TODO: persist revisions of user specified content.
99
- web.menu_content = content
100
- if web.menu_type == 'user'
101
- # Only calculate the rendered content once:
102
- web.rendered_menu = Page.new(
107
+ web.menu_type = type
108
+ web.menu_limit = limit
109
+ web.menu_category = category
110
+
111
+ if Page === web.menu_content
112
+ web.menu_content.revise(
113
+ content, Time.now, '', author
114
+ )
115
+ else
116
+ # Protect old Pimki storages.
117
+ web.menu_content = Page.new(
103
118
  web, 'menu', content, Time.now, ''
104
- ).revisions.last.display_content
119
+ )
105
120
  end
106
121
  end #}}}
107
122