motiro 0.6.8 → 0.6.9
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +15 -0
- data/README +2 -2
- data/README.en +1 -2
- data/README.pt-br +1 -2
- data/app/controllers/account_controller.rb +1 -1
- data/app/controllers/application.rb +13 -12
- data/app/controllers/javascript_controller.rb +1 -1
- data/app/controllers/report_controller.rb +1 -1
- data/app/controllers/wiki_controller.rb +3 -5
- data/app/core/cache_reporter.rb +1 -1
- data/app/core/cache_reporter_fetcher.rb +1 -1
- data/app/core/chief_editor.rb +1 -1
- data/app/core/reporter.rb +1 -1
- data/app/core/reporter_driver.rb +1 -1
- data/app/core/reporter_fetcher.rb +1 -1
- data/app/core/settings.rb +1 -1
- data/app/core/version.rb +1 -1
- data/app/core/wiki_reporter.rb +1 -1
- data/app/helpers/application_helper.rb +5 -1
- data/app/helpers/default_page_provider.rb +6 -2
- data/app/helpers/report_helper.rb +14 -1
- data/app/models/change.rb +1 -1
- data/app/models/chunk.rb +1 -1
- data/app/models/feed_observer.rb +1 -1
- data/app/models/headline.rb +1 -1
- data/app/models/page.rb +38 -4
- data/app/models/revision.rb +1 -1
- data/app/models/user.rb +1 -1
- data/app/models/wiki_reference.rb +21 -0
- data/app/models/wiki_sweeper.rb +17 -2
- data/app/ports/chdir_runner.rb +1 -1
- data/app/ports/runner.rb +1 -1
- data/app/reporters/darcs_connection.rb +1 -1
- data/app/reporters/darcs_reporter.rb +1 -1
- data/app/reporters/darcs_temp_repo.rb +1 -1
- data/app/reporters/events_reporter.rb +1 -1
- data/app/reporters/features_reporter.rb +1 -1
- data/app/reporters/subversion_reporter.rb +1 -1
- data/app/reporters/svn_connection.rb +1 -1
- data/app/reporters/svn_settings.rb +1 -1
- data/app/views/report/list.rhtml +6 -7
- data/app/views/report/older.rhtml +1 -2
- data/app/views/report/rss.rxml +1 -1
- data/app/views/report/show.rhtml +2 -2
- data/app/views/wiki/_edit_event.rhtml +2 -0
- data/app/views/wiki/_edit_feature.rhtml +2 -0
- data/app/views/wiki/_properties_edit.rhtml +3 -5
- data/app/views/wiki/_properties_show.rhtml +4 -5
- data/app/views/wiki/_show_event.rhtml +3 -0
- data/app/views/wiki/_show_feature.rhtml +2 -0
- data/app/views/wiki/show.rhtml +1 -1
- data/bin/motiro +3 -3
- data/config/routes.rb +1 -1
- data/db/migrate/024_add_feature_status.rb +11 -0
- data/db/migrate/025_add_page_references.rb +12 -0
- data/db/migrate/026_convert_link_syntax.rb +12 -0
- data/db/migrate/027_register_page_references.rb +12 -0
- data/db/motirodb.sqlite.initial +0 -0
- data/db/schema_version +1 -1
- data/db/translation/pt-BR.rb +7 -1
- data/lib/array_extensions.rb +1 -1
- data/lib/diff_chunk_builder.rb +1 -1
- data/lib/differ.rb +1 -1
- data/lib/string_extensions.rb +13 -6
- data/lib/stub_hash.rb +1 -1
- data/lib/tasks/packaging.rake +10 -12
- data/lib/tasks/testing.rake +1 -1
- data/lib/tick_daemon.rb +1 -1
- data/lib/{wiki_url_generator.rb → wiki_link_handler.rb} +13 -3
- data/lib/wiki_renderer.rb +63 -34
- data/public/images/done.png +0 -0
- data/public/images/not-done.png +0 -0
- data/public/stylesheets/motiro.css +8 -0
- data/script/ticker +1 -1
- data/test/acceptance/account_test.rb +1 -1
- data/test/acceptance/darcs_test.rb +1 -1
- data/test/acceptance/events_test.rb +1 -1
- data/test/acceptance/main_page_test.rb +1 -1
- data/test/acceptance/subversion_test.rb +1 -1
- data/test/acceptance/ts_all_suites.rb +1 -1
- data/test/acceptance/wiki_test.rb +3 -3
- data/test/contract/darcs_test.rb +1 -1
- data/test/contract/remote_darcs_test.rb +1 -1
- data/test/contract/svn_test.rb +1 -1
- data/test/fixtures/pages.yml +20 -1
- data/test/fixtures/revisions.yml +40 -1
- data/test/fixtures/wiki_references.yml +5 -0
- data/test/functional/report_controller_test.rb +1 -1
- data/test/functional/report_features_test.rb +8 -1
- data/test/functional/report_subversion_test.rb +1 -1
- data/test/functional/root_controller_test.rb +1 -1
- data/test/functional/wiki_controller_test.rb +67 -2
- data/test/lib/acceptance_test_case.rb +1 -1
- data/test/lib/darcs_excerpts.rb +1 -1
- data/test/lib/darcs_repo.rb +1 -1
- data/test/lib/hash_extensions.rb +22 -0
- data/test/lib/live_mode_test.rb +1 -1
- data/test/lib/netutils.rb +1 -1
- data/test/lib/platform_thread.rb +1 -1
- data/test/lib/selenium_extensions.rb +1 -1
- data/test/lib/stubio.rb +1 -1
- data/test/lib/webserver.rb +1 -1
- data/test/meta/darcs_repo_test.rb +1 -1
- data/test/meta/local_svn_test.rb +1 -1
- data/test/meta/platform_thread_test.rb +1 -1
- data/test/meta/stubio_test.rb +1 -1
- data/test/stubs/{url_generator.rb → wiki_link_handler.rb} +8 -4
- data/test/test_helper.rb +3 -1
- data/test/unit/array_extensions_test.rb +1 -1
- data/test/unit/cache_reporter_fetcher_test.rb +1 -1
- data/test/unit/cache_reporter_test.rb +1 -1
- data/test/unit/change_test.rb +1 -1
- data/test/unit/chdir_runner_test.rb +1 -1
- data/test/unit/chief_editor_test.rb +1 -1
- data/test/unit/darcs_connection_test.rb +1 -1
- data/test/unit/darcs_reporter_test.rb +4 -4
- data/test/unit/darcs_temp_repo_test.rb +1 -1
- data/test/unit/default_page_provider_test.rb +23 -13
- data/test/unit/diff_chunk_builder_test.rb +1 -1
- data/test/unit/page_test.rb +67 -4
- data/test/unit/reporter_driver_test.rb +1 -1
- data/test/unit/reporter_test.rb +1 -1
- data/test/unit/revision_test.rb +1 -1
- data/test/unit/runner_test.rb +1 -1
- data/test/unit/string_extensions_test.rb +15 -3
- data/test/unit/svn_connection_test.rb +1 -1
- data/test/unit/svn_reporter_interaction_test.rb +1 -1
- data/test/unit/svn_reporter_test.rb +1 -1
- data/test/unit/svn_settings_test.rb +1 -1
- data/test/unit/user_test.rb +1 -1
- data/test/unit/{wiki_url_generator_test.rb → wiki_link_handler_test.rb} +3 -3
- data/test/unit/wiki_renderer_test.rb +75 -20
- data/test/unit/wiki_reporter_test.rb +1 -1
- data/vendor/mediacloth-trunk/MIT-LICENSE +20 -0
- data/vendor/mediacloth-trunk/README +32 -0
- data/vendor/mediacloth-trunk/Rakefile +33 -0
- data/vendor/mediacloth-trunk/lib/mediacloth/mediawikiast.rb +122 -0
- data/vendor/mediacloth-trunk/lib/mediacloth/mediawikihtmlgenerator.rb +252 -0
- data/vendor/mediacloth-trunk/lib/mediacloth/mediawikilexer.rb +821 -0
- data/vendor/mediacloth-trunk/lib/mediacloth/mediawikilinkhandler.rb +68 -0
- data/vendor/mediacloth-trunk/lib/mediacloth/mediawikiparams.rb +33 -0
- data/vendor/mediacloth-trunk/lib/mediacloth/mediawikiparser.rb +1218 -0
- data/vendor/mediacloth-trunk/lib/mediacloth/mediawikiparser.y +493 -0
- data/vendor/mediacloth-trunk/lib/mediacloth/mediawikiwalker.rb +146 -0
- data/vendor/mediacloth-trunk/lib/mediacloth.rb +29 -0
- data/vendor/mediacloth-trunk/mediacloth.gemspec +24 -0
- data/vendor/mediacloth-trunk/mediacloth.kdevelop +117 -0
- data/vendor/mediacloth-trunk/setup.rb +1585 -0
- data/vendor/mediacloth-trunk/test/data/html1 +26 -0
- data/vendor/mediacloth-trunk/test/data/html10 +130 -0
- data/vendor/mediacloth-trunk/test/data/html11 +17 -0
- data/vendor/mediacloth-trunk/test/data/html12 +12 -0
- data/vendor/mediacloth-trunk/test/data/html13 +11 -0
- data/vendor/mediacloth-trunk/test/data/html2 +2 -0
- data/vendor/mediacloth-trunk/test/data/html3 +1 -0
- data/vendor/mediacloth-trunk/test/data/html4 +47 -0
- data/vendor/mediacloth-trunk/test/data/html5 +57 -0
- data/vendor/mediacloth-trunk/test/data/html6 +8 -0
- data/vendor/mediacloth-trunk/test/data/html7 +45 -0
- data/vendor/mediacloth-trunk/test/data/html8 +1 -0
- data/vendor/mediacloth-trunk/test/data/html9 +14 -0
- data/vendor/mediacloth-trunk/test/data/input1 +34 -0
- data/vendor/mediacloth-trunk/test/data/input10 +124 -0
- data/vendor/mediacloth-trunk/test/data/input11 +17 -0
- data/vendor/mediacloth-trunk/test/data/input12 +15 -0
- data/vendor/mediacloth-trunk/test/data/input13 +10 -0
- data/vendor/mediacloth-trunk/test/data/input2 +2 -0
- data/vendor/mediacloth-trunk/test/data/input3 +2 -0
- data/vendor/mediacloth-trunk/test/data/input4 +50 -0
- data/vendor/mediacloth-trunk/test/data/input5 +63 -0
- data/vendor/mediacloth-trunk/test/data/input6 +8 -0
- data/vendor/mediacloth-trunk/test/data/input7 +45 -0
- data/vendor/mediacloth-trunk/test/data/input8 +1 -0
- data/vendor/mediacloth-trunk/test/data/input9 +14 -0
- data/vendor/mediacloth-trunk/test/data/lex1 +26 -0
- data/vendor/mediacloth-trunk/test/data/lex10 +85 -0
- data/vendor/mediacloth-trunk/test/data/lex11 +17 -0
- data/vendor/mediacloth-trunk/test/data/lex12 +15 -0
- data/vendor/mediacloth-trunk/test/data/lex13 +3 -0
- data/vendor/mediacloth-trunk/test/data/lex2 +2 -0
- data/vendor/mediacloth-trunk/test/data/lex3 +1 -0
- data/vendor/mediacloth-trunk/test/data/lex4 +47 -0
- data/vendor/mediacloth-trunk/test/data/lex5 +57 -0
- data/vendor/mediacloth-trunk/test/data/lex6 +8 -0
- data/vendor/mediacloth-trunk/test/data/lex7 +45 -0
- data/vendor/mediacloth-trunk/test/data/lex8 +1 -0
- data/vendor/mediacloth-trunk/test/data/lex9 +14 -0
- data/vendor/mediacloth-trunk/test/data/result1 +48 -0
- data/vendor/mediacloth-trunk/test/dataproducers/html.rb +18 -0
- data/vendor/mediacloth-trunk/test/dataproducers/lex.rb +15 -0
- data/vendor/mediacloth-trunk/test/debugwalker.rb +68 -0
- data/vendor/mediacloth-trunk/test/htmlgenerator.rb +97 -0
- data/vendor/mediacloth-trunk/test/lexer.rb +542 -0
- data/vendor/mediacloth-trunk/test/linkhandler.rb +39 -0
- data/vendor/mediacloth-trunk/test/parser.rb +22 -0
- data/vendor/mediacloth-trunk/test/testhelper.rb +27 -0
- data/vendor/mediacloth.rb +3 -0
- data/vendor/motiro-installer.rb +1 -1
- data/vendor/plugins/cache_test-0.2/CHANGELOG +14 -0
- data/vendor/plugins/cache_test-0.2/MIT-LICENSE +20 -0
- data/vendor/plugins/cache_test-0.2/README +124 -0
- data/vendor/plugins/cache_test-0.2/init.rb +8 -0
- data/vendor/plugins/cache_test-0.2/lib/fragment_cache_test.rb +205 -0
- data/vendor/plugins/cache_test-0.2/lib/page_cache_test.rb +140 -0
- data/vendor/plugins/global_routing/init.rb +1 -1
- metadata +517 -455
data/app/views/report/show.rhtml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<% @title = "#{'Revision details'.t} - #{@headline.title(Translator.for(@locale))} (Motiro)" %>
|
2
2
|
<% cache(:action => 'show', :suffix => 'summary', :locale => @locale) do %>
|
3
3
|
<% pagetext('Revision %s' / truncate(@revision_id)) do %>
|
4
|
-
<%=
|
4
|
+
<%= render_wiki(@headline.description(Translator.for(@locale))) %>
|
5
5
|
<div id="summary">
|
6
6
|
<% @headline.changes.each do |change| %>
|
7
7
|
<%= render_summary(change) -%>
|
@@ -17,4 +17,4 @@
|
|
17
17
|
<% end %>
|
18
18
|
</div>
|
19
19
|
<% end %>
|
20
|
-
|
20
|
+
|
@@ -1,5 +1,3 @@
|
|
1
|
-
<%
|
2
|
-
<%= '
|
3
|
-
|
4
|
-
<%= hidden_field 'page', 'type', :value => 'Event' %>
|
5
|
-
<% end %>
|
1
|
+
<% begin %>
|
2
|
+
<%= render(:partial => 'edit_' + (params[:kind] || @page.kind)) -%>
|
3
|
+
<% rescue; end %>
|
@@ -1,5 +1,4 @@
|
|
1
|
-
<%
|
2
|
-
<%=
|
3
|
-
|
4
|
-
|
5
|
-
<% end %>
|
1
|
+
<% begin %>
|
2
|
+
<%= render(:partial => 'show_' + @page.kind) -%>
|
3
|
+
<% rescue; end %>
|
4
|
+
|
data/app/views/wiki/show.rhtml
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
:page => @page.name, :locale_suffix => @locale,
|
4
4
|
:revision => @page_revision_id) do %>
|
5
5
|
<%= render :partial => 'properties_show' %>
|
6
|
-
<%=
|
6
|
+
<%= render_wiki(@page.text) %>
|
7
7
|
<% end %>
|
8
8
|
<%= render :partial => 'editbar' %>
|
9
9
|
<% end %>
|
data/bin/motiro
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
3
|
# Motiro - A project tracking tool
|
4
|
-
# Copyright (C) 2006-
|
4
|
+
# Copyright (C) 2006-2008 Thiago Arrais
|
5
5
|
#
|
6
6
|
# This program is free software; you can redistribute it and/or modify
|
7
7
|
# it under the terms of the GNU General Public License as published by
|
@@ -22,7 +22,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../vendor/motiro-installer')
|
|
22
22
|
class AppInstaller < RailsInstaller
|
23
23
|
application_name 'motiro'
|
24
24
|
support_location 'http://www.motiro.org'
|
25
|
-
rails_version '1.2.
|
25
|
+
rails_version '1.2.3'
|
26
26
|
|
27
27
|
def create_initial_database
|
28
28
|
cp(install_directory + '/db/motirodb.sqlite.initial',
|
@@ -41,4 +41,4 @@ app = AppInstaller.new(directory)
|
|
41
41
|
app.message_proc = Proc.new do |msg|
|
42
42
|
STDERR.puts " #{msg}"
|
43
43
|
end
|
44
|
-
app.execute_command(*ARGV)
|
44
|
+
app.execute_command(*ARGV)
|
data/config/routes.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
class ConvertLinkSyntax < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
Revision.find(:all).each do |change|
|
4
|
+
change.text.gsub!(/\[\[?(\w+)([ \t]+([^\]]+))?\]?\]/) do
|
5
|
+
"[[#{$1}#{$2 ? '|' + $2.strip : ''}]]"
|
6
|
+
end
|
7
|
+
change.save
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.down; end
|
12
|
+
end
|
data/db/motirodb.sqlite.initial
CHANGED
Binary file
|
data/db/schema_version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
24
|
data/db/translation/pt-BR.rb
CHANGED
@@ -56,6 +56,11 @@
|
|
56
56
|
'This event was planned for' => 'Este evento foi planejado para',
|
57
57
|
'The first line on the event text will turn into a summary displayed on the main page' => 'A primeira linha do texto do evento será exibida como resumo na página principal',
|
58
58
|
|
59
|
+
# Feature suggestion pages
|
60
|
+
'This feature is' => 'Este recurso sugerido',
|
61
|
+
'done' => 'está pronto',
|
62
|
+
'not done' => 'ainda não está pronto',
|
63
|
+
|
59
64
|
# Wiki edition page
|
60
65
|
'Insert page title here' => 'Digite o título aqui',
|
61
66
|
'Save modifications' => 'Salvar modificações',
|
@@ -68,7 +73,8 @@
|
|
68
73
|
'This page is a' => 'Esta página é uma',
|
69
74
|
'common wiki page' => 'página wiki comum',
|
70
75
|
'feature suggestion' => 'sugestão de recurso',
|
71
|
-
'event description' => 'descrição de evento',
|
76
|
+
'event description' => 'descrição de evento',
|
77
|
+
'This feature is done' => 'Este recurso está pronto',
|
72
78
|
'Who should be able to edit this page?' => 'Quem pode editar esta página?',
|
73
79
|
'(Usernames separated by spaces. Blank for everyone)' => '(Nomes de usuário separados por espaços. Em branco para todos.)',
|
74
80
|
|
data/lib/array_extensions.rb
CHANGED
data/lib/diff_chunk_builder.rb
CHANGED
data/lib/differ.rb
CHANGED
data/lib/string_extensions.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Motiro - A project tracking tool
|
2
|
-
# Copyright (C) 2006-
|
2
|
+
# Copyright (C) 2006-2008 Thiago Arrais
|
3
3
|
#
|
4
4
|
# This program is free software; you can redistribute it and/or modify
|
5
5
|
# it under the terms of the GNU General Public License as published by
|
@@ -25,13 +25,20 @@ class String
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def xml_split
|
28
|
-
|
28
|
+
remainder = self
|
29
29
|
words = []
|
30
|
-
while(md =
|
31
|
-
|
32
|
-
|
30
|
+
while(md = remainder.match(/<([^>]+)(\s+[^>]+)?(>.*?<\/\1>|\/>)|[^\s<]+/m))
|
31
|
+
word = md[0]
|
32
|
+
remainder = md.post_match
|
33
|
+
while word.match(/<\/#{md[1]}/) &&
|
34
|
+
word.scan(/<#{md[1]}/).size > word.scan(/<\/#{md[1]}/).size
|
35
|
+
m = remainder.match(/<\/#{md[1]}>/)
|
36
|
+
word << m.pre_match << m[0]
|
37
|
+
remainder = m.post_match
|
38
|
+
end
|
39
|
+
words << word
|
33
40
|
end
|
34
41
|
words
|
35
42
|
end
|
36
43
|
|
37
|
-
end
|
44
|
+
end
|
data/lib/stub_hash.rb
CHANGED
data/lib/tasks/packaging.rake
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# packaging.rake largely inspired by Tobias Luetke's release.rake for typo
|
2
2
|
#
|
3
3
|
# Motiro - A project tracking tool
|
4
|
-
# Copyright (C) 2006-
|
4
|
+
# Copyright (C) 2006-2008 Thiago Arrais
|
5
5
|
#
|
6
6
|
# This program is free software; you can redistribute it and/or modify
|
7
7
|
# it under the terms of the GNU General Public License as published by
|
@@ -39,7 +39,9 @@ unless MOTIRO_VERSION.include? 'dev'
|
|
39
39
|
%r{public/javascript($|/)},
|
40
40
|
/\/\._/, /\/#/ ].any? {|regex| f =~ regex }
|
41
41
|
end
|
42
|
-
s.files += Dir.glob('vendor/plugins/**/*')
|
42
|
+
s.files += Dir.glob('vendor/plugins/**/*') +
|
43
|
+
Dir.glob('vendor/mediacloth-trunk/**/*') <<
|
44
|
+
'vendor/mediacloth.rb' <<
|
43
45
|
'log/.keepdir' << 'vendor/motiro-installer.rb'
|
44
46
|
s.require_path = '.'
|
45
47
|
s.author = "Thiago Arrais"
|
@@ -50,11 +52,7 @@ unless MOTIRO_VERSION.include? 'dev'
|
|
50
52
|
s.executables = ['motiro']
|
51
53
|
|
52
54
|
s.add_dependency("rails", "= 1.2.3")
|
53
|
-
s.add_dependency("mediacloth", ">= 0.0.2")
|
54
55
|
s.add_dependency("daemons", ">= 1.0.4")
|
55
|
-
s.add_dependency("Platform", ">= 0.4.0")
|
56
|
-
s.add_dependency("open4", ">= 0.9.1")
|
57
|
-
s.add_dependency("POpen4", ">= 0.1.1")
|
58
56
|
s.add_dependency("sqlite3-ruby", ">= 1.2.1")
|
59
57
|
s.add_dependency("flexmock", ">= 0.5")
|
60
58
|
s.add_dependency("rails-app-installer", "= 0.2.0")
|
@@ -64,12 +62,12 @@ unless MOTIRO_VERSION.include? 'dev'
|
|
64
62
|
packaging = Rake::GemPackageTask.new(spec) do |p|
|
65
63
|
p.gem_spec = spec
|
66
64
|
end
|
67
|
-
|
65
|
+
|
68
66
|
task :tarball => packaging.package_dir_path do
|
69
67
|
files = Dir.glob('vendor/**/*').reject do |f|
|
70
68
|
f =~ %r{^vendor/plugins}
|
71
69
|
end
|
72
|
-
|
70
|
+
|
73
71
|
files.each do |fn|
|
74
72
|
f = File.join(packaging.package_dir_path, fn)
|
75
73
|
fdir = File.dirname(f)
|
@@ -81,14 +79,14 @@ unless MOTIRO_VERSION.include? 'dev'
|
|
81
79
|
safe_ln(fn, f)
|
82
80
|
end
|
83
81
|
end
|
84
|
-
|
82
|
+
|
85
83
|
safe_ln(File.join(packaging.package_dir_path, 'db/motirodb.sqlite.initial'),
|
86
84
|
File.join(packaging.package_dir_path, 'db/motirodb.sqlite'))
|
87
85
|
rm_f(File.join(packaging.package_dir_path, 'db/motirodb.sqlite.initial'))
|
88
|
-
|
86
|
+
|
89
87
|
chdir(packaging.package_dir) do
|
90
|
-
|
91
|
-
|
88
|
+
sh %{tar cvzf #{packaging.package_name}.tar.gz #{packaging.package_name}}
|
89
|
+
end
|
92
90
|
end
|
93
91
|
|
94
92
|
end
|
data/lib/tasks/testing.rake
CHANGED
data/lib/tick_daemon.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# tick_daemon.rb based on the Rails' Daemon Generator by Kyle Maxwell
|
2
2
|
#
|
3
3
|
# Motiro - A project tracking tool
|
4
|
-
# Copyright (C) 2006-
|
4
|
+
# Copyright (C) 2006-2008 Thiago Arrais
|
5
5
|
#
|
6
6
|
# This program is free software; you can redistribute it and/or modify
|
7
7
|
# it under the terms of the GNU General Public License as published by
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Motiro - A project tracking tool
|
2
|
-
# Copyright (C) 2006-
|
2
|
+
# Copyright (C) 2006-2008 Thiago Arrais
|
3
3
|
#
|
4
4
|
# This program is free software; you can redistribute it and/or modify
|
5
5
|
# it under the terms of the GNU General Public License as published by
|
@@ -15,15 +15,25 @@
|
|
15
15
|
# along with this program; if not, write to the Free Software
|
16
16
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
|
18
|
-
class
|
18
|
+
class WikiLinkHandler < MediaWikiLinkHandler
|
19
19
|
|
20
20
|
def initialize(parent_controller)
|
21
21
|
@parent_controller = parent_controller
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
24
|
+
def url_for(page_name)
|
25
25
|
@parent_controller.server_url_for :controller => 'wiki', :action => 'show',
|
26
26
|
:page_name => page_name
|
27
27
|
end
|
28
28
|
|
29
|
+
def link_attributes_for(page_name)
|
30
|
+
super(page_name).merge(extra_link_attributes_for(page_name))
|
31
|
+
end
|
32
|
+
|
33
|
+
def extra_link_attributes_for(page_name)
|
34
|
+
atts = {}
|
35
|
+
atts[:class] = 'done' if (page = Page.find_by_name(page_name)) && page.done?
|
36
|
+
atts
|
37
|
+
end
|
38
|
+
|
29
39
|
end
|
data/lib/wiki_renderer.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Motiro - A project tracking tool
|
2
|
-
# Copyright (C) 2006-
|
2
|
+
# Copyright (C) 2006-2008 Thiago Arrais
|
3
3
|
#
|
4
4
|
# This program is free software; you can redistribute it and/or modify
|
5
5
|
# it under the terms of the GNU General Public License as published by
|
@@ -23,17 +23,15 @@ require 'array_extensions'
|
|
23
23
|
|
24
24
|
class WikiRenderer
|
25
25
|
|
26
|
-
include MediaCloth
|
27
|
-
|
28
26
|
def initialize(url_generator, locale_code=nil)
|
29
|
-
@
|
27
|
+
@html_generator = MediaWikiHTMLGenerator.new
|
30
28
|
@translator = Translator.for(locale_code)
|
29
|
+
@html_generator.link_handler = url_generator
|
31
30
|
end
|
32
31
|
|
33
32
|
def render_wiki_text(text)
|
34
33
|
localized_text = @translator.localize(text).delete("\r")
|
35
|
-
|
36
|
-
wiki_to_html(expanded_text)
|
34
|
+
wiki_to_html(localized_text)
|
37
35
|
end
|
38
36
|
|
39
37
|
def render_wiki_diff(old_text, new_text)
|
@@ -45,10 +43,10 @@ class WikiRenderer
|
|
45
43
|
|
46
44
|
private
|
47
45
|
|
48
|
-
def
|
49
|
-
|
50
|
-
|
51
|
-
|
46
|
+
def wiki_to_html(input)
|
47
|
+
MediaCloth::wiki_to_html(input, :generator => @html_generator).
|
48
|
+
gsub(/\r?\n?\r?\n<\//, '</').
|
49
|
+
gsub('<p></p>', '')
|
52
50
|
end
|
53
51
|
|
54
52
|
end
|
@@ -61,7 +59,7 @@ class HtmlDiffRenderer
|
|
61
59
|
end
|
62
60
|
|
63
61
|
def start_new_chunk(action)
|
64
|
-
inject(@diff_words, @removed_text
|
62
|
+
inject(@diff_words, @removed_text, @inserted_text)
|
65
63
|
@removed_text = []
|
66
64
|
@inserted_text = []
|
67
65
|
end
|
@@ -76,38 +74,69 @@ class HtmlDiffRenderer
|
|
76
74
|
end
|
77
75
|
|
78
76
|
def get_result
|
79
|
-
inject(@diff_words, @removed_text
|
77
|
+
inject(@diff_words, @removed_text, @inserted_text)
|
80
78
|
|
81
79
|
@diff_words.xml_join
|
82
80
|
end
|
83
81
|
|
84
82
|
private
|
85
83
|
|
86
|
-
HTML_ELEMENT = /<([
|
87
|
-
|
88
|
-
def inject(words,
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
84
|
+
HTML_ELEMENT = /<([^\s>]+)(\s+[^>]+)?>/
|
85
|
+
|
86
|
+
def inject(words, old_words, new_words)
|
87
|
+
old_words, new_words = group_words(old_words), group_words(new_words)
|
88
|
+
old_words.fill(nil, old_words.size, new_words.size - old_words.size)
|
89
|
+
pairs = old_words.zip(new_words)
|
90
|
+
|
91
|
+
pairs.each do |pair|
|
92
|
+
match_old = pair.first.match(HTML_ELEMENT) if pair.first
|
93
|
+
match_new = pair.last.match(HTML_ELEMENT) if pair.last
|
94
|
+
if match_old && match_new && match_old[1..2] == match_new[1..2]
|
95
|
+
old_content, new_content = match_old.post_match, match_new.post_match
|
96
|
+
old_content = old_content[0..(old_content.size - match_old[1].size - 4)]
|
97
|
+
new_content = new_content[0..(new_content.size - match_new[1].size - 4)]
|
98
|
+
words << ["<#{match_old[1..2].join}>",
|
99
|
+
HtmlDiffRenderer.new.render_html_diff(old_content, new_content),
|
100
|
+
"</#{match_old[1]}>"].xml_join
|
101
|
+
else
|
102
|
+
injection = ''
|
103
|
+
injection += enclose('#ffb8b8', pair.first) if pair.first
|
104
|
+
injection += enclose('#b8ffb8', pair.last) if pair.last
|
105
|
+
words << injection
|
106
|
+
end
|
102
107
|
end
|
103
108
|
words
|
104
109
|
end
|
105
|
-
|
110
|
+
|
106
111
|
def enclose(color, text)
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
+
if (md = text.match(HTML_ELEMENT)) && md[0][-2..-1] != '/>'
|
113
|
+
match = text.match(HTML_ELEMENT)
|
114
|
+
text = match.post_match
|
115
|
+
text = text.slice(0, text.size - match[1].size - 3) # '</>'.size => 3
|
116
|
+
|
117
|
+
"<#{match[1..2].join}><span style=\"background: #{color}\">#{text}</span></#{match[1]}>"
|
118
|
+
else
|
119
|
+
"<span style=\"background: #{color}\">#{text}</span>"
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
def group_words(words)
|
124
|
+
group = []
|
125
|
+
words.each do |w|
|
126
|
+
if group.empty? || inserting_tag?(w) || last_is_tag?(group)
|
127
|
+
group << w
|
128
|
+
else
|
129
|
+
group.last << ' ' << w
|
130
|
+
end
|
131
|
+
end
|
132
|
+
group
|
133
|
+
end
|
134
|
+
|
135
|
+
def inserting_tag?(word)
|
136
|
+
?< == word[0]
|
137
|
+
end
|
138
|
+
|
139
|
+
def last_is_tag?(words)
|
140
|
+
?> == words.last[-1]
|
112
141
|
end
|
113
142
|
end
|
Binary file
|
Binary file
|
@@ -118,6 +118,10 @@ div.inner {
|
|
118
118
|
padding: 4px 4px 12px 4px;
|
119
119
|
}
|
120
120
|
|
121
|
+
div.inner span.meta {
|
122
|
+
font-size: 0.8em;
|
123
|
+
}
|
124
|
+
|
121
125
|
div.toolbar {
|
122
126
|
font-size: 0.8em;
|
123
127
|
}
|
@@ -288,6 +292,10 @@ div#page_properties div.inner {
|
|
288
292
|
background-color: #e8f2f2;
|
289
293
|
}
|
290
294
|
|
295
|
+
a.done {
|
296
|
+
text-decoration: line-through;
|
297
|
+
}
|
298
|
+
|
291
299
|
#footer {
|
292
300
|
padding: 4px 6px 2px 8px;
|
293
301
|
font-size: x-small;
|
data/script/ticker
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
3
|
# Motiro - A project tracking tool
|
4
|
-
# Copyright (C) 2006 Thiago Arrais
|
4
|
+
# Copyright (C) 2006-2008 Thiago Arrais
|
5
5
|
#
|
6
6
|
# This program is free software; you can redistribute it and/or modify
|
7
7
|
# it under the terms of the GNU General Public License as published by
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Motiro - A project tracking tool
|
2
|
-
# Copyright (C) 2006-
|
2
|
+
# Copyright (C) 2006-2008 Thiago Arrais
|
3
3
|
#
|
4
4
|
# This program is free software; you can redistribute it and/or modify
|
5
5
|
# it under the terms of the GNU General Public License as published by
|
@@ -30,7 +30,7 @@ class WikiAcceptanceTest < AcceptanceTestCase
|
|
30
30
|
|
31
31
|
wait_for_page_to_load(1000)
|
32
32
|
|
33
|
-
assert_element_present "//h1[
|
33
|
+
assert_element_present "//h1/a[@name = 'Motiro']"
|
34
34
|
assert_text_present 'This is project motiro'
|
35
35
|
end
|
36
36
|
|
@@ -199,4 +199,4 @@ class WikiAcceptanceTest < AcceptanceTestCase
|
|
199
199
|
assert_element_not_present "//select/option[text() = '2007']"
|
200
200
|
end
|
201
201
|
|
202
|
-
end
|
202
|
+
end
|
data/test/contract/darcs_test.rb
CHANGED
data/test/contract/svn_test.rb
CHANGED