##// END OF EJS Templates
Merged r2664, r2665, r2670, r2674, r2677, r2679 from trunk....
Jean-Philippe Lang -
r2589:7b699af83748
parent child
Show More
@@ -1,151 +1,150
1 # redMine - project management software
1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 require "digest/md5"
18 require "digest/md5"
19
19
20 class Attachment < ActiveRecord::Base
20 class Attachment < ActiveRecord::Base
21 belongs_to :container, :polymorphic => true
21 belongs_to :container, :polymorphic => true
22 belongs_to :author, :class_name => "User", :foreign_key => "author_id"
22 belongs_to :author, :class_name => "User", :foreign_key => "author_id"
23
23
24 validates_presence_of :container, :filename, :author
24 validates_presence_of :container, :filename, :author
25 validates_length_of :filename, :maximum => 255
25 validates_length_of :filename, :maximum => 255
26 validates_length_of :disk_filename, :maximum => 255
26 validates_length_of :disk_filename, :maximum => 255
27
27
28 acts_as_event :title => :filename,
28 acts_as_event :title => :filename,
29 :url => Proc.new {|o| {:controller => 'attachments', :action => 'download', :id => o.id, :filename => o.filename}}
29 :url => Proc.new {|o| {:controller => 'attachments', :action => 'download', :id => o.id, :filename => o.filename}}
30
30
31 acts_as_activity_provider :type => 'files',
31 acts_as_activity_provider :type => 'files',
32 :permission => :view_files,
32 :permission => :view_files,
33 :author_key => :author_id,
33 :author_key => :author_id,
34 :find_options => {:select => "#{Attachment.table_name}.*",
34 :find_options => {:select => "#{Attachment.table_name}.*",
35 :joins => "LEFT JOIN #{Version.table_name} ON #{Attachment.table_name}.container_type='Version' AND #{Version.table_name}.id = #{Attachment.table_name}.container_id " +
35 :joins => "LEFT JOIN #{Version.table_name} ON #{Attachment.table_name}.container_type='Version' AND #{Version.table_name}.id = #{Attachment.table_name}.container_id " +
36 "LEFT JOIN #{Project.table_name} ON #{Version.table_name}.project_id = #{Project.table_name}.id OR ( #{Attachment.table_name}.container_type='Project' AND #{Attachment.table_name}.container_id = #{Project.table_name}.id )"}
36 "LEFT JOIN #{Project.table_name} ON #{Version.table_name}.project_id = #{Project.table_name}.id OR ( #{Attachment.table_name}.container_type='Project' AND #{Attachment.table_name}.container_id = #{Project.table_name}.id )"}
37
37
38 acts_as_activity_provider :type => 'documents',
38 acts_as_activity_provider :type => 'documents',
39 :permission => :view_documents,
39 :permission => :view_documents,
40 :author_key => :author_id,
40 :author_key => :author_id,
41 :find_options => {:select => "#{Attachment.table_name}.*",
41 :find_options => {:select => "#{Attachment.table_name}.*",
42 :joins => "LEFT JOIN #{Document.table_name} ON #{Attachment.table_name}.container_type='Document' AND #{Document.table_name}.id = #{Attachment.table_name}.container_id " +
42 :joins => "LEFT JOIN #{Document.table_name} ON #{Attachment.table_name}.container_type='Document' AND #{Document.table_name}.id = #{Attachment.table_name}.container_id " +
43 "LEFT JOIN #{Project.table_name} ON #{Document.table_name}.project_id = #{Project.table_name}.id"}
43 "LEFT JOIN #{Project.table_name} ON #{Document.table_name}.project_id = #{Project.table_name}.id"}
44
44
45 cattr_accessor :storage_path
45 cattr_accessor :storage_path
46 @@storage_path = "#{RAILS_ROOT}/files"
46 @@storage_path = "#{RAILS_ROOT}/files"
47
47
48 def validate
48 def validate
49 errors.add_to_base :too_long if self.filesize > Setting.attachment_max_size.to_i.kilobytes
49 errors.add_to_base :too_long if self.filesize > Setting.attachment_max_size.to_i.kilobytes
50 end
50 end
51
51
52 def file=(incoming_file)
52 def file=(incoming_file)
53 unless incoming_file.nil?
53 unless incoming_file.nil?
54 @temp_file = incoming_file
54 @temp_file = incoming_file
55 if @temp_file.size > 0
55 if @temp_file.size > 0
56 self.filename = sanitize_filename(@temp_file.original_filename)
56 self.filename = sanitize_filename(@temp_file.original_filename)
57 self.disk_filename = Attachment.disk_filename(filename)
57 self.disk_filename = Attachment.disk_filename(filename)
58 self.content_type = @temp_file.content_type.to_s.chomp
58 self.content_type = @temp_file.content_type.to_s.chomp
59 self.filesize = @temp_file.size
59 self.filesize = @temp_file.size
60 end
60 end
61 end
61 end
62 end
62 end
63
63
64 def file
64 def file
65 nil
65 nil
66 end
66 end
67
67
68 # Copy temp file to its final location
68 # Copies the temporary file to its final location
69 # and computes its MD5 hash
69 def before_save
70 def before_save
70 if @temp_file && (@temp_file.size > 0)
71 if @temp_file && (@temp_file.size > 0)
71 logger.debug("saving '#{self.diskfile}'")
72 logger.debug("saving '#{self.diskfile}'")
73 md5 = Digest::MD5.new
72 File.open(diskfile, "wb") do |f|
74 File.open(diskfile, "wb") do |f|
73 f.write(@temp_file.read)
75 buffer = ""
76 while (buffer = @temp_file.read(8192))
77 f.write(buffer)
78 md5.update(buffer)
79 end
74 end
80 end
75 self.digest = self.class.digest(diskfile)
81 self.digest = md5.hexdigest
76 end
82 end
77 # Don't save the content type if it's longer than the authorized length
83 # Don't save the content type if it's longer than the authorized length
78 if self.content_type && self.content_type.length > 255
84 if self.content_type && self.content_type.length > 255
79 self.content_type = nil
85 self.content_type = nil
80 end
86 end
81 end
87 end
82
88
83 # Deletes file on the disk
89 # Deletes file on the disk
84 def after_destroy
90 def after_destroy
85 File.delete(diskfile) if !filename.blank? && File.exist?(diskfile)
91 File.delete(diskfile) if !filename.blank? && File.exist?(diskfile)
86 end
92 end
87
93
88 # Returns file's location on disk
94 # Returns file's location on disk
89 def diskfile
95 def diskfile
90 "#{@@storage_path}/#{self.disk_filename}"
96 "#{@@storage_path}/#{self.disk_filename}"
91 end
97 end
92
98
93 def increment_download
99 def increment_download
94 increment!(:downloads)
100 increment!(:downloads)
95 end
101 end
96
102
97 def project
103 def project
98 container.project
104 container.project
99 end
105 end
100
106
101 def visible?(user=User.current)
107 def visible?(user=User.current)
102 container.attachments_visible?(user)
108 container.attachments_visible?(user)
103 end
109 end
104
110
105 def deletable?(user=User.current)
111 def deletable?(user=User.current)
106 container.attachments_deletable?(user)
112 container.attachments_deletable?(user)
107 end
113 end
108
114
109 def image?
115 def image?
110 self.filename =~ /\.(jpe?g|gif|png)$/i
116 self.filename =~ /\.(jpe?g|gif|png)$/i
111 end
117 end
112
118
113 def is_text?
119 def is_text?
114 Redmine::MimeType.is_type?('text', filename)
120 Redmine::MimeType.is_type?('text', filename)
115 end
121 end
116
122
117 def is_diff?
123 def is_diff?
118 self.filename =~ /\.(patch|diff)$/i
124 self.filename =~ /\.(patch|diff)$/i
119 end
125 end
120
126
121 private
127 private
122 def sanitize_filename(value)
128 def sanitize_filename(value)
123 # get only the filename, not the whole path
129 # get only the filename, not the whole path
124 just_filename = value.gsub(/^.*(\\|\/)/, '')
130 just_filename = value.gsub(/^.*(\\|\/)/, '')
125 # NOTE: File.basename doesn't work right with Windows paths on Unix
131 # NOTE: File.basename doesn't work right with Windows paths on Unix
126 # INCORRECT: just_filename = File.basename(value.gsub('\\\\', '/'))
132 # INCORRECT: just_filename = File.basename(value.gsub('\\\\', '/'))
127
133
128 # Finally, replace all non alphanumeric, hyphens or periods with underscore
134 # Finally, replace all non alphanumeric, hyphens or periods with underscore
129 @filename = just_filename.gsub(/[^\w\.\-]/,'_')
135 @filename = just_filename.gsub(/[^\w\.\-]/,'_')
130 end
136 end
131
137
132 # Returns an ASCII or hashed filename
138 # Returns an ASCII or hashed filename
133 def self.disk_filename(filename)
139 def self.disk_filename(filename)
134 df = DateTime.now.strftime("%y%m%d%H%M%S") + "_"
140 df = DateTime.now.strftime("%y%m%d%H%M%S") + "_"
135 if filename =~ %r{^[a-zA-Z0-9_\.\-]*$}
141 if filename =~ %r{^[a-zA-Z0-9_\.\-]*$}
136 df << filename
142 df << filename
137 else
143 else
138 df << Digest::MD5.hexdigest(filename)
144 df << Digest::MD5.hexdigest(filename)
139 # keep the extension if any
145 # keep the extension if any
140 df << $1 if filename =~ %r{(\.[a-zA-Z0-9]+)$}
146 df << $1 if filename =~ %r{(\.[a-zA-Z0-9]+)$}
141 end
147 end
142 df
148 df
143 end
149 end
144
145 # Returns the MD5 digest of the file at given path
146 def self.digest(filename)
147 File.open(filename, 'rb') do |f|
148 Digest::MD5.hexdigest(f.read)
149 end
150 end
151 end
150 end
@@ -1,24 +1,29
1 <h2><%=l(:label_settings)%></h2>
1 <h2><%=l(:label_settings)%></h2>
2
2
3 <% tabs = project_settings_tabs %>
3 <% tabs = project_settings_tabs %>
4
5 <% if tabs.any? %>
4 <% selected_tab = params[:tab] ? params[:tab].to_s : tabs.first[:name] %>
6 <% selected_tab = params[:tab] ? params[:tab].to_s : tabs.first[:name] %>
5
7
6 <div class="tabs">
8 <div class="tabs">
7 <ul>
9 <ul>
8 <% tabs.each do |tab| -%>
10 <% tabs.each do |tab| -%>
9 <li><%= link_to l(tab[:label]), { :tab => tab[:name] },
11 <li><%= link_to l(tab[:label]), { :tab => tab[:name] },
10 :id => "tab-#{tab[:name]}",
12 :id => "tab-#{tab[:name]}",
11 :class => (tab[:name] != selected_tab ? nil : 'selected'),
13 :class => (tab[:name] != selected_tab ? nil : 'selected'),
12 :onclick => "showTab('#{tab[:name]}'); this.blur(); return false;" %></li>
14 :onclick => "showTab('#{tab[:name]}'); this.blur(); return false;" %></li>
13 <% end -%>
15 <% end -%>
14 </ul>
16 </ul>
15 </div>
17 </div>
16
18
17 <% tabs.each do |tab| -%>
19 <% tabs.each do |tab| -%>
18 <%= content_tag('div', render(:partial => tab[:partial]),
20 <%= content_tag('div', render(:partial => tab[:partial]),
19 :id => "tab-content-#{tab[:name]}",
21 :id => "tab-content-#{tab[:name]}",
20 :style => (tab[:name] != selected_tab ? 'display:none' : nil),
22 :style => (tab[:name] != selected_tab ? 'display:none' : nil),
21 :class => 'tab-content') %>
23 :class => 'tab-content') %>
22 <% end -%>
24 <% end -%>
25 <% else %>
26 <p class="nodata"><%= l(:label_no_data) %></p>
27 <% end %>
23
28
24 <% html_title(l(:label_settings)) -%>
29 <% html_title(l(:label_settings)) -%>
@@ -1,896 +1,905
1 == Redmine changelog
1 == Redmine changelog
2
2
3 Redmine - project management software
3 Redmine - project management software
4 Copyright (C) 2006-2009 Jean-Philippe Lang
4 Copyright (C) 2006-2009 Jean-Philippe Lang
5 http://www.redmine.org/
5 http://www.redmine.org/
6
6
7
7
8 == 2009-xx-xx v0.8.4
9
10 * Allow textile mailto links
11 * Fixed: memory consumption when uploading file
12 * Fixed: Mercurial integration doesn't work if Redmine is installed in folder path containing space
13 * Fixed: an error is raised when no tab is available on project settings
14 * Fixed: insert image macro corrupts urls with excalamation marks
15
16
8 == 2009-04-05 v0.8.3
17 == 2009-04-05 v0.8.3
9
18
10 * Separate project field and subject in cross-project issue view
19 * Separate project field and subject in cross-project issue view
11 * Ability to set language for redmine:load_default_data task using REDMINE_LANG environment variable
20 * Ability to set language for redmine:load_default_data task using REDMINE_LANG environment variable
12 * Rescue Redmine::DefaultData::DataAlreadyLoaded in redmine:load_default_data task
21 * Rescue Redmine::DefaultData::DataAlreadyLoaded in redmine:load_default_data task
13 * CSS classes to highlight own and assigned issues
22 * CSS classes to highlight own and assigned issues
14 * Hide "New file" link on wiki pages from printing
23 * Hide "New file" link on wiki pages from printing
15 * Flush buffer when asking for language in redmine:load_default_data task
24 * Flush buffer when asking for language in redmine:load_default_data task
16 * Minimum project identifier length set to 1
25 * Minimum project identifier length set to 1
17 * Include headers so that emails don't trigger vacation auto-responders
26 * Include headers so that emails don't trigger vacation auto-responders
18 * Fixed: Time entries csv export links for all projects are malformed
27 * Fixed: Time entries csv export links for all projects are malformed
19 * Fixed: Files without Version aren't visible in the Activity page
28 * Fixed: Files without Version aren't visible in the Activity page
20 * Fixed: Commit logs are centered in the repo browser
29 * Fixed: Commit logs are centered in the repo browser
21 * Fixed: News summary field content is not searchable
30 * Fixed: News summary field content is not searchable
22 * Fixed: Journal#save has a wrong signature
31 * Fixed: Journal#save has a wrong signature
23 * Fixed: Email footer signature convention
32 * Fixed: Email footer signature convention
24 * Fixed: Timelog report do not show time for non-versioned issues
33 * Fixed: Timelog report do not show time for non-versioned issues
25
34
26
35
27 == 2009-03-07 v0.8.2
36 == 2009-03-07 v0.8.2
28
37
29 * Send an email to the user when an administrator activates a registered user
38 * Send an email to the user when an administrator activates a registered user
30 * Strip keywords from received email body
39 * Strip keywords from received email body
31 * Footer updated to 2009
40 * Footer updated to 2009
32 * Show RSS-link even when no issues is found
41 * Show RSS-link even when no issues is found
33 * One click filter action in activity view
42 * One click filter action in activity view
34 * Clickable/linkable line #'s while browsing the repo or viewing a file
43 * Clickable/linkable line #'s while browsing the repo or viewing a file
35 * Links to versions on files list
44 * Links to versions on files list
36 * Added request and controller objects to the hooks by default
45 * Added request and controller objects to the hooks by default
37 * Fixed: exporting an issue with attachments to PDF raises an error
46 * Fixed: exporting an issue with attachments to PDF raises an error
38 * Fixed: "too few arguments" error may occur on activerecord error translation
47 * Fixed: "too few arguments" error may occur on activerecord error translation
39 * Fixed: "Default columns Displayed on the Issues list" setting is not easy to read
48 * Fixed: "Default columns Displayed on the Issues list" setting is not easy to read
40 * Fixed: visited links to closed tickets are not striked through with IE6
49 * Fixed: visited links to closed tickets are not striked through with IE6
41 * Fixed: MailHandler#plain_text_body returns nil if there was nothing to strip
50 * Fixed: MailHandler#plain_text_body returns nil if there was nothing to strip
42 * Fixed: MailHandler raises an error when processing an email without From header
51 * Fixed: MailHandler raises an error when processing an email without From header
43
52
44
53
45 == 2009-02-15 v0.8.1
54 == 2009-02-15 v0.8.1
46
55
47 * Select watchers on new issue form
56 * Select watchers on new issue form
48 * Issue description is no longer a required field
57 * Issue description is no longer a required field
49 * Files module: ability to add files without version
58 * Files module: ability to add files without version
50 * Jump to the current tab when using the project quick-jump combo
59 * Jump to the current tab when using the project quick-jump combo
51 * Display a warning if some attachments were not saved
60 * Display a warning if some attachments were not saved
52 * Import custom fields values from emails on issue creation
61 * Import custom fields values from emails on issue creation
53 * Show view/annotate/download links on entry and annotate views
62 * Show view/annotate/download links on entry and annotate views
54 * Admin Info Screen: Display if plugin assets directory is writable
63 * Admin Info Screen: Display if plugin assets directory is writable
55 * Adds a 'Create and continue' button on the new issue form
64 * Adds a 'Create and continue' button on the new issue form
56 * IMAP: add options to move received emails
65 * IMAP: add options to move received emails
57 * Do not show Category field when categories are not defined
66 * Do not show Category field when categories are not defined
58 * Lower the project identifier limit to a minimum of two characters
67 * Lower the project identifier limit to a minimum of two characters
59 * Add "closed" html class to closed entries in issue list
68 * Add "closed" html class to closed entries in issue list
60 * Fixed: broken redirect URL on login failure
69 * Fixed: broken redirect URL on login failure
61 * Fixed: Deleted files are shown when using Darcs
70 * Fixed: Deleted files are shown when using Darcs
62 * Fixed: Darcs adapter works on Win32 only
71 * Fixed: Darcs adapter works on Win32 only
63 * Fixed: syntax highlight doesn't appear in new ticket preview
72 * Fixed: syntax highlight doesn't appear in new ticket preview
64 * Fixed: email notification for changes I make still occurs when running Repository.fetch_changesets
73 * Fixed: email notification for changes I make still occurs when running Repository.fetch_changesets
65 * Fixed: no error is raised when entering invalid hours on the issue update form
74 * Fixed: no error is raised when entering invalid hours on the issue update form
66 * Fixed: Details time log report CSV export doesn't honour date format from settings
75 * Fixed: Details time log report CSV export doesn't honour date format from settings
67 * Fixed: invalid css classes on issue details
76 * Fixed: invalid css classes on issue details
68 * Fixed: Trac importer creates duplicate custom values
77 * Fixed: Trac importer creates duplicate custom values
69 * Fixed: inline attached image should not match partial filename
78 * Fixed: inline attached image should not match partial filename
70
79
71
80
72 == 2008-12-30 v0.8.0
81 == 2008-12-30 v0.8.0
73
82
74 * Setting added in order to limit the number of diff lines that should be displayed
83 * Setting added in order to limit the number of diff lines that should be displayed
75 * Makes logged-in username in topbar linking to
84 * Makes logged-in username in topbar linking to
76 * Mail handler: strip tags when receiving a html-only email
85 * Mail handler: strip tags when receiving a html-only email
77 * Mail handler: add watchers before sending notification
86 * Mail handler: add watchers before sending notification
78 * Adds a css class (overdue) to overdue issues on issue lists and detail views
87 * Adds a css class (overdue) to overdue issues on issue lists and detail views
79 * Fixed: project activity truncated after viewing user's activity
88 * Fixed: project activity truncated after viewing user's activity
80 * Fixed: email address entered for password recovery shouldn't be case-sensitive
89 * Fixed: email address entered for password recovery shouldn't be case-sensitive
81 * Fixed: default flag removed when editing a default enumeration
90 * Fixed: default flag removed when editing a default enumeration
82 * Fixed: default category ignored when adding a document
91 * Fixed: default category ignored when adding a document
83 * Fixed: error on repository user mapping when a repository username is blank
92 * Fixed: error on repository user mapping when a repository username is blank
84 * Fixed: Firefox cuts off large diffs
93 * Fixed: Firefox cuts off large diffs
85 * Fixed: CVS browser should not show dead revisions (deleted files)
94 * Fixed: CVS browser should not show dead revisions (deleted files)
86 * Fixed: escape double-quotes in image titles
95 * Fixed: escape double-quotes in image titles
87 * Fixed: escape textarea content when editing a issue note
96 * Fixed: escape textarea content when editing a issue note
88 * Fixed: JS error on context menu with IE
97 * Fixed: JS error on context menu with IE
89 * Fixed: bold syntax around single character in series doesn't work
98 * Fixed: bold syntax around single character in series doesn't work
90 * Fixed several XSS vulnerabilities
99 * Fixed several XSS vulnerabilities
91 * Fixed a SQL injection vulnerability
100 * Fixed a SQL injection vulnerability
92
101
93
102
94 == 2008-12-07 v0.8.0-rc1
103 == 2008-12-07 v0.8.0-rc1
95
104
96 * Wiki page protection
105 * Wiki page protection
97 * Wiki page hierarchy. Parent page can be assigned on the Rename screen
106 * Wiki page hierarchy. Parent page can be assigned on the Rename screen
98 * Adds support for issue creation via email
107 * Adds support for issue creation via email
99 * Adds support for free ticket filtering and custom queries on Gantt chart and calendar
108 * Adds support for free ticket filtering and custom queries on Gantt chart and calendar
100 * Cross-project search
109 * Cross-project search
101 * Ability to search a project and its subprojects
110 * Ability to search a project and its subprojects
102 * Ability to search the projects the user belongs to
111 * Ability to search the projects the user belongs to
103 * Adds custom fields on time entries
112 * Adds custom fields on time entries
104 * Adds boolean and list custom fields for time entries as criteria on time report
113 * Adds boolean and list custom fields for time entries as criteria on time report
105 * Cross-project time reports
114 * Cross-project time reports
106 * Display latest user's activity on account/show view
115 * Display latest user's activity on account/show view
107 * Show last connexion time on user's page
116 * Show last connexion time on user's page
108 * Obfuscates email address on user's account page using javascript
117 * Obfuscates email address on user's account page using javascript
109 * wiki TOC rendered as an unordered list
118 * wiki TOC rendered as an unordered list
110 * Adds the ability to search for a user on the administration users list
119 * Adds the ability to search for a user on the administration users list
111 * Adds the ability to search for a project name or identifier on the administration projects list
120 * Adds the ability to search for a project name or identifier on the administration projects list
112 * Redirect user to the previous page after logging in
121 * Redirect user to the previous page after logging in
113 * Adds a permission 'view wiki edits' so that wiki history can be hidden to certain users
122 * Adds a permission 'view wiki edits' so that wiki history can be hidden to certain users
114 * Adds permissions for viewing the watcher list and adding new watchers on the issue detail view
123 * Adds permissions for viewing the watcher list and adding new watchers on the issue detail view
115 * Adds permissions to let users edit and/or delete their messages
124 * Adds permissions to let users edit and/or delete their messages
116 * Link to activity view when displaying dates
125 * Link to activity view when displaying dates
117 * Hide Redmine version in atom feeds and pdf properties
126 * Hide Redmine version in atom feeds and pdf properties
118 * Maps repository users to Redmine users. Users with same username or email are automatically mapped. Mapping can be manually adjusted in repository settings. Multiple usernames can be mapped to the same Redmine user.
127 * Maps repository users to Redmine users. Users with same username or email are automatically mapped. Mapping can be manually adjusted in repository settings. Multiple usernames can be mapped to the same Redmine user.
119 * Sort users by their display names so that user dropdown lists are sorted alphabetically
128 * Sort users by their display names so that user dropdown lists are sorted alphabetically
120 * Adds estimated hours to issue filters
129 * Adds estimated hours to issue filters
121 * Switch order of current and previous revisions in side-by-side diff
130 * Switch order of current and previous revisions in side-by-side diff
122 * Render the commit changes list as a tree
131 * Render the commit changes list as a tree
123 * Adds watch/unwatch functionality at forum topic level
132 * Adds watch/unwatch functionality at forum topic level
124 * When moving an issue to another project, reassign it to the category with same name if any
133 * When moving an issue to another project, reassign it to the category with same name if any
125 * Adds child_pages macro for wiki pages
134 * Adds child_pages macro for wiki pages
126 * Use GET instead of POST on roadmap (#718), gantt and calendar forms
135 * Use GET instead of POST on roadmap (#718), gantt and calendar forms
127 * Search engine: display total results count and count by result type
136 * Search engine: display total results count and count by result type
128 * Email delivery configuration moved to an unversioned YAML file (config/email.yml, see the sample file)
137 * Email delivery configuration moved to an unversioned YAML file (config/email.yml, see the sample file)
129 * Adds icons on search results
138 * Adds icons on search results
130 * Adds 'Edit' link on account/show for admin users
139 * Adds 'Edit' link on account/show for admin users
131 * Adds Lock/Unlock/Activate link on user edit screen
140 * Adds Lock/Unlock/Activate link on user edit screen
132 * Adds user count in status drop down on admin user list
141 * Adds user count in status drop down on admin user list
133 * Adds multi-levels blockquotes support by using > at the beginning of lines
142 * Adds multi-levels blockquotes support by using > at the beginning of lines
134 * Adds a Reply link to each issue note
143 * Adds a Reply link to each issue note
135 * Adds plain text only option for mail notifications
144 * Adds plain text only option for mail notifications
136 * Gravatar support for issue detail, user grid, and activity stream (disabled by default)
145 * Gravatar support for issue detail, user grid, and activity stream (disabled by default)
137 * Adds 'Delete wiki pages attachments' permission
146 * Adds 'Delete wiki pages attachments' permission
138 * Show the most recent file when displaying an inline image
147 * Show the most recent file when displaying an inline image
139 * Makes permission screens localized
148 * Makes permission screens localized
140 * AuthSource list: display associated users count and disable 'Delete' buton if any
149 * AuthSource list: display associated users count and disable 'Delete' buton if any
141 * Make the 'duplicates of' relation asymmetric
150 * Make the 'duplicates of' relation asymmetric
142 * Adds username to the password reminder email
151 * Adds username to the password reminder email
143 * Adds links to forum messages using message#id syntax
152 * Adds links to forum messages using message#id syntax
144 * Allow same name for custom fields on different object types
153 * Allow same name for custom fields on different object types
145 * One-click bulk edition using the issue list context menu within the same project
154 * One-click bulk edition using the issue list context menu within the same project
146 * Adds support for commit logs reencoding to UTF-8 before insertion in the database. Source encoding of commit logs can be selected in Application settings -> Repositories.
155 * Adds support for commit logs reencoding to UTF-8 before insertion in the database. Source encoding of commit logs can be selected in Application settings -> Repositories.
147 * Adds checkboxes toggle links on permissions report
156 * Adds checkboxes toggle links on permissions report
148 * Adds Trac-Like anchors on wiki headings
157 * Adds Trac-Like anchors on wiki headings
149 * Adds support for wiki links with anchor
158 * Adds support for wiki links with anchor
150 * Adds category to the issue context menu
159 * Adds category to the issue context menu
151 * Adds a workflow overview screen
160 * Adds a workflow overview screen
152 * Appends the filename to the attachment url so that clients that ignore content-disposition http header get the real filename
161 * Appends the filename to the attachment url so that clients that ignore content-disposition http header get the real filename
153 * Dots allowed in custom field name
162 * Dots allowed in custom field name
154 * Adds posts quoting functionality
163 * Adds posts quoting functionality
155 * Adds an option to generate sequential project identifiers
164 * Adds an option to generate sequential project identifiers
156 * Adds mailto link on the user administration list
165 * Adds mailto link on the user administration list
157 * Ability to remove enumerations (activities, priorities, document categories) that are in use. Associated objects can be reassigned to another value
166 * Ability to remove enumerations (activities, priorities, document categories) that are in use. Associated objects can be reassigned to another value
158 * Gantt chart: display issues that don't have a due date if they are assigned to a version with a date
167 * Gantt chart: display issues that don't have a due date if they are assigned to a version with a date
159 * Change projects homepage limit to 255 chars
168 * Change projects homepage limit to 255 chars
160 * Improved on-the-fly account creation. If some attributes are missing (eg. not present in the LDAP) or are invalid, the registration form is displayed so that the user is able to fill or fix these attributes
169 * Improved on-the-fly account creation. If some attributes are missing (eg. not present in the LDAP) or are invalid, the registration form is displayed so that the user is able to fill or fix these attributes
161 * Adds "please select" to activity select box if no activity is set as default
170 * Adds "please select" to activity select box if no activity is set as default
162 * Do not silently ignore timelog validation failure on issue edit
171 * Do not silently ignore timelog validation failure on issue edit
163 * Adds a rake task to send reminder emails
172 * Adds a rake task to send reminder emails
164 * Allow empty cells in wiki tables
173 * Allow empty cells in wiki tables
165 * Makes wiki text formatter pluggable
174 * Makes wiki text formatter pluggable
166 * Adds back textile acronyms support
175 * Adds back textile acronyms support
167 * Remove pre tag attributes
176 * Remove pre tag attributes
168 * Plugin hooks
177 * Plugin hooks
169 * Pluggable admin menu
178 * Pluggable admin menu
170 * Plugins can provide activity content
179 * Plugins can provide activity content
171 * Moves plugin list to its own administration menu item
180 * Moves plugin list to its own administration menu item
172 * Adds url and author_url plugin attributes
181 * Adds url and author_url plugin attributes
173 * Adds Plugin#requires_redmine method so that plugin compatibility can be checked against current Redmine version
182 * Adds Plugin#requires_redmine method so that plugin compatibility can be checked against current Redmine version
174 * Adds atom feed on time entries details
183 * Adds atom feed on time entries details
175 * Adds project name to issues feed title
184 * Adds project name to issues feed title
176 * Adds a css class on menu items in order to apply item specific styles (eg. icons)
185 * Adds a css class on menu items in order to apply item specific styles (eg. icons)
177 * Adds a Redmine plugin generators
186 * Adds a Redmine plugin generators
178 * Adds timelog link to the issue context menu
187 * Adds timelog link to the issue context menu
179 * Adds links to the user page on various views
188 * Adds links to the user page on various views
180 * Turkish translation by Ismail Sezen
189 * Turkish translation by Ismail Sezen
181 * Catalan translation
190 * Catalan translation
182 * Vietnamese translation
191 * Vietnamese translation
183 * Slovak translation
192 * Slovak translation
184 * Better naming of activity feed if only one kind of event is displayed
193 * Better naming of activity feed if only one kind of event is displayed
185 * Enable syntax highlight on issues, messages and news
194 * Enable syntax highlight on issues, messages and news
186 * Add target version to the issue list context menu
195 * Add target version to the issue list context menu
187 * Hide 'Target version' filter if no version is defined
196 * Hide 'Target version' filter if no version is defined
188 * Add filters on cross-project issue list for custom fields marked as 'For all projects'
197 * Add filters on cross-project issue list for custom fields marked as 'For all projects'
189 * Turn ftp urls into links
198 * Turn ftp urls into links
190 * Hiding the View Differences button when a wiki page's history only has one version
199 * Hiding the View Differences button when a wiki page's history only has one version
191 * Messages on a Board can now be sorted by the number of replies
200 * Messages on a Board can now be sorted by the number of replies
192 * Adds a class ('me') to events of the activity view created by current user
201 * Adds a class ('me') to events of the activity view created by current user
193 * Strip pre/code tags content from activity view events
202 * Strip pre/code tags content from activity view events
194 * Display issue notes in the activity view
203 * Display issue notes in the activity view
195 * Adds links to changesets atom feed on repository browser
204 * Adds links to changesets atom feed on repository browser
196 * Track project and tracker changes in issue history
205 * Track project and tracker changes in issue history
197 * Adds anchor to atom feed messages links
206 * Adds anchor to atom feed messages links
198 * Adds a key in lang files to set the decimal separator (point or comma) in csv exports
207 * Adds a key in lang files to set the decimal separator (point or comma) in csv exports
199 * Makes importer work with Trac 0.8.x
208 * Makes importer work with Trac 0.8.x
200 * Upgraded to Prototype 1.6.0.1
209 * Upgraded to Prototype 1.6.0.1
201 * File viewer for attached text files
210 * File viewer for attached text files
202 * Menu mapper: add support for :before, :after and :last options to #push method and add #delete method
211 * Menu mapper: add support for :before, :after and :last options to #push method and add #delete method
203 * Removed inconsistent revision numbers on diff view
212 * Removed inconsistent revision numbers on diff view
204 * CVS: add support for modules names with spaces
213 * CVS: add support for modules names with spaces
205 * Log the user in after registration if account activation is not needed
214 * Log the user in after registration if account activation is not needed
206 * Mercurial adapter improvements
215 * Mercurial adapter improvements
207 * Trac importer: read session_attribute table to find user's email and real name
216 * Trac importer: read session_attribute table to find user's email and real name
208 * Ability to disable unused SCM adapters in application settings
217 * Ability to disable unused SCM adapters in application settings
209 * Adds Filesystem adapter
218 * Adds Filesystem adapter
210 * Clear changesets and changes with raw sql when deleting a repository for performance
219 * Clear changesets and changes with raw sql when deleting a repository for performance
211 * Redmine.pm now uses the 'commit access' permission defined in Redmine
220 * Redmine.pm now uses the 'commit access' permission defined in Redmine
212 * Reposman can create any type of scm (--scm option)
221 * Reposman can create any type of scm (--scm option)
213 * Reposman creates a repository if the 'repository' module is enabled at project level only
222 * Reposman creates a repository if the 'repository' module is enabled at project level only
214 * Display svn properties in the browser, svn >= 1.5.0 only
223 * Display svn properties in the browser, svn >= 1.5.0 only
215 * Reduces memory usage when importing large git repositories
224 * Reduces memory usage when importing large git repositories
216 * Wider SVG graphs in repository stats
225 * Wider SVG graphs in repository stats
217 * SubversionAdapter#entries performance improvement
226 * SubversionAdapter#entries performance improvement
218 * SCM browser: ability to download raw unified diffs
227 * SCM browser: ability to download raw unified diffs
219 * More detailed error message in log when scm command fails
228 * More detailed error message in log when scm command fails
220 * Adds support for file viewing with Darcs 2.0+
229 * Adds support for file viewing with Darcs 2.0+
221 * Check that git changeset is not in the database before creating it
230 * Check that git changeset is not in the database before creating it
222 * Unified diff viewer for attached files with .patch or .diff extension
231 * Unified diff viewer for attached files with .patch or .diff extension
223 * File size display with Bazaar repositories
232 * File size display with Bazaar repositories
224 * Git adapter: use commit time instead of author time
233 * Git adapter: use commit time instead of author time
225 * Prettier url for changesets
234 * Prettier url for changesets
226 * Makes changes link to entries on the revision view
235 * Makes changes link to entries on the revision view
227 * Adds a field on the repository view to browse at specific revision
236 * Adds a field on the repository view to browse at specific revision
228 * Adds new projects atom feed
237 * Adds new projects atom feed
229 * Added rake tasks to generate rcov code coverage reports
238 * Added rake tasks to generate rcov code coverage reports
230 * Add Redcloth's :block_markdown_rule to allow horizontal rules in wiki
239 * Add Redcloth's :block_markdown_rule to allow horizontal rules in wiki
231 * Show the project hierarchy in the drop down list for new membership on user administration screen
240 * Show the project hierarchy in the drop down list for new membership on user administration screen
232 * Split user edit screen into tabs
241 * Split user edit screen into tabs
233 * Renames bundled RedCloth to RedCloth3 to avoid RedCloth 4 to be loaded instead
242 * Renames bundled RedCloth to RedCloth3 to avoid RedCloth 4 to be loaded instead
234 * Fixed: Roadmap crashes when a version has a due date > 2037
243 * Fixed: Roadmap crashes when a version has a due date > 2037
235 * Fixed: invalid effective date (eg. 99999-01-01) causes an error on version edition screen
244 * Fixed: invalid effective date (eg. 99999-01-01) causes an error on version edition screen
236 * Fixed: login filter providing incorrect back_url for Redmine installed in sub-directory
245 * Fixed: login filter providing incorrect back_url for Redmine installed in sub-directory
237 * Fixed: logtime entry duplicated when edited from parent project
246 * Fixed: logtime entry duplicated when edited from parent project
238 * Fixed: wrong digest for text files under Windows
247 * Fixed: wrong digest for text files under Windows
239 * Fixed: associated revisions are displayed in wrong order on issue view
248 * Fixed: associated revisions are displayed in wrong order on issue view
240 * Fixed: Git Adapter date parsing ignores timezone
249 * Fixed: Git Adapter date parsing ignores timezone
241 * Fixed: Printing long roadmap doesn't split across pages
250 * Fixed: Printing long roadmap doesn't split across pages
242 * Fixes custom fields display order at several places
251 * Fixes custom fields display order at several places
243 * Fixed: urls containing @ are parsed as email adress by the wiki formatter
252 * Fixed: urls containing @ are parsed as email adress by the wiki formatter
244 * Fixed date filters accuracy with SQLite
253 * Fixed date filters accuracy with SQLite
245 * Fixed: tokens not escaped in highlight_tokens regexp
254 * Fixed: tokens not escaped in highlight_tokens regexp
246 * Fixed Bazaar shared repository browsing
255 * Fixed Bazaar shared repository browsing
247 * Fixes platform determination under JRuby
256 * Fixes platform determination under JRuby
248 * Fixed: Estimated time in issue's journal should be rounded to two decimals
257 * Fixed: Estimated time in issue's journal should be rounded to two decimals
249 * Fixed: 'search titles only' box ignored after one search is done on titles only
258 * Fixed: 'search titles only' box ignored after one search is done on titles only
250 * Fixed: non-ASCII subversion path can't be displayed
259 * Fixed: non-ASCII subversion path can't be displayed
251 * Fixed: Inline images don't work if file name has upper case letters or if image is in BMP format
260 * Fixed: Inline images don't work if file name has upper case letters or if image is in BMP format
252 * Fixed: document listing shows on "my page" when viewing documents is disabled for the role
261 * Fixed: document listing shows on "my page" when viewing documents is disabled for the role
253 * Fixed: Latest news appear on the homepage for projects with the News module disabled
262 * Fixed: Latest news appear on the homepage for projects with the News module disabled
254 * Fixed: cross-project issue list should not show issues of projects for which the issue tracking module was disabled
263 * Fixed: cross-project issue list should not show issues of projects for which the issue tracking module was disabled
255 * Fixed: the default status is lost when reordering issue statuses
264 * Fixed: the default status is lost when reordering issue statuses
256 * Fixes error with Postgresql and non-UTF8 commit logs
265 * Fixes error with Postgresql and non-UTF8 commit logs
257 * Fixed: textile footnotes no longer work
266 * Fixed: textile footnotes no longer work
258 * Fixed: http links containing parentheses fail to reder correctly
267 * Fixed: http links containing parentheses fail to reder correctly
259 * Fixed: GitAdapter#get_rev should use current branch instead of hardwiring master
268 * Fixed: GitAdapter#get_rev should use current branch instead of hardwiring master
260
269
261
270
262 == 2008-07-06 v0.7.3
271 == 2008-07-06 v0.7.3
263
272
264 * Allow dot in firstnames and lastnames
273 * Allow dot in firstnames and lastnames
265 * Add project name to cross-project Atom feeds
274 * Add project name to cross-project Atom feeds
266 * Encoding set to utf8 in example database.yml
275 * Encoding set to utf8 in example database.yml
267 * HTML titles on forums related views
276 * HTML titles on forums related views
268 * Fixed: various XSS vulnerabilities
277 * Fixed: various XSS vulnerabilities
269 * Fixed: Entourage (and some old client) fails to correctly render notification styles
278 * Fixed: Entourage (and some old client) fails to correctly render notification styles
270 * Fixed: Fixed: timelog redirects inappropriately when :back_url is blank
279 * Fixed: Fixed: timelog redirects inappropriately when :back_url is blank
271 * Fixed: wrong relative paths to images in wiki_syntax.html
280 * Fixed: wrong relative paths to images in wiki_syntax.html
272
281
273
282
274 == 2008-06-15 v0.7.2
283 == 2008-06-15 v0.7.2
275
284
276 * "New Project" link on Projects page
285 * "New Project" link on Projects page
277 * Links to repository directories on the repo browser
286 * Links to repository directories on the repo browser
278 * Move status to front in Activity View
287 * Move status to front in Activity View
279 * Remove edit step from Status context menu
288 * Remove edit step from Status context menu
280 * Fixed: No way to do textile horizontal rule
289 * Fixed: No way to do textile horizontal rule
281 * Fixed: Repository: View differences doesn't work
290 * Fixed: Repository: View differences doesn't work
282 * Fixed: attachement's name maybe invalid.
291 * Fixed: attachement's name maybe invalid.
283 * Fixed: Error when creating a new issue
292 * Fixed: Error when creating a new issue
284 * Fixed: NoMethodError on @available_filters.has_key?
293 * Fixed: NoMethodError on @available_filters.has_key?
285 * Fixed: Check All / Uncheck All in Email Settings
294 * Fixed: Check All / Uncheck All in Email Settings
286 * Fixed: "View differences" of one file at /repositories/revision/ fails
295 * Fixed: "View differences" of one file at /repositories/revision/ fails
287 * Fixed: Column width in "my page"
296 * Fixed: Column width in "my page"
288 * Fixed: private subprojects are listed on Issues view
297 * Fixed: private subprojects are listed on Issues view
289 * Fixed: Textile: bold, italics, underline, etc... not working after parentheses
298 * Fixed: Textile: bold, italics, underline, etc... not working after parentheses
290 * Fixed: Update issue form: comment field from log time end out of screen
299 * Fixed: Update issue form: comment field from log time end out of screen
291 * Fixed: Editing role: "issue can be assigned to this role" out of box
300 * Fixed: Editing role: "issue can be assigned to this role" out of box
292 * Fixed: Unable use angular braces after include word
301 * Fixed: Unable use angular braces after include word
293 * Fixed: Using '*' as keyword for repository referencing keywords doesn't work
302 * Fixed: Using '*' as keyword for repository referencing keywords doesn't work
294 * Fixed: Subversion repository "View differences" on each file rise ERROR
303 * Fixed: Subversion repository "View differences" on each file rise ERROR
295 * Fixed: View differences for individual file of a changeset fails if the repository URL doesn't point to the repository root
304 * Fixed: View differences for individual file of a changeset fails if the repository URL doesn't point to the repository root
296 * Fixed: It is possible to lock out the last admin account
305 * Fixed: It is possible to lock out the last admin account
297 * Fixed: Wikis are viewable for anonymous users on public projects, despite not granting access
306 * Fixed: Wikis are viewable for anonymous users on public projects, despite not granting access
298 * Fixed: Issue number display clipped on 'my issues'
307 * Fixed: Issue number display clipped on 'my issues'
299 * Fixed: Roadmap version list links not carrying state
308 * Fixed: Roadmap version list links not carrying state
300 * Fixed: Log Time fieldset in IssueController#edit doesn't set default Activity as default
309 * Fixed: Log Time fieldset in IssueController#edit doesn't set default Activity as default
301 * Fixed: git's "get_rev" API should use repo's current branch instead of hardwiring "master"
310 * Fixed: git's "get_rev" API should use repo's current branch instead of hardwiring "master"
302 * Fixed: browser's language subcodes ignored
311 * Fixed: browser's language subcodes ignored
303 * Fixed: Error on project selection with numeric (only) identifier.
312 * Fixed: Error on project selection with numeric (only) identifier.
304 * Fixed: Link to PDF doesn't work after creating new issue
313 * Fixed: Link to PDF doesn't work after creating new issue
305 * Fixed: "Replies" should not be shown on forum threads that are locked
314 * Fixed: "Replies" should not be shown on forum threads that are locked
306 * Fixed: SVN errors lead to svn username/password being displayed to end users (security issue)
315 * Fixed: SVN errors lead to svn username/password being displayed to end users (security issue)
307 * Fixed: http links containing hashes don't display correct
316 * Fixed: http links containing hashes don't display correct
308 * Fixed: Allow ampersands in Enumeration names
317 * Fixed: Allow ampersands in Enumeration names
309 * Fixed: Atom link on saved query does not include query_id
318 * Fixed: Atom link on saved query does not include query_id
310 * Fixed: Logtime info lost when there's an error updating an issue
319 * Fixed: Logtime info lost when there's an error updating an issue
311 * Fixed: TOC does not parse colorization markups
320 * Fixed: TOC does not parse colorization markups
312 * Fixed: CVS: add support for modules names with spaces
321 * Fixed: CVS: add support for modules names with spaces
313 * Fixed: Bad rendering on projects/add
322 * Fixed: Bad rendering on projects/add
314 * Fixed: exception when viewing differences on cvs
323 * Fixed: exception when viewing differences on cvs
315 * Fixed: export issue to pdf will messup when use Chinese language
324 * Fixed: export issue to pdf will messup when use Chinese language
316 * Fixed: Redmine::Scm::Adapters::GitAdapter#get_rev ignored GIT_BIN constant
325 * Fixed: Redmine::Scm::Adapters::GitAdapter#get_rev ignored GIT_BIN constant
317 * Fixed: Adding non-ASCII new issue type in the New Issue page have encoding error using IE
326 * Fixed: Adding non-ASCII new issue type in the New Issue page have encoding error using IE
318 * Fixed: Importing from trac : some wiki links are messed
327 * Fixed: Importing from trac : some wiki links are messed
319 * Fixed: Incorrect weekend definition in Hebrew calendar locale
328 * Fixed: Incorrect weekend definition in Hebrew calendar locale
320 * Fixed: Atom feeds don't provide author section for repository revisions
329 * Fixed: Atom feeds don't provide author section for repository revisions
321 * Fixed: In Activity views, changesets titles can be multiline while they should not
330 * Fixed: In Activity views, changesets titles can be multiline while they should not
322 * Fixed: Ignore unreadable subversion directories (read disabled using authz)
331 * Fixed: Ignore unreadable subversion directories (read disabled using authz)
323 * Fixed: lib/SVG/Graph/Graph.rb can't externalize stylesheets
332 * Fixed: lib/SVG/Graph/Graph.rb can't externalize stylesheets
324 * Fixed: Close statement handler in Redmine.pm
333 * Fixed: Close statement handler in Redmine.pm
325
334
326
335
327 == 2008-05-04 v0.7.1
336 == 2008-05-04 v0.7.1
328
337
329 * Thai translation added (Gampol Thitinilnithi)
338 * Thai translation added (Gampol Thitinilnithi)
330 * Translations updates
339 * Translations updates
331 * Escape HTML comment tags
340 * Escape HTML comment tags
332 * Prevent "can't convert nil into String" error when :sort_order param is not present
341 * Prevent "can't convert nil into String" error when :sort_order param is not present
333 * Fixed: Updating tickets add a time log with zero hours
342 * Fixed: Updating tickets add a time log with zero hours
334 * Fixed: private subprojects names are revealed on the project overview
343 * Fixed: private subprojects names are revealed on the project overview
335 * Fixed: Search for target version of "none" fails with postgres 8.3
344 * Fixed: Search for target version of "none" fails with postgres 8.3
336 * Fixed: Home, Logout, Login links shouldn't be absolute links
345 * Fixed: Home, Logout, Login links shouldn't be absolute links
337 * Fixed: 'Latest projects' box on the welcome screen should be hidden if there are no projects
346 * Fixed: 'Latest projects' box on the welcome screen should be hidden if there are no projects
338 * Fixed: error when using upcase language name in coderay
347 * Fixed: error when using upcase language name in coderay
339 * Fixed: error on Trac import when :due attribute is nil
348 * Fixed: error on Trac import when :due attribute is nil
340
349
341
350
342 == 2008-04-28 v0.7.0
351 == 2008-04-28 v0.7.0
343
352
344 * Forces Redmine to use rails 2.0.2 gem when vendor/rails is not present
353 * Forces Redmine to use rails 2.0.2 gem when vendor/rails is not present
345 * Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list.
354 * Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list.
346 * Add predefined date ranges to the time report
355 * Add predefined date ranges to the time report
347 * Time report can be done at issue level
356 * Time report can be done at issue level
348 * Various timelog report enhancements
357 * Various timelog report enhancements
349 * Accept the following formats for "hours" field: 1h, 1 h, 1 hour, 2 hours, 30m, 30min, 1h30, 1h30m, 1:30
358 * Accept the following formats for "hours" field: 1h, 1 h, 1 hour, 2 hours, 30m, 30min, 1h30, 1h30m, 1:30
350 * Display the context menu above and/or to the left of the click if needed
359 * Display the context menu above and/or to the left of the click if needed
351 * Make the admin project files list sortable
360 * Make the admin project files list sortable
352 * Mercurial: display working directory files sizes unless browsing a specific revision
361 * Mercurial: display working directory files sizes unless browsing a specific revision
353 * Preserve status filter and page number when using lock/unlock/activate links on the users list
362 * Preserve status filter and page number when using lock/unlock/activate links on the users list
354 * Redmine.pm support for LDAP authentication
363 * Redmine.pm support for LDAP authentication
355 * Better error message and AR errors in log for failed LDAP on-the-fly user creation
364 * Better error message and AR errors in log for failed LDAP on-the-fly user creation
356 * Redirected user to where he is coming from after logging hours
365 * Redirected user to where he is coming from after logging hours
357 * Warn user that subprojects are also deleted when deleting a project
366 * Warn user that subprojects are also deleted when deleting a project
358 * Include subprojects versions on calendar and gantt
367 * Include subprojects versions on calendar and gantt
359 * Notify project members when a message is posted if they want to receive notifications
368 * Notify project members when a message is posted if they want to receive notifications
360 * Fixed: Feed content limit setting has no effect
369 * Fixed: Feed content limit setting has no effect
361 * Fixed: Priorities not ordered when displayed as a filter in issue list
370 * Fixed: Priorities not ordered when displayed as a filter in issue list
362 * Fixed: can not display attached images inline in message replies
371 * Fixed: can not display attached images inline in message replies
363 * Fixed: Boards are not deleted when project is deleted
372 * Fixed: Boards are not deleted when project is deleted
364 * Fixed: trying to preview a new issue raises an exception with postgresql
373 * Fixed: trying to preview a new issue raises an exception with postgresql
365 * Fixed: single file 'View difference' links do not work because of duplicate slashes in url
374 * Fixed: single file 'View difference' links do not work because of duplicate slashes in url
366 * Fixed: inline image not displayed when including a wiki page
375 * Fixed: inline image not displayed when including a wiki page
367 * Fixed: CVS duplicate key violation
376 * Fixed: CVS duplicate key violation
368 * Fixed: ActiveRecord::StaleObjectError exception on closing a set of circular duplicate issues
377 * Fixed: ActiveRecord::StaleObjectError exception on closing a set of circular duplicate issues
369 * Fixed: custom field filters behaviour
378 * Fixed: custom field filters behaviour
370 * Fixed: Postgresql 8.3 compatibility
379 * Fixed: Postgresql 8.3 compatibility
371 * Fixed: Links to repository directories don't work
380 * Fixed: Links to repository directories don't work
372
381
373
382
374 == 2008-03-29 v0.7.0-rc1
383 == 2008-03-29 v0.7.0-rc1
375
384
376 * Overall activity view and feed added, link is available on the project list
385 * Overall activity view and feed added, link is available on the project list
377 * Git VCS support
386 * Git VCS support
378 * Rails 2.0 sessions cookie store compatibility
387 * Rails 2.0 sessions cookie store compatibility
379 * Use project identifiers in urls instead of ids
388 * Use project identifiers in urls instead of ids
380 * Default configuration data can now be loaded from the administration screen
389 * Default configuration data can now be loaded from the administration screen
381 * Administration settings screen split to tabs (email notifications options moved to 'Settings')
390 * Administration settings screen split to tabs (email notifications options moved to 'Settings')
382 * Project description is now unlimited and optional
391 * Project description is now unlimited and optional
383 * Wiki annotate view
392 * Wiki annotate view
384 * Escape HTML tag in textile content
393 * Escape HTML tag in textile content
385 * Add Redmine links to documents, versions, attachments and repository files
394 * Add Redmine links to documents, versions, attachments and repository files
386 * New setting to specify how many objects should be displayed on paginated lists. There are 2 ways to select a set of issues on the issue list:
395 * New setting to specify how many objects should be displayed on paginated lists. There are 2 ways to select a set of issues on the issue list:
387 * by using checkbox and/or the little pencil that will select/unselect all issues
396 * by using checkbox and/or the little pencil that will select/unselect all issues
388 * by clicking on the rows (but not on the links), Ctrl and Shift keys can be used to select multiple issues
397 * by clicking on the rows (but not on the links), Ctrl and Shift keys can be used to select multiple issues
389 * Context menu disabled on links so that the default context menu of the browser is displayed when right-clicking on a link (click anywhere else on the row to display the context menu)
398 * Context menu disabled on links so that the default context menu of the browser is displayed when right-clicking on a link (click anywhere else on the row to display the context menu)
390 * User display format is now configurable in administration settings
399 * User display format is now configurable in administration settings
391 * Issue list now supports bulk edit/move/delete (for a set of issues that belong to the same project)
400 * Issue list now supports bulk edit/move/delete (for a set of issues that belong to the same project)
392 * Merged 'change status', 'edit issue' and 'add note' actions:
401 * Merged 'change status', 'edit issue' and 'add note' actions:
393 * Users with 'edit issues' permission can now update any property including custom fields when adding a note or changing the status
402 * Users with 'edit issues' permission can now update any property including custom fields when adding a note or changing the status
394 * 'Change issue status' permission removed. To change an issue status, a user just needs to have either 'Edit' or 'Add note' permissions and some workflow transitions allowed
403 * 'Change issue status' permission removed. To change an issue status, a user just needs to have either 'Edit' or 'Add note' permissions and some workflow transitions allowed
395 * Details by assignees on issue summary view
404 * Details by assignees on issue summary view
396 * 'New issue' link in the main menu (accesskey 7). The drop-down lists to add an issue on the project overview and the issue list are removed
405 * 'New issue' link in the main menu (accesskey 7). The drop-down lists to add an issue on the project overview and the issue list are removed
397 * Change status select box default to current status
406 * Change status select box default to current status
398 * Preview for issue notes, news and messages
407 * Preview for issue notes, news and messages
399 * Optional description for attachments
408 * Optional description for attachments
400 * 'Fixed version' label changed to 'Target version'
409 * 'Fixed version' label changed to 'Target version'
401 * Let the user choose when deleting issues with reported hours to:
410 * Let the user choose when deleting issues with reported hours to:
402 * delete the hours
411 * delete the hours
403 * assign the hours to the project
412 * assign the hours to the project
404 * reassign the hours to another issue
413 * reassign the hours to another issue
405 * Date range filter and pagination on time entries detail view
414 * Date range filter and pagination on time entries detail view
406 * Propagate time tracking to the parent project
415 * Propagate time tracking to the parent project
407 * Switch added on the project activity view to include subprojects
416 * Switch added on the project activity view to include subprojects
408 * Display total estimated and spent hours on the version detail view
417 * Display total estimated and spent hours on the version detail view
409 * Weekly time tracking block for 'My page'
418 * Weekly time tracking block for 'My page'
410 * Permissions to edit time entries
419 * Permissions to edit time entries
411 * Include subprojects on the issue list, calendar, gantt and timelog by default (can be turned off is administration settings)
420 * Include subprojects on the issue list, calendar, gantt and timelog by default (can be turned off is administration settings)
412 * Roadmap enhancements (separate related issues from wiki contents, leading h1 in version wiki pages is hidden, smaller wiki headings)
421 * Roadmap enhancements (separate related issues from wiki contents, leading h1 in version wiki pages is hidden, smaller wiki headings)
413 * Make versions with same date sorted by name
422 * Make versions with same date sorted by name
414 * Allow issue list to be sorted by target version
423 * Allow issue list to be sorted by target version
415 * Related changesets messages displayed on the issue details view
424 * Related changesets messages displayed on the issue details view
416 * Create a journal and send an email when an issue is closed by commit
425 * Create a journal and send an email when an issue is closed by commit
417 * Add 'Author' to the available columns for the issue list
426 * Add 'Author' to the available columns for the issue list
418 * More appropriate default sort order on sortable columns
427 * More appropriate default sort order on sortable columns
419 * Add issue subject to the time entries view and issue subject, description and tracker to the csv export
428 * Add issue subject to the time entries view and issue subject, description and tracker to the csv export
420 * Permissions to edit issue notes
429 * Permissions to edit issue notes
421 * Display date/time instead of date on files list
430 * Display date/time instead of date on files list
422 * Do not show Roadmap menu item if the project doesn't define any versions
431 * Do not show Roadmap menu item if the project doesn't define any versions
423 * Allow longer version names (60 chars)
432 * Allow longer version names (60 chars)
424 * Ability to copy an existing workflow when creating a new role
433 * Ability to copy an existing workflow when creating a new role
425 * Display custom fields in two columns on the issue form
434 * Display custom fields in two columns on the issue form
426 * Added 'estimated time' in the csv export of the issue list
435 * Added 'estimated time' in the csv export of the issue list
427 * Display the last 30 days on the activity view rather than the current month (number of days can be configured in the application settings)
436 * Display the last 30 days on the activity view rather than the current month (number of days can be configured in the application settings)
428 * Setting for whether new projects should be public by default
437 * Setting for whether new projects should be public by default
429 * User preference to choose how comments/replies are displayed: in chronological or reverse chronological order
438 * User preference to choose how comments/replies are displayed: in chronological or reverse chronological order
430 * Added default value for custom fields
439 * Added default value for custom fields
431 * Added tabindex property on wiki toolbar buttons (to easily move from field to field using the tab key)
440 * Added tabindex property on wiki toolbar buttons (to easily move from field to field using the tab key)
432 * Redirect to issue page after creating a new issue
441 * Redirect to issue page after creating a new issue
433 * Wiki toolbar improvements (mainly for Firefox)
442 * Wiki toolbar improvements (mainly for Firefox)
434 * Display wiki syntax quick ref link on all wiki textareas
443 * Display wiki syntax quick ref link on all wiki textareas
435 * Display links to Atom feeds
444 * Display links to Atom feeds
436 * Breadcrumb nav for the forums
445 * Breadcrumb nav for the forums
437 * Show replies when choosing to display messages in the activity
446 * Show replies when choosing to display messages in the activity
438 * Added 'include' macro to include another wiki page
447 * Added 'include' macro to include another wiki page
439 * RedmineWikiFormatting page available as a static HTML file locally
448 * RedmineWikiFormatting page available as a static HTML file locally
440 * Wrap diff content
449 * Wrap diff content
441 * Strip out email address from authors in repository screens
450 * Strip out email address from authors in repository screens
442 * Highlight the current item of the main menu
451 * Highlight the current item of the main menu
443 * Added simple syntax highlighters for php and java languages
452 * Added simple syntax highlighters for php and java languages
444 * Do not show empty diffs
453 * Do not show empty diffs
445 * Show explicit error message when the scm command failed (eg. when svn binary is not available)
454 * Show explicit error message when the scm command failed (eg. when svn binary is not available)
446 * Lithuanian translation added (Sergej Jegorov)
455 * Lithuanian translation added (Sergej Jegorov)
447 * Ukrainan translation added (Natalia Konovka & Mykhaylo Sorochan)
456 * Ukrainan translation added (Natalia Konovka & Mykhaylo Sorochan)
448 * Danish translation added (Mads Vestergaard)
457 * Danish translation added (Mads Vestergaard)
449 * Added i18n support to the jstoolbar and various settings screen
458 * Added i18n support to the jstoolbar and various settings screen
450 * RedCloth's glyphs no longer user
459 * RedCloth's glyphs no longer user
451 * New icons for the wiki toolbar (from http://www.famfamfam.com/lab/icons/silk/)
460 * New icons for the wiki toolbar (from http://www.famfamfam.com/lab/icons/silk/)
452 * The following menus can now be extended by plugins: top_menu, account_menu, application_menu
461 * The following menus can now be extended by plugins: top_menu, account_menu, application_menu
453 * Added a simple rake task to fetch changesets from the repositories: rake redmine:fetch_changesets
462 * Added a simple rake task to fetch changesets from the repositories: rake redmine:fetch_changesets
454 * Remove hardcoded "Redmine" strings in account related emails and use application title instead
463 * Remove hardcoded "Redmine" strings in account related emails and use application title instead
455 * Mantis importer preserve bug ids
464 * Mantis importer preserve bug ids
456 * Trac importer: Trac guide wiki pages skipped
465 * Trac importer: Trac guide wiki pages skipped
457 * Trac importer: wiki attachments migration added
466 * Trac importer: wiki attachments migration added
458 * Trac importer: support database schema for Trac migration
467 * Trac importer: support database schema for Trac migration
459 * Trac importer: support CamelCase links
468 * Trac importer: support CamelCase links
460 * Removes the Redmine version from the footer (can be viewed on admin -> info)
469 * Removes the Redmine version from the footer (can be viewed on admin -> info)
461 * Rescue and display an error message when trying to delete a role that is in use
470 * Rescue and display an error message when trying to delete a role that is in use
462 * Add various 'X-Redmine' headers to email notifications: X-Redmine-Host, X-Redmine-Site, X-Redmine-Project, X-Redmine-Issue-Id, -Author, -Assignee, X-Redmine-Topic-Id
471 * Add various 'X-Redmine' headers to email notifications: X-Redmine-Host, X-Redmine-Site, X-Redmine-Project, X-Redmine-Issue-Id, -Author, -Assignee, X-Redmine-Topic-Id
463 * Add "--encoding utf8" option to the Mercurial "hg log" command in order to get utf8 encoded commit logs
472 * Add "--encoding utf8" option to the Mercurial "hg log" command in order to get utf8 encoded commit logs
464 * Fixed: Gantt and calendar not properly refreshed (fragment caching removed)
473 * Fixed: Gantt and calendar not properly refreshed (fragment caching removed)
465 * Fixed: Textile image with style attribute cause internal server error
474 * Fixed: Textile image with style attribute cause internal server error
466 * Fixed: wiki TOC not rendered properly when used in an issue or document description
475 * Fixed: wiki TOC not rendered properly when used in an issue or document description
467 * Fixed: 'has already been taken' error message on username and email fields if left empty
476 * Fixed: 'has already been taken' error message on username and email fields if left empty
468 * Fixed: non-ascii attachement filename with IE
477 * Fixed: non-ascii attachement filename with IE
469 * Fixed: wrong url for wiki syntax pop-up when Redmine urls are prefixed
478 * Fixed: wrong url for wiki syntax pop-up when Redmine urls are prefixed
470 * Fixed: search for all words doesn't work
479 * Fixed: search for all words doesn't work
471 * Fixed: Do not show sticky and locked checkboxes when replying to a message
480 * Fixed: Do not show sticky and locked checkboxes when replying to a message
472 * Fixed: Mantis importer: do not duplicate Mantis username in firstname and lastname if realname is blank
481 * Fixed: Mantis importer: do not duplicate Mantis username in firstname and lastname if realname is blank
473 * Fixed: Date custom fields not displayed as specified in application settings
482 * Fixed: Date custom fields not displayed as specified in application settings
474 * Fixed: titles not escaped in the activity view
483 * Fixed: titles not escaped in the activity view
475 * Fixed: issue queries can not use custom fields marked as 'for all projects' in a project context
484 * Fixed: issue queries can not use custom fields marked as 'for all projects' in a project context
476 * Fixed: on calendar, gantt and in the tracker filter on the issue list, only active trackers of the project (and its sub projects) should be available
485 * Fixed: on calendar, gantt and in the tracker filter on the issue list, only active trackers of the project (and its sub projects) should be available
477 * Fixed: locked users should not receive email notifications
486 * Fixed: locked users should not receive email notifications
478 * Fixed: custom field selection is not saved when unchecking them all on project settings
487 * Fixed: custom field selection is not saved when unchecking them all on project settings
479 * Fixed: can not lock a topic when creating it
488 * Fixed: can not lock a topic when creating it
480 * Fixed: Incorrect filtering for unset values when using 'is not' filter
489 * Fixed: Incorrect filtering for unset values when using 'is not' filter
481 * Fixed: PostgreSQL issues_seq_id not updated when using Trac importer
490 * Fixed: PostgreSQL issues_seq_id not updated when using Trac importer
482 * Fixed: ajax pagination does not scroll up
491 * Fixed: ajax pagination does not scroll up
483 * Fixed: error when uploading a file with no content-type specified by the browser
492 * Fixed: error when uploading a file with no content-type specified by the browser
484 * Fixed: wiki and changeset links not displayed when previewing issue description or notes
493 * Fixed: wiki and changeset links not displayed when previewing issue description or notes
485 * Fixed: 'LdapError: no bind result' error when authenticating
494 * Fixed: 'LdapError: no bind result' error when authenticating
486 * Fixed: 'LdapError: invalid binding information' when no username/password are set on the LDAP account
495 * Fixed: 'LdapError: invalid binding information' when no username/password are set on the LDAP account
487 * Fixed: CVS repository doesn't work if port is used in the url
496 * Fixed: CVS repository doesn't work if port is used in the url
488 * Fixed: Email notifications: host name is missing in generated links
497 * Fixed: Email notifications: host name is missing in generated links
489 * Fixed: Email notifications: referenced changesets, wiki pages, attachments... are not turned into links
498 * Fixed: Email notifications: referenced changesets, wiki pages, attachments... are not turned into links
490 * Fixed: Do not clear issue relations when moving an issue to another project if cross-project issue relations are allowed
499 * Fixed: Do not clear issue relations when moving an issue to another project if cross-project issue relations are allowed
491 * Fixed: "undefined method 'textilizable'" error on email notification when running Repository#fetch_changesets from the console
500 * Fixed: "undefined method 'textilizable'" error on email notification when running Repository#fetch_changesets from the console
492 * Fixed: Do not send an email with no recipient, cc or bcc
501 * Fixed: Do not send an email with no recipient, cc or bcc
493 * Fixed: fetch_changesets fails on commit comments that close 2 duplicates issues.
502 * Fixed: fetch_changesets fails on commit comments that close 2 duplicates issues.
494 * Fixed: Mercurial browsing under unix-like os and for directory depth > 2
503 * Fixed: Mercurial browsing under unix-like os and for directory depth > 2
495 * Fixed: Wiki links with pipe can not be used in wiki tables
504 * Fixed: Wiki links with pipe can not be used in wiki tables
496 * Fixed: migrate_from_trac doesn't import timestamps of wiki and tickets
505 * Fixed: migrate_from_trac doesn't import timestamps of wiki and tickets
497 * Fixed: when bulk editing, setting "Assigned to" to "nobody" causes an sql error with Postgresql
506 * Fixed: when bulk editing, setting "Assigned to" to "nobody" causes an sql error with Postgresql
498
507
499
508
500 == 2008-03-12 v0.6.4
509 == 2008-03-12 v0.6.4
501
510
502 * Fixed: private projects name are displayed on account/show even if the current user doesn't have access to these private projects
511 * Fixed: private projects name are displayed on account/show even if the current user doesn't have access to these private projects
503 * Fixed: potential LDAP authentication security flaw
512 * Fixed: potential LDAP authentication security flaw
504 * Fixed: context submenus on the issue list don't show up with IE6.
513 * Fixed: context submenus on the issue list don't show up with IE6.
505 * Fixed: Themes are not applied with Rails 2.0
514 * Fixed: Themes are not applied with Rails 2.0
506 * Fixed: crash when fetching Mercurial changesets if changeset[:files] is nil
515 * Fixed: crash when fetching Mercurial changesets if changeset[:files] is nil
507 * Fixed: Mercurial repository browsing
516 * Fixed: Mercurial repository browsing
508 * Fixed: undefined local variable or method 'log' in CvsAdapter when a cvs command fails
517 * Fixed: undefined local variable or method 'log' in CvsAdapter when a cvs command fails
509 * Fixed: not null constraints not removed with Postgresql
518 * Fixed: not null constraints not removed with Postgresql
510 * Doctype set to transitional
519 * Doctype set to transitional
511
520
512
521
513 == 2007-12-18 v0.6.3
522 == 2007-12-18 v0.6.3
514
523
515 * Fixed: upload doesn't work in 'Files' section
524 * Fixed: upload doesn't work in 'Files' section
516
525
517
526
518 == 2007-12-16 v0.6.2
527 == 2007-12-16 v0.6.2
519
528
520 * Search engine: issue custom fields can now be searched
529 * Search engine: issue custom fields can now be searched
521 * News comments are now textilized
530 * News comments are now textilized
522 * Updated Japanese translation (Satoru Kurashiki)
531 * Updated Japanese translation (Satoru Kurashiki)
523 * Updated Chinese translation (Shortie Lo)
532 * Updated Chinese translation (Shortie Lo)
524 * Fixed Rails 2.0 compatibility bugs:
533 * Fixed Rails 2.0 compatibility bugs:
525 * Unable to create a wiki
534 * Unable to create a wiki
526 * Gantt and calendar error
535 * Gantt and calendar error
527 * Trac importer error (readonly? is defined by ActiveRecord)
536 * Trac importer error (readonly? is defined by ActiveRecord)
528 * Fixed: 'assigned to me' filter broken
537 * Fixed: 'assigned to me' filter broken
529 * Fixed: crash when validation fails on issue edition with no custom fields
538 * Fixed: crash when validation fails on issue edition with no custom fields
530 * Fixed: reposman "can't find group" error
539 * Fixed: reposman "can't find group" error
531 * Fixed: 'LDAP account password is too long' error when leaving the field empty on creation
540 * Fixed: 'LDAP account password is too long' error when leaving the field empty on creation
532 * Fixed: empty lines when displaying repository files with Windows style eol
541 * Fixed: empty lines when displaying repository files with Windows style eol
533 * Fixed: missing body closing tag in repository annotate and entry views
542 * Fixed: missing body closing tag in repository annotate and entry views
534
543
535
544
536 == 2007-12-10 v0.6.1
545 == 2007-12-10 v0.6.1
537
546
538 * Rails 2.0 compatibility
547 * Rails 2.0 compatibility
539 * Custom fields can now be displayed as columns on the issue list
548 * Custom fields can now be displayed as columns on the issue list
540 * Added version details view (accessible from the roadmap)
549 * Added version details view (accessible from the roadmap)
541 * Roadmap: more accurate completion percentage calculation (done ratio of open issues is now taken into account)
550 * Roadmap: more accurate completion percentage calculation (done ratio of open issues is now taken into account)
542 * Added per-project tracker selection. Trackers can be selected on project settings
551 * Added per-project tracker selection. Trackers can be selected on project settings
543 * Anonymous users can now be allowed to create, edit, comment issues, comment news and post messages in the forums
552 * Anonymous users can now be allowed to create, edit, comment issues, comment news and post messages in the forums
544 * Forums: messages can now be edited/deleted (explicit permissions need to be given)
553 * Forums: messages can now be edited/deleted (explicit permissions need to be given)
545 * Forums: topics can be locked so that no reply can be added
554 * Forums: topics can be locked so that no reply can be added
546 * Forums: topics can be marked as sticky so that they always appear at the top of the list
555 * Forums: topics can be marked as sticky so that they always appear at the top of the list
547 * Forums: attachments can now be added to replies
556 * Forums: attachments can now be added to replies
548 * Added time zone support
557 * Added time zone support
549 * Added a setting to choose the account activation strategy (available in application settings)
558 * Added a setting to choose the account activation strategy (available in application settings)
550 * Added 'Classic' theme (inspired from the v0.51 design)
559 * Added 'Classic' theme (inspired from the v0.51 design)
551 * Added an alternate theme which provides issue list colorization based on issues priority
560 * Added an alternate theme which provides issue list colorization based on issues priority
552 * Added Bazaar SCM adapter
561 * Added Bazaar SCM adapter
553 * Added Annotate/Blame view in the repository browser (except for Darcs SCM)
562 * Added Annotate/Blame view in the repository browser (except for Darcs SCM)
554 * Diff style (inline or side by side) automatically saved as a user preference
563 * Diff style (inline or side by side) automatically saved as a user preference
555 * Added issues status changes on the activity view (by Cyril Mougel)
564 * Added issues status changes on the activity view (by Cyril Mougel)
556 * Added forums topics on the activity view (disabled by default)
565 * Added forums topics on the activity view (disabled by default)
557 * Added an option on 'My account' for users who don't want to be notified of changes that they make
566 * Added an option on 'My account' for users who don't want to be notified of changes that they make
558 * Trac importer now supports mysql and postgresql databases
567 * Trac importer now supports mysql and postgresql databases
559 * Trac importer improvements (by Mat Trudel)
568 * Trac importer improvements (by Mat Trudel)
560 * 'fixed version' field can now be displayed on the issue list
569 * 'fixed version' field can now be displayed on the issue list
561 * Added a couple of new formats for the 'date format' setting
570 * Added a couple of new formats for the 'date format' setting
562 * Added Traditional Chinese translation (by Shortie Lo)
571 * Added Traditional Chinese translation (by Shortie Lo)
563 * Added Russian translation (iGor kMeta)
572 * Added Russian translation (iGor kMeta)
564 * Project name format limitation removed (name can now contain any character)
573 * Project name format limitation removed (name can now contain any character)
565 * Project identifier maximum length changed from 12 to 20
574 * Project identifier maximum length changed from 12 to 20
566 * Changed the maximum length of LDAP account to 255 characters
575 * Changed the maximum length of LDAP account to 255 characters
567 * Removed the 12 characters limit on passwords
576 * Removed the 12 characters limit on passwords
568 * Added wiki macros support
577 * Added wiki macros support
569 * Performance improvement on workflow setup screen
578 * Performance improvement on workflow setup screen
570 * More detailed html title on several views
579 * More detailed html title on several views
571 * Custom fields can now be reordered
580 * Custom fields can now be reordered
572 * Search engine: search can be restricted to an exact phrase by using quotation marks
581 * Search engine: search can be restricted to an exact phrase by using quotation marks
573 * Added custom fields marked as 'For all projects' to the csv export of the cross project issue list
582 * Added custom fields marked as 'For all projects' to the csv export of the cross project issue list
574 * Email notifications are now sent as Blind carbon copy by default
583 * Email notifications are now sent as Blind carbon copy by default
575 * Fixed: all members (including non active) should be deleted when deleting a project
584 * Fixed: all members (including non active) should be deleted when deleting a project
576 * Fixed: Error on wiki syntax link (accessible from wiki/edit)
585 * Fixed: Error on wiki syntax link (accessible from wiki/edit)
577 * Fixed: 'quick jump to a revision' form on the revisions list
586 * Fixed: 'quick jump to a revision' form on the revisions list
578 * Fixed: error on admin/info if there's more than 1 plugin installed
587 * Fixed: error on admin/info if there's more than 1 plugin installed
579 * Fixed: svn or ldap password can be found in clear text in the html source in editing mode
588 * Fixed: svn or ldap password can be found in clear text in the html source in editing mode
580 * Fixed: 'Assigned to' drop down list is not sorted
589 * Fixed: 'Assigned to' drop down list is not sorted
581 * Fixed: 'View all issues' link doesn't work on issues/show
590 * Fixed: 'View all issues' link doesn't work on issues/show
582 * Fixed: error on account/register when validation fails
591 * Fixed: error on account/register when validation fails
583 * Fixed: Error when displaying the issue list if a float custom field is marked as 'used as filter'
592 * Fixed: Error when displaying the issue list if a float custom field is marked as 'used as filter'
584 * Fixed: Mercurial adapter breaks on missing :files entry in changeset hash (James Britt)
593 * Fixed: Mercurial adapter breaks on missing :files entry in changeset hash (James Britt)
585 * Fixed: Wrong feed URLs on the home page
594 * Fixed: Wrong feed URLs on the home page
586 * Fixed: Update of time entry fails when the issue has been moved to an other project
595 * Fixed: Update of time entry fails when the issue has been moved to an other project
587 * Fixed: Error when moving an issue without changing its tracker (Postgresql)
596 * Fixed: Error when moving an issue without changing its tracker (Postgresql)
588 * Fixed: Changes not recorded when using :pserver string (CVS adapter)
597 * Fixed: Changes not recorded when using :pserver string (CVS adapter)
589 * Fixed: admin should be able to move issues to any project
598 * Fixed: admin should be able to move issues to any project
590 * Fixed: adding an attachment is not possible when changing the status of an issue
599 * Fixed: adding an attachment is not possible when changing the status of an issue
591 * Fixed: No mime-types in documents/files downloading
600 * Fixed: No mime-types in documents/files downloading
592 * Fixed: error when sorting the messages if there's only one board for the project
601 * Fixed: error when sorting the messages if there's only one board for the project
593 * Fixed: 'me' doesn't appear in the drop down filters on a project issue list.
602 * Fixed: 'me' doesn't appear in the drop down filters on a project issue list.
594
603
595 == 2007-11-04 v0.6.0
604 == 2007-11-04 v0.6.0
596
605
597 * Permission model refactoring.
606 * Permission model refactoring.
598 * Permissions: there are now 2 builtin roles that can be used to specify permissions given to other users than members of projects
607 * Permissions: there are now 2 builtin roles that can be used to specify permissions given to other users than members of projects
599 * Permissions: some permissions (eg. browse the repository) can be removed for certain roles
608 * Permissions: some permissions (eg. browse the repository) can be removed for certain roles
600 * Permissions: modules (eg. issue tracking, news, documents...) can be enabled/disabled at project level
609 * Permissions: modules (eg. issue tracking, news, documents...) can be enabled/disabled at project level
601 * Added Mantis and Trac importers
610 * Added Mantis and Trac importers
602 * New application layout
611 * New application layout
603 * Added "Bulk edit" functionality on the issue list
612 * Added "Bulk edit" functionality on the issue list
604 * More flexible mail notifications settings at user level
613 * More flexible mail notifications settings at user level
605 * Added AJAX based context menu on the project issue list that provide shortcuts for editing, re-assigning, changing the status or the priority, moving or deleting an issue
614 * Added AJAX based context menu on the project issue list that provide shortcuts for editing, re-assigning, changing the status or the priority, moving or deleting an issue
606 * Added the hability to copy an issue. It can be done from the "issue/show" view or from the context menu on the issue list
615 * Added the hability to copy an issue. It can be done from the "issue/show" view or from the context menu on the issue list
607 * Added the ability to customize issue list columns (at application level or for each saved query)
616 * Added the ability to customize issue list columns (at application level or for each saved query)
608 * Overdue versions (date reached and open issues > 0) are now always displayed on the roadmap
617 * Overdue versions (date reached and open issues > 0) are now always displayed on the roadmap
609 * Added the ability to rename wiki pages (specific permission required)
618 * Added the ability to rename wiki pages (specific permission required)
610 * Search engines now supports pagination. Results are sorted in reverse chronological order
619 * Search engines now supports pagination. Results are sorted in reverse chronological order
611 * Added "Estimated hours" attribute on issues
620 * Added "Estimated hours" attribute on issues
612 * A category with assigned issue can now be deleted. 2 options are proposed: remove assignments or reassign issues to another category
621 * A category with assigned issue can now be deleted. 2 options are proposed: remove assignments or reassign issues to another category
613 * Forum notifications are now also sent to the authors of the thread, even if they donοΏ½t watch the board
622 * Forum notifications are now also sent to the authors of the thread, even if they donοΏ½t watch the board
614 * Added an application setting to specify the application protocol (http or https) used to generate urls in emails
623 * Added an application setting to specify the application protocol (http or https) used to generate urls in emails
615 * Gantt chart: now starts at the current month by default
624 * Gantt chart: now starts at the current month by default
616 * Gantt chart: month count and zoom factor are automatically saved as user preferences
625 * Gantt chart: month count and zoom factor are automatically saved as user preferences
617 * Wiki links can now refer to other project wikis
626 * Wiki links can now refer to other project wikis
618 * Added wiki index by date
627 * Added wiki index by date
619 * Added preview on add/edit issue form
628 * Added preview on add/edit issue form
620 * Emails footer can now be customized from the admin interface (Admin -> Email notifications)
629 * Emails footer can now be customized from the admin interface (Admin -> Email notifications)
621 * Default encodings for repository files can now be set in application settings (used to convert files content and diff to UTF-8 so that theyοΏ½re properly displayed)
630 * Default encodings for repository files can now be set in application settings (used to convert files content and diff to UTF-8 so that theyοΏ½re properly displayed)
622 * Calendar: first day of week can now be set in lang files
631 * Calendar: first day of week can now be set in lang files
623 * Automatic closing of duplicate issues
632 * Automatic closing of duplicate issues
624 * Added a cross-project issue list
633 * Added a cross-project issue list
625 * AJAXified the SCM browser (tree view)
634 * AJAXified the SCM browser (tree view)
626 * Pretty URL for the repository browser (Cyril Mougel)
635 * Pretty URL for the repository browser (Cyril Mougel)
627 * Search engine: added a checkbox to search titles only
636 * Search engine: added a checkbox to search titles only
628 * Added "% done" in the filter list
637 * Added "% done" in the filter list
629 * Enumerations: values can now be reordered and a default value can be specified (eg. default issue priority)
638 * Enumerations: values can now be reordered and a default value can be specified (eg. default issue priority)
630 * Added some accesskeys
639 * Added some accesskeys
631 * Added "Float" as a custom field format
640 * Added "Float" as a custom field format
632 * Added basic Theme support
641 * Added basic Theme support
633 * Added the ability to set the οΏ½done ratioοΏ½ of issues fixed by commit (Nikolay Solakov)
642 * Added the ability to set the οΏ½done ratioοΏ½ of issues fixed by commit (Nikolay Solakov)
634 * Added custom fields in issue related mail notifications
643 * Added custom fields in issue related mail notifications
635 * Email notifications are now sent in plain text and html
644 * Email notifications are now sent in plain text and html
636 * Gantt chart can now be exported to a graphic file (png). This functionality is only available if RMagick is installed.
645 * Gantt chart can now be exported to a graphic file (png). This functionality is only available if RMagick is installed.
637 * Added syntax highlightment for repository files and wiki
646 * Added syntax highlightment for repository files and wiki
638 * Improved automatic Redmine links
647 * Improved automatic Redmine links
639 * Added automatic table of content support on wiki pages
648 * Added automatic table of content support on wiki pages
640 * Added radio buttons on the documents list to sort documents by category, date, title or author
649 * Added radio buttons on the documents list to sort documents by category, date, title or author
641 * Added basic plugin support, with a sample plugin
650 * Added basic plugin support, with a sample plugin
642 * Added a link to add a new category when creating or editing an issue
651 * Added a link to add a new category when creating or editing an issue
643 * Added a "Assignable" boolean on the Role model. If unchecked, issues can not be assigned to users having this role.
652 * Added a "Assignable" boolean on the Role model. If unchecked, issues can not be assigned to users having this role.
644 * Added an option to be able to relate issues in different projects
653 * Added an option to be able to relate issues in different projects
645 * Added the ability to move issues (to another project) without changing their trackers.
654 * Added the ability to move issues (to another project) without changing their trackers.
646 * Atom feeds added on project activity, news and changesets
655 * Atom feeds added on project activity, news and changesets
647 * Added the ability to reset its own RSS access key
656 * Added the ability to reset its own RSS access key
648 * Main project list now displays root projects with their subprojects
657 * Main project list now displays root projects with their subprojects
649 * Added anchor links to issue notes
658 * Added anchor links to issue notes
650 * Added reposman Ruby version. This script can now register created repositories in Redmine (Nicolas Chuche)
659 * Added reposman Ruby version. This script can now register created repositories in Redmine (Nicolas Chuche)
651 * Issue notes are now included in search
660 * Issue notes are now included in search
652 * Added email sending test functionality
661 * Added email sending test functionality
653 * Added LDAPS support for LDAP authentication
662 * Added LDAPS support for LDAP authentication
654 * Removed hard-coded URLs in mail templates
663 * Removed hard-coded URLs in mail templates
655 * Subprojects are now grouped by projects in the navigation drop-down menu
664 * Subprojects are now grouped by projects in the navigation drop-down menu
656 * Added a new value for date filters: this week
665 * Added a new value for date filters: this week
657 * Added cache for application settings
666 * Added cache for application settings
658 * Added Polish translation (Tomasz Gawryl)
667 * Added Polish translation (Tomasz Gawryl)
659 * Added Czech translation (Jan Kadlecek)
668 * Added Czech translation (Jan Kadlecek)
660 * Added Romanian translation (Csongor Bartus)
669 * Added Romanian translation (Csongor Bartus)
661 * Added Hebrew translation (Bob Builder)
670 * Added Hebrew translation (Bob Builder)
662 * Added Serbian translation (Dragan Matic)
671 * Added Serbian translation (Dragan Matic)
663 * Added Korean translation (Choi Jong Yoon)
672 * Added Korean translation (Choi Jong Yoon)
664 * Fixed: the link to delete issue relations is displayed even if the user is not authorized to delete relations
673 * Fixed: the link to delete issue relations is displayed even if the user is not authorized to delete relations
665 * Performance improvement on calendar and gantt
674 * Performance improvement on calendar and gantt
666 * Fixed: wiki preview doesnοΏ½t work on long entries
675 * Fixed: wiki preview doesnοΏ½t work on long entries
667 * Fixed: queries with multiple custom fields return no result
676 * Fixed: queries with multiple custom fields return no result
668 * Fixed: Can not authenticate user against LDAP if its DN contains non-ascii characters
677 * Fixed: Can not authenticate user against LDAP if its DN contains non-ascii characters
669 * Fixed: URL with ~ broken in wiki formatting
678 * Fixed: URL with ~ broken in wiki formatting
670 * Fixed: some quotation marks are rendered as strange characters in pdf
679 * Fixed: some quotation marks are rendered as strange characters in pdf
671
680
672
681
673 == 2007-07-15 v0.5.1
682 == 2007-07-15 v0.5.1
674
683
675 * per project forums added
684 * per project forums added
676 * added the ability to archive projects
685 * added the ability to archive projects
677 * added οΏ½WatchοΏ½ functionality on issues. It allows users to receive notifications about issue changes
686 * added οΏ½WatchοΏ½ functionality on issues. It allows users to receive notifications about issue changes
678 * custom fields for issues can now be used as filters on issue list
687 * custom fields for issues can now be used as filters on issue list
679 * added per user custom queries
688 * added per user custom queries
680 * commit messages are now scanned for referenced or fixed issue IDs (keywords defined in Admin -> Settings)
689 * commit messages are now scanned for referenced or fixed issue IDs (keywords defined in Admin -> Settings)
681 * projects list now shows the list of public projects and private projects for which the user is a member
690 * projects list now shows the list of public projects and private projects for which the user is a member
682 * versions can now be created with no date
691 * versions can now be created with no date
683 * added issue count details for versions on Reports view
692 * added issue count details for versions on Reports view
684 * added time report, by member/activity/tracker/version and year/month/week for the selected period
693 * added time report, by member/activity/tracker/version and year/month/week for the selected period
685 * each category can now be associated to a user, so that new issues in that category are automatically assigned to that user
694 * each category can now be associated to a user, so that new issues in that category are automatically assigned to that user
686 * added autologin feature (disabled by default)
695 * added autologin feature (disabled by default)
687 * optimistic locking added for wiki edits
696 * optimistic locking added for wiki edits
688 * added wiki diff
697 * added wiki diff
689 * added the ability to destroy wiki pages (requires permission)
698 * added the ability to destroy wiki pages (requires permission)
690 * a wiki page can now be attached to each version, and displayed on the roadmap
699 * a wiki page can now be attached to each version, and displayed on the roadmap
691 * attachments can now be added to wiki pages (original patch by Pavol Murin) and displayed online
700 * attachments can now be added to wiki pages (original patch by Pavol Murin) and displayed online
692 * added an option to see all versions in the roadmap view (including completed ones)
701 * added an option to see all versions in the roadmap view (including completed ones)
693 * added basic issue relations
702 * added basic issue relations
694 * added the ability to log time when changing an issue status
703 * added the ability to log time when changing an issue status
695 * account information can now be sent to the user when creating an account
704 * account information can now be sent to the user when creating an account
696 * author and assignee of an issue always receive notifications (even if they turned of mail notifications)
705 * author and assignee of an issue always receive notifications (even if they turned of mail notifications)
697 * added a quick search form in page header
706 * added a quick search form in page header
698 * added 'me' value for 'assigned to' and 'author' query filters
707 * added 'me' value for 'assigned to' and 'author' query filters
699 * added a link on revision screen to see the entire diff for the revision
708 * added a link on revision screen to see the entire diff for the revision
700 * added last commit message for each entry in repository browser
709 * added last commit message for each entry in repository browser
701 * added the ability to view a file diff with free to/from revision selection.
710 * added the ability to view a file diff with free to/from revision selection.
702 * text files can now be viewed online when browsing the repository
711 * text files can now be viewed online when browsing the repository
703 * added basic support for other SCM: CVS (Ralph Vater), Mercurial and Darcs
712 * added basic support for other SCM: CVS (Ralph Vater), Mercurial and Darcs
704 * added fragment caching for svn diffs
713 * added fragment caching for svn diffs
705 * added fragment caching for calendar and gantt views
714 * added fragment caching for calendar and gantt views
706 * login field automatically focused on login form
715 * login field automatically focused on login form
707 * subproject name displayed on issue list, calendar and gantt
716 * subproject name displayed on issue list, calendar and gantt
708 * added an option to choose the date format: language based or ISO 8601
717 * added an option to choose the date format: language based or ISO 8601
709 * added a simple mail handler. It lets users add notes to an existing issue by replying to the initial notification email.
718 * added a simple mail handler. It lets users add notes to an existing issue by replying to the initial notification email.
710 * a 403 error page is now displayed (instead of a blank page) when trying to access a protected page
719 * a 403 error page is now displayed (instead of a blank page) when trying to access a protected page
711 * added portuguese translation (Joao Carlos Clementoni)
720 * added portuguese translation (Joao Carlos Clementoni)
712 * added partial online help japanese translation (Ken Date)
721 * added partial online help japanese translation (Ken Date)
713 * added bulgarian translation (Nikolay Solakov)
722 * added bulgarian translation (Nikolay Solakov)
714 * added dutch translation (Linda van den Brink)
723 * added dutch translation (Linda van den Brink)
715 * added swedish translation (Thomas Habets)
724 * added swedish translation (Thomas Habets)
716 * italian translation update (Alessio Spadaro)
725 * italian translation update (Alessio Spadaro)
717 * japanese translation update (Satoru Kurashiki)
726 * japanese translation update (Satoru Kurashiki)
718 * fixed: error on history atom feed when thereοΏ½s no notes on an issue change
727 * fixed: error on history atom feed when thereοΏ½s no notes on an issue change
719 * fixed: error in journalizing an issue with longtext custom fields (Postgresql)
728 * fixed: error in journalizing an issue with longtext custom fields (Postgresql)
720 * fixed: creation of Oracle schema
729 * fixed: creation of Oracle schema
721 * fixed: last day of the month not included in project activity
730 * fixed: last day of the month not included in project activity
722 * fixed: files with an apostrophe in their names can't be accessed in SVN repository
731 * fixed: files with an apostrophe in their names can't be accessed in SVN repository
723 * fixed: performance issue on RepositoriesController#revisions when a changeset has a great number of changes (eg. 100,000)
732 * fixed: performance issue on RepositoriesController#revisions when a changeset has a great number of changes (eg. 100,000)
724 * fixed: open/closed issue counts are always 0 on reports view (postgresql)
733 * fixed: open/closed issue counts are always 0 on reports view (postgresql)
725 * fixed: date query filters (wrong results and sql error with postgresql)
734 * fixed: date query filters (wrong results and sql error with postgresql)
726 * fixed: confidentiality issue on account/show (private project names displayed to anyone)
735 * fixed: confidentiality issue on account/show (private project names displayed to anyone)
727 * fixed: Long text custom fields displayed without line breaks
736 * fixed: Long text custom fields displayed without line breaks
728 * fixed: Error when editing the wokflow after deleting a status
737 * fixed: Error when editing the wokflow after deleting a status
729 * fixed: SVN commit dates are now stored as local time
738 * fixed: SVN commit dates are now stored as local time
730
739
731
740
732 == 2007-04-11 v0.5.0
741 == 2007-04-11 v0.5.0
733
742
734 * added per project Wiki
743 * added per project Wiki
735 * added rss/atom feeds at project level (custom queries can be used as feeds)
744 * added rss/atom feeds at project level (custom queries can be used as feeds)
736 * added search engine (search in issues, news, commits, wiki pages, documents)
745 * added search engine (search in issues, news, commits, wiki pages, documents)
737 * simple time tracking functionality added
746 * simple time tracking functionality added
738 * added version due dates on calendar and gantt
747 * added version due dates on calendar and gantt
739 * added subprojects issue count on project Reports page
748 * added subprojects issue count on project Reports page
740 * added the ability to copy an existing workflow when creating a new tracker
749 * added the ability to copy an existing workflow when creating a new tracker
741 * added the ability to include subprojects on calendar and gantt
750 * added the ability to include subprojects on calendar and gantt
742 * added the ability to select trackers to display on calendar and gantt (Jeffrey Jones)
751 * added the ability to select trackers to display on calendar and gantt (Jeffrey Jones)
743 * added side by side svn diff view (Cyril Mougel)
752 * added side by side svn diff view (Cyril Mougel)
744 * added back subproject filter on issue list
753 * added back subproject filter on issue list
745 * added permissions report in admin area
754 * added permissions report in admin area
746 * added a status filter on users list
755 * added a status filter on users list
747 * support for password-protected SVN repositories
756 * support for password-protected SVN repositories
748 * SVN commits are now stored in the database
757 * SVN commits are now stored in the database
749 * added simple svn statistics SVG graphs
758 * added simple svn statistics SVG graphs
750 * progress bars for roadmap versions (Nick Read)
759 * progress bars for roadmap versions (Nick Read)
751 * issue history now shows file uploads and deletions
760 * issue history now shows file uploads and deletions
752 * #id patterns are turned into links to issues in descriptions and commit messages
761 * #id patterns are turned into links to issues in descriptions and commit messages
753 * japanese translation added (Satoru Kurashiki)
762 * japanese translation added (Satoru Kurashiki)
754 * chinese simplified translation added (Andy Wu)
763 * chinese simplified translation added (Andy Wu)
755 * italian translation added (Alessio Spadaro)
764 * italian translation added (Alessio Spadaro)
756 * added scripts to manage SVN repositories creation and user access control using ssh+svn (Nicolas Chuche)
765 * added scripts to manage SVN repositories creation and user access control using ssh+svn (Nicolas Chuche)
757 * better calendar rendering time
766 * better calendar rendering time
758 * fixed migration scripts to work with mysql 5 running in strict mode
767 * fixed migration scripts to work with mysql 5 running in strict mode
759 * fixed: error when clicking "add" with no block selected on my/page_layout
768 * fixed: error when clicking "add" with no block selected on my/page_layout
760 * fixed: hard coded links in navigation bar
769 * fixed: hard coded links in navigation bar
761 * fixed: table_name pre/suffix support
770 * fixed: table_name pre/suffix support
762
771
763
772
764 == 2007-02-18 v0.4.2
773 == 2007-02-18 v0.4.2
765
774
766 * Rails 1.2 is now required
775 * Rails 1.2 is now required
767 * settings are now stored in the database and editable through the application in: Admin -> Settings (config_custom.rb is no longer used)
776 * settings are now stored in the database and editable through the application in: Admin -> Settings (config_custom.rb is no longer used)
768 * added project roadmap view
777 * added project roadmap view
769 * mail notifications added when a document, a file or an attachment is added
778 * mail notifications added when a document, a file or an attachment is added
770 * tooltips added on Gantt chart and calender to view the details of the issues
779 * tooltips added on Gantt chart and calender to view the details of the issues
771 * ability to set the sort order for roles, trackers, issue statuses
780 * ability to set the sort order for roles, trackers, issue statuses
772 * added missing fields to csv export: priority, start date, due date, done ratio
781 * added missing fields to csv export: priority, start date, due date, done ratio
773 * added total number of issues per tracker on project overview
782 * added total number of issues per tracker on project overview
774 * all icons replaced (new icons are based on GPL icon set: "KDE Crystal Diamond 2.5" -by paolino- and "kNeu! Alpha v0.1" -by Pablo Fabregat-)
783 * all icons replaced (new icons are based on GPL icon set: "KDE Crystal Diamond 2.5" -by paolino- and "kNeu! Alpha v0.1" -by Pablo Fabregat-)
775 * added back "fixed version" field on issue screen and in filters
784 * added back "fixed version" field on issue screen and in filters
776 * project settings screen split in 4 tabs
785 * project settings screen split in 4 tabs
777 * custom fields screen split in 3 tabs (one for each kind of custom field)
786 * custom fields screen split in 3 tabs (one for each kind of custom field)
778 * multiple issues pdf export now rendered as a table
787 * multiple issues pdf export now rendered as a table
779 * added a button on users/list to manually activate an account
788 * added a button on users/list to manually activate an account
780 * added a setting option to disable "password lost" functionality
789 * added a setting option to disable "password lost" functionality
781 * added a setting option to set max number of issues in csv/pdf exports
790 * added a setting option to set max number of issues in csv/pdf exports
782 * fixed: subprojects count is always 0 on projects list
791 * fixed: subprojects count is always 0 on projects list
783 * fixed: locked users are proposed when adding a member to a project
792 * fixed: locked users are proposed when adding a member to a project
784 * fixed: setting an issue status as default status leads to an sql error with SQLite
793 * fixed: setting an issue status as default status leads to an sql error with SQLite
785 * fixed: unable to delete an issue status even if it's not used yet
794 * fixed: unable to delete an issue status even if it's not used yet
786 * fixed: filters ignored when exporting a predefined query to csv/pdf
795 * fixed: filters ignored when exporting a predefined query to csv/pdf
787 * fixed: crash when french "issue_edit" email notification is sent
796 * fixed: crash when french "issue_edit" email notification is sent
788 * fixed: hide mail preference not saved (my/account)
797 * fixed: hide mail preference not saved (my/account)
789 * fixed: crash when a new user try to edit its "my page" layout
798 * fixed: crash when a new user try to edit its "my page" layout
790
799
791
800
792 == 2007-01-03 v0.4.1
801 == 2007-01-03 v0.4.1
793
802
794 * fixed: emails have no recipient when one of the project members has notifications disabled
803 * fixed: emails have no recipient when one of the project members has notifications disabled
795
804
796
805
797 == 2007-01-02 v0.4.0
806 == 2007-01-02 v0.4.0
798
807
799 * simple SVN browser added (just needs svn binaries in PATH)
808 * simple SVN browser added (just needs svn binaries in PATH)
800 * comments can now be added on news
809 * comments can now be added on news
801 * "my page" is now customizable
810 * "my page" is now customizable
802 * more powerfull and savable filters for issues lists
811 * more powerfull and savable filters for issues lists
803 * improved issues change history
812 * improved issues change history
804 * new functionality: move an issue to another project or tracker
813 * new functionality: move an issue to another project or tracker
805 * new functionality: add a note to an issue
814 * new functionality: add a note to an issue
806 * new report: project activity
815 * new report: project activity
807 * "start date" and "% done" fields added on issues
816 * "start date" and "% done" fields added on issues
808 * project calendar added
817 * project calendar added
809 * gantt chart added (exportable to pdf)
818 * gantt chart added (exportable to pdf)
810 * single/multiple issues pdf export added
819 * single/multiple issues pdf export added
811 * issues reports improvements
820 * issues reports improvements
812 * multiple file upload for issues, documents and files
821 * multiple file upload for issues, documents and files
813 * option to set maximum size of uploaded files
822 * option to set maximum size of uploaded files
814 * textile formating of issue and news descritions (RedCloth required)
823 * textile formating of issue and news descritions (RedCloth required)
815 * integration of DotClear jstoolbar for textile formatting
824 * integration of DotClear jstoolbar for textile formatting
816 * calendar date picker for date fields (LGPL DHTML Calendar http://sourceforge.net/projects/jscalendar)
825 * calendar date picker for date fields (LGPL DHTML Calendar http://sourceforge.net/projects/jscalendar)
817 * new filter in issues list: Author
826 * new filter in issues list: Author
818 * ajaxified paginators
827 * ajaxified paginators
819 * news rss feed added
828 * news rss feed added
820 * option to set number of results per page on issues list
829 * option to set number of results per page on issues list
821 * localized csv separator (comma/semicolon)
830 * localized csv separator (comma/semicolon)
822 * csv output encoded to ISO-8859-1
831 * csv output encoded to ISO-8859-1
823 * user custom field displayed on account/show
832 * user custom field displayed on account/show
824 * default configuration improved (default roles, trackers, status, permissions and workflows)
833 * default configuration improved (default roles, trackers, status, permissions and workflows)
825 * language for default configuration data can now be chosen when running 'load_default_data' task
834 * language for default configuration data can now be chosen when running 'load_default_data' task
826 * javascript added on custom field form to show/hide fields according to the format of custom field
835 * javascript added on custom field form to show/hide fields according to the format of custom field
827 * fixed: custom fields not in csv exports
836 * fixed: custom fields not in csv exports
828 * fixed: project settings now displayed according to user's permissions
837 * fixed: project settings now displayed according to user's permissions
829 * fixed: application error when no version is selected on projects/add_file
838 * fixed: application error when no version is selected on projects/add_file
830 * fixed: public actions not authorized for members of non public projects
839 * fixed: public actions not authorized for members of non public projects
831 * fixed: non public projects were shown on welcome screen even if current user is not a member
840 * fixed: non public projects were shown on welcome screen even if current user is not a member
832
841
833
842
834 == 2006-10-08 v0.3.0
843 == 2006-10-08 v0.3.0
835
844
836 * user authentication against multiple LDAP (optional)
845 * user authentication against multiple LDAP (optional)
837 * token based "lost password" functionality
846 * token based "lost password" functionality
838 * user self-registration functionality (optional)
847 * user self-registration functionality (optional)
839 * custom fields now available for issues, users and projects
848 * custom fields now available for issues, users and projects
840 * new custom field format "text" (displayed as a textarea field)
849 * new custom field format "text" (displayed as a textarea field)
841 * project & administration drop down menus in navigation bar for quicker access
850 * project & administration drop down menus in navigation bar for quicker access
842 * text formatting is preserved for long text fields (issues, projects and news descriptions)
851 * text formatting is preserved for long text fields (issues, projects and news descriptions)
843 * urls and emails are turned into clickable links in long text fields
852 * urls and emails are turned into clickable links in long text fields
844 * "due date" field added on issues
853 * "due date" field added on issues
845 * tracker selection filter added on change log
854 * tracker selection filter added on change log
846 * Localization plugin replaced with GLoc 1.1.0 (iconv required)
855 * Localization plugin replaced with GLoc 1.1.0 (iconv required)
847 * error messages internationalization
856 * error messages internationalization
848 * german translation added (thanks to Karim Trott)
857 * german translation added (thanks to Karim Trott)
849 * data locking for issues to prevent update conflicts (using ActiveRecord builtin optimistic locking)
858 * data locking for issues to prevent update conflicts (using ActiveRecord builtin optimistic locking)
850 * new filter in issues list: "Fixed version"
859 * new filter in issues list: "Fixed version"
851 * active filters are displayed with colored background on issues list
860 * active filters are displayed with colored background on issues list
852 * custom configuration is now defined in config/config_custom.rb
861 * custom configuration is now defined in config/config_custom.rb
853 * user object no more stored in session (only user_id)
862 * user object no more stored in session (only user_id)
854 * news summary field is no longer required
863 * news summary field is no longer required
855 * tables and forms redesign
864 * tables and forms redesign
856 * Fixed: boolean custom field not working
865 * Fixed: boolean custom field not working
857 * Fixed: error messages for custom fields are not displayed
866 * Fixed: error messages for custom fields are not displayed
858 * Fixed: invalid custom fields should have a red border
867 * Fixed: invalid custom fields should have a red border
859 * Fixed: custom fields values are not validated on issue update
868 * Fixed: custom fields values are not validated on issue update
860 * Fixed: unable to choose an empty value for 'List' custom fields
869 * Fixed: unable to choose an empty value for 'List' custom fields
861 * Fixed: no issue categories sorting
870 * Fixed: no issue categories sorting
862 * Fixed: incorrect versions sorting
871 * Fixed: incorrect versions sorting
863
872
864
873
865 == 2006-07-12 - v0.2.2
874 == 2006-07-12 - v0.2.2
866
875
867 * Fixed: bug in "issues list"
876 * Fixed: bug in "issues list"
868
877
869
878
870 == 2006-07-09 - v0.2.1
879 == 2006-07-09 - v0.2.1
871
880
872 * new databases supported: Oracle, PostgreSQL, SQL Server
881 * new databases supported: Oracle, PostgreSQL, SQL Server
873 * projects/subprojects hierarchy (1 level of subprojects only)
882 * projects/subprojects hierarchy (1 level of subprojects only)
874 * environment information display in admin/info
883 * environment information display in admin/info
875 * more filter options in issues list (rev6)
884 * more filter options in issues list (rev6)
876 * default language based on browser settings (Accept-Language HTTP header)
885 * default language based on browser settings (Accept-Language HTTP header)
877 * issues list exportable to CSV (rev6)
886 * issues list exportable to CSV (rev6)
878 * simple_format and auto_link on long text fields
887 * simple_format and auto_link on long text fields
879 * more data validations
888 * more data validations
880 * Fixed: error when all mail notifications are unchecked in admin/mail_options
889 * Fixed: error when all mail notifications are unchecked in admin/mail_options
881 * Fixed: all project news are displayed on project summary
890 * Fixed: all project news are displayed on project summary
882 * Fixed: Can't change user password in users/edit
891 * Fixed: Can't change user password in users/edit
883 * Fixed: Error on tables creation with PostgreSQL (rev5)
892 * Fixed: Error on tables creation with PostgreSQL (rev5)
884 * Fixed: SQL error in "issue reports" view with PostgreSQL (rev5)
893 * Fixed: SQL error in "issue reports" view with PostgreSQL (rev5)
885
894
886
895
887 == 2006-06-25 - v0.1.0
896 == 2006-06-25 - v0.1.0
888
897
889 * multiple users/multiple projects
898 * multiple users/multiple projects
890 * role based access control
899 * role based access control
891 * issue tracking system
900 * issue tracking system
892 * fully customizable workflow
901 * fully customizable workflow
893 * documents/files repository
902 * documents/files repository
894 * email notifications on issue creation and update
903 * email notifications on issue creation and update
895 * multilanguage support (except for error messages):english, french, spanish
904 * multilanguage support (except for error messages):english, french, spanish
896 * online manual in french (unfinished)
905 * online manual in french (unfinished)
@@ -1,1177 +1,1177
1 # vim:ts=4:sw=4:
1 # vim:ts=4:sw=4:
2 # = RedCloth - Textile and Markdown Hybrid for Ruby
2 # = RedCloth - Textile and Markdown Hybrid for Ruby
3 #
3 #
4 # Homepage:: http://whytheluckystiff.net/ruby/redcloth/
4 # Homepage:: http://whytheluckystiff.net/ruby/redcloth/
5 # Author:: why the lucky stiff (http://whytheluckystiff.net/)
5 # Author:: why the lucky stiff (http://whytheluckystiff.net/)
6 # Copyright:: (cc) 2004 why the lucky stiff (and his puppet organizations.)
6 # Copyright:: (cc) 2004 why the lucky stiff (and his puppet organizations.)
7 # License:: BSD
7 # License:: BSD
8 #
8 #
9 # (see http://hobix.com/textile/ for a Textile Reference.)
9 # (see http://hobix.com/textile/ for a Textile Reference.)
10 #
10 #
11 # Based on (and also inspired by) both:
11 # Based on (and also inspired by) both:
12 #
12 #
13 # PyTextile: http://diveintomark.org/projects/textile/textile.py.txt
13 # PyTextile: http://diveintomark.org/projects/textile/textile.py.txt
14 # Textism for PHP: http://www.textism.com/tools/textile/
14 # Textism for PHP: http://www.textism.com/tools/textile/
15 #
15 #
16 #
16 #
17
17
18 # = RedCloth
18 # = RedCloth
19 #
19 #
20 # RedCloth is a Ruby library for converting Textile and/or Markdown
20 # RedCloth is a Ruby library for converting Textile and/or Markdown
21 # into HTML. You can use either format, intermingled or separately.
21 # into HTML. You can use either format, intermingled or separately.
22 # You can also extend RedCloth to honor your own custom text stylings.
22 # You can also extend RedCloth to honor your own custom text stylings.
23 #
23 #
24 # RedCloth users are encouraged to use Textile if they are generating
24 # RedCloth users are encouraged to use Textile if they are generating
25 # HTML and to use Markdown if others will be viewing the plain text.
25 # HTML and to use Markdown if others will be viewing the plain text.
26 #
26 #
27 # == What is Textile?
27 # == What is Textile?
28 #
28 #
29 # Textile is a simple formatting style for text
29 # Textile is a simple formatting style for text
30 # documents, loosely based on some HTML conventions.
30 # documents, loosely based on some HTML conventions.
31 #
31 #
32 # == Sample Textile Text
32 # == Sample Textile Text
33 #
33 #
34 # h2. This is a title
34 # h2. This is a title
35 #
35 #
36 # h3. This is a subhead
36 # h3. This is a subhead
37 #
37 #
38 # This is a bit of paragraph.
38 # This is a bit of paragraph.
39 #
39 #
40 # bq. This is a blockquote.
40 # bq. This is a blockquote.
41 #
41 #
42 # = Writing Textile
42 # = Writing Textile
43 #
43 #
44 # A Textile document consists of paragraphs. Paragraphs
44 # A Textile document consists of paragraphs. Paragraphs
45 # can be specially formatted by adding a small instruction
45 # can be specially formatted by adding a small instruction
46 # to the beginning of the paragraph.
46 # to the beginning of the paragraph.
47 #
47 #
48 # h[n]. Header of size [n].
48 # h[n]. Header of size [n].
49 # bq. Blockquote.
49 # bq. Blockquote.
50 # # Numeric list.
50 # # Numeric list.
51 # * Bulleted list.
51 # * Bulleted list.
52 #
52 #
53 # == Quick Phrase Modifiers
53 # == Quick Phrase Modifiers
54 #
54 #
55 # Quick phrase modifiers are also included, to allow formatting
55 # Quick phrase modifiers are also included, to allow formatting
56 # of small portions of text within a paragraph.
56 # of small portions of text within a paragraph.
57 #
57 #
58 # \_emphasis\_
58 # \_emphasis\_
59 # \_\_italicized\_\_
59 # \_\_italicized\_\_
60 # \*strong\*
60 # \*strong\*
61 # \*\*bold\*\*
61 # \*\*bold\*\*
62 # ??citation??
62 # ??citation??
63 # -deleted text-
63 # -deleted text-
64 # +inserted text+
64 # +inserted text+
65 # ^superscript^
65 # ^superscript^
66 # ~subscript~
66 # ~subscript~
67 # @code@
67 # @code@
68 # %(classname)span%
68 # %(classname)span%
69 #
69 #
70 # ==notextile== (leave text alone)
70 # ==notextile== (leave text alone)
71 #
71 #
72 # == Links
72 # == Links
73 #
73 #
74 # To make a hypertext link, put the link text in "quotation
74 # To make a hypertext link, put the link text in "quotation
75 # marks" followed immediately by a colon and the URL of the link.
75 # marks" followed immediately by a colon and the URL of the link.
76 #
76 #
77 # Optional: text in (parentheses) following the link text,
77 # Optional: text in (parentheses) following the link text,
78 # but before the closing quotation mark, will become a Title
78 # but before the closing quotation mark, will become a Title
79 # attribute for the link, visible as a tool tip when a cursor is above it.
79 # attribute for the link, visible as a tool tip when a cursor is above it.
80 #
80 #
81 # Example:
81 # Example:
82 #
82 #
83 # "This is a link (This is a title) ":http://www.textism.com
83 # "This is a link (This is a title) ":http://www.textism.com
84 #
84 #
85 # Will become:
85 # Will become:
86 #
86 #
87 # <a href="http://www.textism.com" title="This is a title">This is a link</a>
87 # <a href="http://www.textism.com" title="This is a title">This is a link</a>
88 #
88 #
89 # == Images
89 # == Images
90 #
90 #
91 # To insert an image, put the URL for the image inside exclamation marks.
91 # To insert an image, put the URL for the image inside exclamation marks.
92 #
92 #
93 # Optional: text that immediately follows the URL in (parentheses) will
93 # Optional: text that immediately follows the URL in (parentheses) will
94 # be used as the Alt text for the image. Images on the web should always
94 # be used as the Alt text for the image. Images on the web should always
95 # have descriptive Alt text for the benefit of readers using non-graphical
95 # have descriptive Alt text for the benefit of readers using non-graphical
96 # browsers.
96 # browsers.
97 #
97 #
98 # Optional: place a colon followed by a URL immediately after the
98 # Optional: place a colon followed by a URL immediately after the
99 # closing ! to make the image into a link.
99 # closing ! to make the image into a link.
100 #
100 #
101 # Example:
101 # Example:
102 #
102 #
103 # !http://www.textism.com/common/textist.gif(Textist)!
103 # !http://www.textism.com/common/textist.gif(Textist)!
104 #
104 #
105 # Will become:
105 # Will become:
106 #
106 #
107 # <img src="http://www.textism.com/common/textist.gif" alt="Textist" />
107 # <img src="http://www.textism.com/common/textist.gif" alt="Textist" />
108 #
108 #
109 # With a link:
109 # With a link:
110 #
110 #
111 # !/common/textist.gif(Textist)!:http://textism.com
111 # !/common/textist.gif(Textist)!:http://textism.com
112 #
112 #
113 # Will become:
113 # Will become:
114 #
114 #
115 # <a href="http://textism.com"><img src="/common/textist.gif" alt="Textist" /></a>
115 # <a href="http://textism.com"><img src="/common/textist.gif" alt="Textist" /></a>
116 #
116 #
117 # == Defining Acronyms
117 # == Defining Acronyms
118 #
118 #
119 # HTML allows authors to define acronyms via the tag. The definition appears as a
119 # HTML allows authors to define acronyms via the tag. The definition appears as a
120 # tool tip when a cursor hovers over the acronym. A crucial aid to clear writing,
120 # tool tip when a cursor hovers over the acronym. A crucial aid to clear writing,
121 # this should be used at least once for each acronym in documents where they appear.
121 # this should be used at least once for each acronym in documents where they appear.
122 #
122 #
123 # To quickly define an acronym in Textile, place the full text in (parentheses)
123 # To quickly define an acronym in Textile, place the full text in (parentheses)
124 # immediately following the acronym.
124 # immediately following the acronym.
125 #
125 #
126 # Example:
126 # Example:
127 #
127 #
128 # ACLU(American Civil Liberties Union)
128 # ACLU(American Civil Liberties Union)
129 #
129 #
130 # Will become:
130 # Will become:
131 #
131 #
132 # <acronym title="American Civil Liberties Union">ACLU</acronym>
132 # <acronym title="American Civil Liberties Union">ACLU</acronym>
133 #
133 #
134 # == Adding Tables
134 # == Adding Tables
135 #
135 #
136 # In Textile, simple tables can be added by seperating each column by
136 # In Textile, simple tables can be added by seperating each column by
137 # a pipe.
137 # a pipe.
138 #
138 #
139 # |a|simple|table|row|
139 # |a|simple|table|row|
140 # |And|Another|table|row|
140 # |And|Another|table|row|
141 #
141 #
142 # Attributes are defined by style definitions in parentheses.
142 # Attributes are defined by style definitions in parentheses.
143 #
143 #
144 # table(border:1px solid black).
144 # table(border:1px solid black).
145 # (background:#ddd;color:red). |{}| | | |
145 # (background:#ddd;color:red). |{}| | | |
146 #
146 #
147 # == Using RedCloth
147 # == Using RedCloth
148 #
148 #
149 # RedCloth is simply an extension of the String class, which can handle
149 # RedCloth is simply an extension of the String class, which can handle
150 # Textile formatting. Use it like a String and output HTML with its
150 # Textile formatting. Use it like a String and output HTML with its
151 # RedCloth#to_html method.
151 # RedCloth#to_html method.
152 #
152 #
153 # doc = RedCloth.new "
153 # doc = RedCloth.new "
154 #
154 #
155 # h2. Test document
155 # h2. Test document
156 #
156 #
157 # Just a simple test."
157 # Just a simple test."
158 #
158 #
159 # puts doc.to_html
159 # puts doc.to_html
160 #
160 #
161 # By default, RedCloth uses both Textile and Markdown formatting, with
161 # By default, RedCloth uses both Textile and Markdown formatting, with
162 # Textile formatting taking precedence. If you want to turn off Markdown
162 # Textile formatting taking precedence. If you want to turn off Markdown
163 # formatting, to boost speed and limit the processor:
163 # formatting, to boost speed and limit the processor:
164 #
164 #
165 # class RedCloth::Textile.new( str )
165 # class RedCloth::Textile.new( str )
166
166
167 class RedCloth3 < String
167 class RedCloth3 < String
168
168
169 VERSION = '3.0.4'
169 VERSION = '3.0.4'
170 DEFAULT_RULES = [:textile, :markdown]
170 DEFAULT_RULES = [:textile, :markdown]
171
171
172 #
172 #
173 # Two accessor for setting security restrictions.
173 # Two accessor for setting security restrictions.
174 #
174 #
175 # This is a nice thing if you're using RedCloth for
175 # This is a nice thing if you're using RedCloth for
176 # formatting in public places (e.g. Wikis) where you
176 # formatting in public places (e.g. Wikis) where you
177 # don't want users to abuse HTML for bad things.
177 # don't want users to abuse HTML for bad things.
178 #
178 #
179 # If +:filter_html+ is set, HTML which wasn't
179 # If +:filter_html+ is set, HTML which wasn't
180 # created by the Textile processor will be escaped.
180 # created by the Textile processor will be escaped.
181 #
181 #
182 # If +:filter_styles+ is set, it will also disable
182 # If +:filter_styles+ is set, it will also disable
183 # the style markup specifier. ('{color: red}')
183 # the style markup specifier. ('{color: red}')
184 #
184 #
185 attr_accessor :filter_html, :filter_styles
185 attr_accessor :filter_html, :filter_styles
186
186
187 #
187 #
188 # Accessor for toggling hard breaks.
188 # Accessor for toggling hard breaks.
189 #
189 #
190 # If +:hard_breaks+ is set, single newlines will
190 # If +:hard_breaks+ is set, single newlines will
191 # be converted to HTML break tags. This is the
191 # be converted to HTML break tags. This is the
192 # default behavior for traditional RedCloth.
192 # default behavior for traditional RedCloth.
193 #
193 #
194 attr_accessor :hard_breaks
194 attr_accessor :hard_breaks
195
195
196 # Accessor for toggling lite mode.
196 # Accessor for toggling lite mode.
197 #
197 #
198 # In lite mode, block-level rules are ignored. This means
198 # In lite mode, block-level rules are ignored. This means
199 # that tables, paragraphs, lists, and such aren't available.
199 # that tables, paragraphs, lists, and such aren't available.
200 # Only the inline markup for bold, italics, entities and so on.
200 # Only the inline markup for bold, italics, entities and so on.
201 #
201 #
202 # r = RedCloth.new( "And then? She *fell*!", [:lite_mode] )
202 # r = RedCloth.new( "And then? She *fell*!", [:lite_mode] )
203 # r.to_html
203 # r.to_html
204 # #=> "And then? She <strong>fell</strong>!"
204 # #=> "And then? She <strong>fell</strong>!"
205 #
205 #
206 attr_accessor :lite_mode
206 attr_accessor :lite_mode
207
207
208 #
208 #
209 # Accessor for toggling span caps.
209 # Accessor for toggling span caps.
210 #
210 #
211 # Textile places `span' tags around capitalized
211 # Textile places `span' tags around capitalized
212 # words by default, but this wreaks havoc on Wikis.
212 # words by default, but this wreaks havoc on Wikis.
213 # If +:no_span_caps+ is set, this will be
213 # If +:no_span_caps+ is set, this will be
214 # suppressed.
214 # suppressed.
215 #
215 #
216 attr_accessor :no_span_caps
216 attr_accessor :no_span_caps
217
217
218 #
218 #
219 # Establishes the markup predence. Available rules include:
219 # Establishes the markup predence. Available rules include:
220 #
220 #
221 # == Textile Rules
221 # == Textile Rules
222 #
222 #
223 # The following textile rules can be set individually. Or add the complete
223 # The following textile rules can be set individually. Or add the complete
224 # set of rules with the single :textile rule, which supplies the rule set in
224 # set of rules with the single :textile rule, which supplies the rule set in
225 # the following precedence:
225 # the following precedence:
226 #
226 #
227 # refs_textile:: Textile references (i.e. [hobix]http://hobix.com/)
227 # refs_textile:: Textile references (i.e. [hobix]http://hobix.com/)
228 # block_textile_table:: Textile table block structures
228 # block_textile_table:: Textile table block structures
229 # block_textile_lists:: Textile list structures
229 # block_textile_lists:: Textile list structures
230 # block_textile_prefix:: Textile blocks with prefixes (i.e. bq., h2., etc.)
230 # block_textile_prefix:: Textile blocks with prefixes (i.e. bq., h2., etc.)
231 # inline_textile_image:: Textile inline images
231 # inline_textile_image:: Textile inline images
232 # inline_textile_link:: Textile inline links
232 # inline_textile_link:: Textile inline links
233 # inline_textile_span:: Textile inline spans
233 # inline_textile_span:: Textile inline spans
234 # glyphs_textile:: Textile entities (such as em-dashes and smart quotes)
234 # glyphs_textile:: Textile entities (such as em-dashes and smart quotes)
235 #
235 #
236 # == Markdown
236 # == Markdown
237 #
237 #
238 # refs_markdown:: Markdown references (for example: [hobix]: http://hobix.com/)
238 # refs_markdown:: Markdown references (for example: [hobix]: http://hobix.com/)
239 # block_markdown_setext:: Markdown setext headers
239 # block_markdown_setext:: Markdown setext headers
240 # block_markdown_atx:: Markdown atx headers
240 # block_markdown_atx:: Markdown atx headers
241 # block_markdown_rule:: Markdown horizontal rules
241 # block_markdown_rule:: Markdown horizontal rules
242 # block_markdown_bq:: Markdown blockquotes
242 # block_markdown_bq:: Markdown blockquotes
243 # block_markdown_lists:: Markdown lists
243 # block_markdown_lists:: Markdown lists
244 # inline_markdown_link:: Markdown links
244 # inline_markdown_link:: Markdown links
245 attr_accessor :rules
245 attr_accessor :rules
246
246
247 # Returns a new RedCloth object, based on _string_ and
247 # Returns a new RedCloth object, based on _string_ and
248 # enforcing all the included _restrictions_.
248 # enforcing all the included _restrictions_.
249 #
249 #
250 # r = RedCloth.new( "h1. A <b>bold</b> man", [:filter_html] )
250 # r = RedCloth.new( "h1. A <b>bold</b> man", [:filter_html] )
251 # r.to_html
251 # r.to_html
252 # #=>"<h1>A &lt;b&gt;bold&lt;/b&gt; man</h1>"
252 # #=>"<h1>A &lt;b&gt;bold&lt;/b&gt; man</h1>"
253 #
253 #
254 def initialize( string, restrictions = [] )
254 def initialize( string, restrictions = [] )
255 restrictions.each { |r| method( "#{ r }=" ).call( true ) }
255 restrictions.each { |r| method( "#{ r }=" ).call( true ) }
256 super( string )
256 super( string )
257 end
257 end
258
258
259 #
259 #
260 # Generates HTML from the Textile contents.
260 # Generates HTML from the Textile contents.
261 #
261 #
262 # r = RedCloth.new( "And then? She *fell*!" )
262 # r = RedCloth.new( "And then? She *fell*!" )
263 # r.to_html( true )
263 # r.to_html( true )
264 # #=>"And then? She <strong>fell</strong>!"
264 # #=>"And then? She <strong>fell</strong>!"
265 #
265 #
266 def to_html( *rules )
266 def to_html( *rules )
267 rules = DEFAULT_RULES if rules.empty?
267 rules = DEFAULT_RULES if rules.empty?
268 # make our working copy
268 # make our working copy
269 text = self.dup
269 text = self.dup
270
270
271 @urlrefs = {}
271 @urlrefs = {}
272 @shelf = []
272 @shelf = []
273 textile_rules = [:refs_textile, :block_textile_table, :block_textile_lists,
273 textile_rules = [:refs_textile, :block_textile_table, :block_textile_lists,
274 :block_textile_prefix, :inline_textile_image, :inline_textile_link,
274 :block_textile_prefix, :inline_textile_image, :inline_textile_link,
275 :inline_textile_code, :inline_textile_span, :glyphs_textile]
275 :inline_textile_code, :inline_textile_span, :glyphs_textile]
276 markdown_rules = [:refs_markdown, :block_markdown_setext, :block_markdown_atx, :block_markdown_rule,
276 markdown_rules = [:refs_markdown, :block_markdown_setext, :block_markdown_atx, :block_markdown_rule,
277 :block_markdown_bq, :block_markdown_lists,
277 :block_markdown_bq, :block_markdown_lists,
278 :inline_markdown_reflink, :inline_markdown_link]
278 :inline_markdown_reflink, :inline_markdown_link]
279 @rules = rules.collect do |rule|
279 @rules = rules.collect do |rule|
280 case rule
280 case rule
281 when :markdown
281 when :markdown
282 markdown_rules
282 markdown_rules
283 when :textile
283 when :textile
284 textile_rules
284 textile_rules
285 else
285 else
286 rule
286 rule
287 end
287 end
288 end.flatten
288 end.flatten
289
289
290 # standard clean up
290 # standard clean up
291 incoming_entities text
291 incoming_entities text
292 clean_white_space text
292 clean_white_space text
293
293
294 # start processor
294 # start processor
295 @pre_list = []
295 @pre_list = []
296 rip_offtags text
296 rip_offtags text
297 no_textile text
297 no_textile text
298 escape_html_tags text
298 escape_html_tags text
299 hard_break text
299 hard_break text
300 unless @lite_mode
300 unless @lite_mode
301 refs text
301 refs text
302 # need to do this before text is split by #blocks
302 # need to do this before text is split by #blocks
303 block_textile_quotes text
303 block_textile_quotes text
304 blocks text
304 blocks text
305 end
305 end
306 inline text
306 inline text
307 smooth_offtags text
307 smooth_offtags text
308
308
309 retrieve text
309 retrieve text
310
310
311 text.gsub!( /<\/?notextile>/, '' )
311 text.gsub!( /<\/?notextile>/, '' )
312 text.gsub!( /x%x%/, '&#38;' )
312 text.gsub!( /x%x%/, '&#38;' )
313 clean_html text if filter_html
313 clean_html text if filter_html
314 text.strip!
314 text.strip!
315 text
315 text
316
316
317 end
317 end
318
318
319 #######
319 #######
320 private
320 private
321 #######
321 #######
322 #
322 #
323 # Mapping of 8-bit ASCII codes to HTML numerical entity equivalents.
323 # Mapping of 8-bit ASCII codes to HTML numerical entity equivalents.
324 # (from PyTextile)
324 # (from PyTextile)
325 #
325 #
326 TEXTILE_TAGS =
326 TEXTILE_TAGS =
327
327
328 [[128, 8364], [129, 0], [130, 8218], [131, 402], [132, 8222], [133, 8230],
328 [[128, 8364], [129, 0], [130, 8218], [131, 402], [132, 8222], [133, 8230],
329 [134, 8224], [135, 8225], [136, 710], [137, 8240], [138, 352], [139, 8249],
329 [134, 8224], [135, 8225], [136, 710], [137, 8240], [138, 352], [139, 8249],
330 [140, 338], [141, 0], [142, 0], [143, 0], [144, 0], [145, 8216], [146, 8217],
330 [140, 338], [141, 0], [142, 0], [143, 0], [144, 0], [145, 8216], [146, 8217],
331 [147, 8220], [148, 8221], [149, 8226], [150, 8211], [151, 8212], [152, 732],
331 [147, 8220], [148, 8221], [149, 8226], [150, 8211], [151, 8212], [152, 732],
332 [153, 8482], [154, 353], [155, 8250], [156, 339], [157, 0], [158, 0], [159, 376]].
332 [153, 8482], [154, 353], [155, 8250], [156, 339], [157, 0], [158, 0], [159, 376]].
333
333
334 collect! do |a, b|
334 collect! do |a, b|
335 [a.chr, ( b.zero? and "" or "&#{ b };" )]
335 [a.chr, ( b.zero? and "" or "&#{ b };" )]
336 end
336 end
337
337
338 #
338 #
339 # Regular expressions to convert to HTML.
339 # Regular expressions to convert to HTML.
340 #
340 #
341 A_HLGN = /(?:(?:<>|<|>|\=|[()]+)+)/
341 A_HLGN = /(?:(?:<>|<|>|\=|[()]+)+)/
342 A_VLGN = /[\-^~]/
342 A_VLGN = /[\-^~]/
343 C_CLAS = '(?:\([^)]+\))'
343 C_CLAS = '(?:\([^)]+\))'
344 C_LNGE = '(?:\[[^\[\]]+\])'
344 C_LNGE = '(?:\[[^\[\]]+\])'
345 C_STYL = '(?:\{[^}]+\})'
345 C_STYL = '(?:\{[^}]+\})'
346 S_CSPN = '(?:\\\\\d+)'
346 S_CSPN = '(?:\\\\\d+)'
347 S_RSPN = '(?:/\d+)'
347 S_RSPN = '(?:/\d+)'
348 A = "(?:#{A_HLGN}?#{A_VLGN}?|#{A_VLGN}?#{A_HLGN}?)"
348 A = "(?:#{A_HLGN}?#{A_VLGN}?|#{A_VLGN}?#{A_HLGN}?)"
349 S = "(?:#{S_CSPN}?#{S_RSPN}|#{S_RSPN}?#{S_CSPN}?)"
349 S = "(?:#{S_CSPN}?#{S_RSPN}|#{S_RSPN}?#{S_CSPN}?)"
350 C = "(?:#{C_CLAS}?#{C_STYL}?#{C_LNGE}?|#{C_STYL}?#{C_LNGE}?#{C_CLAS}?|#{C_LNGE}?#{C_STYL}?#{C_CLAS}?)"
350 C = "(?:#{C_CLAS}?#{C_STYL}?#{C_LNGE}?|#{C_STYL}?#{C_LNGE}?#{C_CLAS}?|#{C_LNGE}?#{C_STYL}?#{C_CLAS}?)"
351 # PUNCT = Regexp::quote( '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~' )
351 # PUNCT = Regexp::quote( '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~' )
352 PUNCT = Regexp::quote( '!"#$%&\'*+,-./:;=?@\\^_`|~' )
352 PUNCT = Regexp::quote( '!"#$%&\'*+,-./:;=?@\\^_`|~' )
353 PUNCT_NOQ = Regexp::quote( '!"#$&\',./:;=?@\\`|' )
353 PUNCT_NOQ = Regexp::quote( '!"#$&\',./:;=?@\\`|' )
354 PUNCT_Q = Regexp::quote( '*-_+^~%' )
354 PUNCT_Q = Regexp::quote( '*-_+^~%' )
355 HYPERLINK = '(\S+?)([^\w\s/;=\?]*?)(?=\s|<|$)'
355 HYPERLINK = '(\S+?)([^\w\s/;=\?]*?)(?=\s|<|$)'
356
356
357 # Text markup tags, don't conflict with block tags
357 # Text markup tags, don't conflict with block tags
358 SIMPLE_HTML_TAGS = [
358 SIMPLE_HTML_TAGS = [
359 'tt', 'b', 'i', 'big', 'small', 'em', 'strong', 'dfn', 'code',
359 'tt', 'b', 'i', 'big', 'small', 'em', 'strong', 'dfn', 'code',
360 'samp', 'kbd', 'var', 'cite', 'abbr', 'acronym', 'a', 'img', 'br',
360 'samp', 'kbd', 'var', 'cite', 'abbr', 'acronym', 'a', 'img', 'br',
361 'br', 'map', 'q', 'sub', 'sup', 'span', 'bdo'
361 'br', 'map', 'q', 'sub', 'sup', 'span', 'bdo'
362 ]
362 ]
363
363
364 QTAGS = [
364 QTAGS = [
365 ['**', 'b', :limit],
365 ['**', 'b', :limit],
366 ['*', 'strong', :limit],
366 ['*', 'strong', :limit],
367 ['??', 'cite', :limit],
367 ['??', 'cite', :limit],
368 ['-', 'del', :limit],
368 ['-', 'del', :limit],
369 ['__', 'i', :limit],
369 ['__', 'i', :limit],
370 ['_', 'em', :limit],
370 ['_', 'em', :limit],
371 ['%', 'span', :limit],
371 ['%', 'span', :limit],
372 ['+', 'ins', :limit],
372 ['+', 'ins', :limit],
373 ['^', 'sup', :limit],
373 ['^', 'sup', :limit],
374 ['~', 'sub', :limit]
374 ['~', 'sub', :limit]
375 ]
375 ]
376 QTAGS.collect! do |rc, ht, rtype|
376 QTAGS.collect! do |rc, ht, rtype|
377 rcq = Regexp::quote rc
377 rcq = Regexp::quote rc
378 re =
378 re =
379 case rtype
379 case rtype
380 when :limit
380 when :limit
381 /(^|[>\s\(])
381 /(^|[>\s\(])
382 (#{rcq})
382 (#{rcq})
383 (#{C})
383 (#{C})
384 (?::(\S+?))?
384 (?::(\S+?))?
385 (\w|[^\s\-].*?[^\s\-])
385 (\w|[^\s\-].*?[^\s\-])
386 #{rcq}
386 #{rcq}
387 (?=[[:punct:]]|\s|\)|$)/x
387 (?=[[:punct:]]|\s|\)|$)/x
388 else
388 else
389 /(#{rcq})
389 /(#{rcq})
390 (#{C})
390 (#{C})
391 (?::(\S+))?
391 (?::(\S+))?
392 (\w|[^\s\-].*?[^\s\-])
392 (\w|[^\s\-].*?[^\s\-])
393 #{rcq}/xm
393 #{rcq}/xm
394 end
394 end
395 [rc, ht, re, rtype]
395 [rc, ht, re, rtype]
396 end
396 end
397
397
398 # Elements to handle
398 # Elements to handle
399 GLYPHS = [
399 GLYPHS = [
400 # [ /([^\s\[{(>])?\'([dmst]\b|ll\b|ve\b|\s|:|$)/, '\1&#8217;\2' ], # single closing
400 # [ /([^\s\[{(>])?\'([dmst]\b|ll\b|ve\b|\s|:|$)/, '\1&#8217;\2' ], # single closing
401 # [ /([^\s\[{(>#{PUNCT_Q}][#{PUNCT_Q}]*)\'/, '\1&#8217;' ], # single closing
401 # [ /([^\s\[{(>#{PUNCT_Q}][#{PUNCT_Q}]*)\'/, '\1&#8217;' ], # single closing
402 # [ /\'(?=[#{PUNCT_Q}]*(s\b|[\s#{PUNCT_NOQ}]))/, '&#8217;' ], # single closing
402 # [ /\'(?=[#{PUNCT_Q}]*(s\b|[\s#{PUNCT_NOQ}]))/, '&#8217;' ], # single closing
403 # [ /\'/, '&#8216;' ], # single opening
403 # [ /\'/, '&#8216;' ], # single opening
404 # [ /</, '&lt;' ], # less-than
404 # [ /</, '&lt;' ], # less-than
405 # [ />/, '&gt;' ], # greater-than
405 # [ />/, '&gt;' ], # greater-than
406 # [ /([^\s\[{(])?"(\s|:|$)/, '\1&#8221;\2' ], # double closing
406 # [ /([^\s\[{(])?"(\s|:|$)/, '\1&#8221;\2' ], # double closing
407 # [ /([^\s\[{(>#{PUNCT_Q}][#{PUNCT_Q}]*)"/, '\1&#8221;' ], # double closing
407 # [ /([^\s\[{(>#{PUNCT_Q}][#{PUNCT_Q}]*)"/, '\1&#8221;' ], # double closing
408 # [ /"(?=[#{PUNCT_Q}]*[\s#{PUNCT_NOQ}])/, '&#8221;' ], # double closing
408 # [ /"(?=[#{PUNCT_Q}]*[\s#{PUNCT_NOQ}])/, '&#8221;' ], # double closing
409 # [ /"/, '&#8220;' ], # double opening
409 # [ /"/, '&#8220;' ], # double opening
410 # [ /\b( )?\.{3}/, '\1&#8230;' ], # ellipsis
410 # [ /\b( )?\.{3}/, '\1&#8230;' ], # ellipsis
411 # [ /\b([A-Z][A-Z0-9]{2,})\b(?:[(]([^)]*)[)])/, '<acronym title="\2">\1</acronym>' ], # 3+ uppercase acronym
411 # [ /\b([A-Z][A-Z0-9]{2,})\b(?:[(]([^)]*)[)])/, '<acronym title="\2">\1</acronym>' ], # 3+ uppercase acronym
412 # [ /(^|[^"][>\s])([A-Z][A-Z0-9 ]+[A-Z0-9])([^<A-Za-z0-9]|$)/, '\1<span class="caps">\2</span>\3', :no_span_caps ], # 3+ uppercase caps
412 # [ /(^|[^"][>\s])([A-Z][A-Z0-9 ]+[A-Z0-9])([^<A-Za-z0-9]|$)/, '\1<span class="caps">\2</span>\3', :no_span_caps ], # 3+ uppercase caps
413 # [ /(\.\s)?\s?--\s?/, '\1&#8212;' ], # em dash
413 # [ /(\.\s)?\s?--\s?/, '\1&#8212;' ], # em dash
414 # [ /\s->\s/, ' &rarr; ' ], # right arrow
414 # [ /\s->\s/, ' &rarr; ' ], # right arrow
415 # [ /\s-\s/, ' &#8211; ' ], # en dash
415 # [ /\s-\s/, ' &#8211; ' ], # en dash
416 # [ /(\d+) ?x ?(\d+)/, '\1&#215;\2' ], # dimension sign
416 # [ /(\d+) ?x ?(\d+)/, '\1&#215;\2' ], # dimension sign
417 # [ /\b ?[(\[]TM[\])]/i, '&#8482;' ], # trademark
417 # [ /\b ?[(\[]TM[\])]/i, '&#8482;' ], # trademark
418 # [ /\b ?[(\[]R[\])]/i, '&#174;' ], # registered
418 # [ /\b ?[(\[]R[\])]/i, '&#174;' ], # registered
419 # [ /\b ?[(\[]C[\])]/i, '&#169;' ] # copyright
419 # [ /\b ?[(\[]C[\])]/i, '&#169;' ] # copyright
420 ]
420 ]
421
421
422 H_ALGN_VALS = {
422 H_ALGN_VALS = {
423 '<' => 'left',
423 '<' => 'left',
424 '=' => 'center',
424 '=' => 'center',
425 '>' => 'right',
425 '>' => 'right',
426 '<>' => 'justify'
426 '<>' => 'justify'
427 }
427 }
428
428
429 V_ALGN_VALS = {
429 V_ALGN_VALS = {
430 '^' => 'top',
430 '^' => 'top',
431 '-' => 'middle',
431 '-' => 'middle',
432 '~' => 'bottom'
432 '~' => 'bottom'
433 }
433 }
434
434
435 #
435 #
436 # Flexible HTML escaping
436 # Flexible HTML escaping
437 #
437 #
438 def htmlesc( str, mode=:Quotes )
438 def htmlesc( str, mode=:Quotes )
439 if str
439 if str
440 str.gsub!( '&', '&amp;' )
440 str.gsub!( '&', '&amp;' )
441 str.gsub!( '"', '&quot;' ) if mode != :NoQuotes
441 str.gsub!( '"', '&quot;' ) if mode != :NoQuotes
442 str.gsub!( "'", '&#039;' ) if mode == :Quotes
442 str.gsub!( "'", '&#039;' ) if mode == :Quotes
443 str.gsub!( '<', '&lt;')
443 str.gsub!( '<', '&lt;')
444 str.gsub!( '>', '&gt;')
444 str.gsub!( '>', '&gt;')
445 end
445 end
446 str
446 str
447 end
447 end
448
448
449 # Search and replace for Textile glyphs (quotes, dashes, other symbols)
449 # Search and replace for Textile glyphs (quotes, dashes, other symbols)
450 def pgl( text )
450 def pgl( text )
451 #GLYPHS.each do |re, resub, tog|
451 #GLYPHS.each do |re, resub, tog|
452 # next if tog and method( tog ).call
452 # next if tog and method( tog ).call
453 # text.gsub! re, resub
453 # text.gsub! re, resub
454 #end
454 #end
455 text.gsub!(/\b([A-Z][A-Z0-9]{2,})\b(?:[(]([^)]*)[)])/) do |m|
455 text.gsub!(/\b([A-Z][A-Z0-9]{2,})\b(?:[(]([^)]*)[)])/) do |m|
456 "<acronym title=\"#{htmlesc $2}\">#{$1}</acronym>"
456 "<acronym title=\"#{htmlesc $2}\">#{$1}</acronym>"
457 end
457 end
458 end
458 end
459
459
460 # Parses Textile attribute lists and builds an HTML attribute string
460 # Parses Textile attribute lists and builds an HTML attribute string
461 def pba( text_in, element = "" )
461 def pba( text_in, element = "" )
462
462
463 return '' unless text_in
463 return '' unless text_in
464
464
465 style = []
465 style = []
466 text = text_in.dup
466 text = text_in.dup
467 if element == 'td'
467 if element == 'td'
468 colspan = $1 if text =~ /\\(\d+)/
468 colspan = $1 if text =~ /\\(\d+)/
469 rowspan = $1 if text =~ /\/(\d+)/
469 rowspan = $1 if text =~ /\/(\d+)/
470 style << "vertical-align:#{ v_align( $& ) };" if text =~ A_VLGN
470 style << "vertical-align:#{ v_align( $& ) };" if text =~ A_VLGN
471 end
471 end
472
472
473 style << "#{ htmlesc $1 };" if text.sub!( /\{([^}]*)\}/, '' ) && !filter_styles
473 style << "#{ htmlesc $1 };" if text.sub!( /\{([^}]*)\}/, '' ) && !filter_styles
474
474
475 lang = $1 if
475 lang = $1 if
476 text.sub!( /\[([^)]+?)\]/, '' )
476 text.sub!( /\[([^)]+?)\]/, '' )
477
477
478 cls = $1 if
478 cls = $1 if
479 text.sub!( /\(([^()]+?)\)/, '' )
479 text.sub!( /\(([^()]+?)\)/, '' )
480
480
481 style << "padding-left:#{ $1.length }em;" if
481 style << "padding-left:#{ $1.length }em;" if
482 text.sub!( /([(]+)/, '' )
482 text.sub!( /([(]+)/, '' )
483
483
484 style << "padding-right:#{ $1.length }em;" if text.sub!( /([)]+)/, '' )
484 style << "padding-right:#{ $1.length }em;" if text.sub!( /([)]+)/, '' )
485
485
486 style << "text-align:#{ h_align( $& ) };" if text =~ A_HLGN
486 style << "text-align:#{ h_align( $& ) };" if text =~ A_HLGN
487
487
488 cls, id = $1, $2 if cls =~ /^(.*?)#(.*)$/
488 cls, id = $1, $2 if cls =~ /^(.*?)#(.*)$/
489
489
490 atts = ''
490 atts = ''
491 atts << " style=\"#{ style.join }\"" unless style.empty?
491 atts << " style=\"#{ style.join }\"" unless style.empty?
492 atts << " class=\"#{ cls }\"" unless cls.to_s.empty?
492 atts << " class=\"#{ cls }\"" unless cls.to_s.empty?
493 atts << " lang=\"#{ lang }\"" if lang
493 atts << " lang=\"#{ lang }\"" if lang
494 atts << " id=\"#{ id }\"" if id
494 atts << " id=\"#{ id }\"" if id
495 atts << " colspan=\"#{ colspan }\"" if colspan
495 atts << " colspan=\"#{ colspan }\"" if colspan
496 atts << " rowspan=\"#{ rowspan }\"" if rowspan
496 atts << " rowspan=\"#{ rowspan }\"" if rowspan
497
497
498 atts
498 atts
499 end
499 end
500
500
501 TABLE_RE = /^(?:table(_?#{S}#{A}#{C})\. ?\n)?^(#{A}#{C}\.? ?\|.*?\|)(\n\n|\Z)/m
501 TABLE_RE = /^(?:table(_?#{S}#{A}#{C})\. ?\n)?^(#{A}#{C}\.? ?\|.*?\|)(\n\n|\Z)/m
502
502
503 # Parses a Textile table block, building HTML from the result.
503 # Parses a Textile table block, building HTML from the result.
504 def block_textile_table( text )
504 def block_textile_table( text )
505 text.gsub!( TABLE_RE ) do |matches|
505 text.gsub!( TABLE_RE ) do |matches|
506
506
507 tatts, fullrow = $~[1..2]
507 tatts, fullrow = $~[1..2]
508 tatts = pba( tatts, 'table' )
508 tatts = pba( tatts, 'table' )
509 tatts = shelve( tatts ) if tatts
509 tatts = shelve( tatts ) if tatts
510 rows = []
510 rows = []
511
511
512 fullrow.each_line do |row|
512 fullrow.each_line do |row|
513 ratts, row = pba( $1, 'tr' ), $2 if row =~ /^(#{A}#{C}\. )(.*)/m
513 ratts, row = pba( $1, 'tr' ), $2 if row =~ /^(#{A}#{C}\. )(.*)/m
514 cells = []
514 cells = []
515 row.split( /(\|)(?![^\[\|]*\]\])/ )[1..-2].each do |cell|
515 row.split( /(\|)(?![^\[\|]*\]\])/ )[1..-2].each do |cell|
516 next if cell == '|'
516 next if cell == '|'
517 ctyp = 'd'
517 ctyp = 'd'
518 ctyp = 'h' if cell =~ /^_/
518 ctyp = 'h' if cell =~ /^_/
519
519
520 catts = ''
520 catts = ''
521 catts, cell = pba( $1, 'td' ), $2 if cell =~ /^(_?#{S}#{A}#{C}\. ?)(.*)/
521 catts, cell = pba( $1, 'td' ), $2 if cell =~ /^(_?#{S}#{A}#{C}\. ?)(.*)/
522
522
523 catts = shelve( catts ) if catts
523 catts = shelve( catts ) if catts
524 cells << "\t\t\t<t#{ ctyp }#{ catts }>#{ cell }</t#{ ctyp }>"
524 cells << "\t\t\t<t#{ ctyp }#{ catts }>#{ cell }</t#{ ctyp }>"
525 end
525 end
526 ratts = shelve( ratts ) if ratts
526 ratts = shelve( ratts ) if ratts
527 rows << "\t\t<tr#{ ratts }>\n#{ cells.join( "\n" ) }\n\t\t</tr>"
527 rows << "\t\t<tr#{ ratts }>\n#{ cells.join( "\n" ) }\n\t\t</tr>"
528 end
528 end
529 "\t<table#{ tatts }>\n#{ rows.join( "\n" ) }\n\t</table>\n\n"
529 "\t<table#{ tatts }>\n#{ rows.join( "\n" ) }\n\t</table>\n\n"
530 end
530 end
531 end
531 end
532
532
533 LISTS_RE = /^([#*]+?#{C} .*?)$(?![^#*])/m
533 LISTS_RE = /^([#*]+?#{C} .*?)$(?![^#*])/m
534 LISTS_CONTENT_RE = /^([#*]+)(#{A}#{C}) (.*)$/m
534 LISTS_CONTENT_RE = /^([#*]+)(#{A}#{C}) (.*)$/m
535
535
536 # Parses Textile lists and generates HTML
536 # Parses Textile lists and generates HTML
537 def block_textile_lists( text )
537 def block_textile_lists( text )
538 text.gsub!( LISTS_RE ) do |match|
538 text.gsub!( LISTS_RE ) do |match|
539 lines = match.split( /\n/ )
539 lines = match.split( /\n/ )
540 last_line = -1
540 last_line = -1
541 depth = []
541 depth = []
542 lines.each_with_index do |line, line_id|
542 lines.each_with_index do |line, line_id|
543 if line =~ LISTS_CONTENT_RE
543 if line =~ LISTS_CONTENT_RE
544 tl,atts,content = $~[1..3]
544 tl,atts,content = $~[1..3]
545 if depth.last
545 if depth.last
546 if depth.last.length > tl.length
546 if depth.last.length > tl.length
547 (depth.length - 1).downto(0) do |i|
547 (depth.length - 1).downto(0) do |i|
548 break if depth[i].length == tl.length
548 break if depth[i].length == tl.length
549 lines[line_id - 1] << "</li>\n\t</#{ lT( depth[i] ) }l>\n\t"
549 lines[line_id - 1] << "</li>\n\t</#{ lT( depth[i] ) }l>\n\t"
550 depth.pop
550 depth.pop
551 end
551 end
552 end
552 end
553 if depth.last and depth.last.length == tl.length
553 if depth.last and depth.last.length == tl.length
554 lines[line_id - 1] << '</li>'
554 lines[line_id - 1] << '</li>'
555 end
555 end
556 end
556 end
557 unless depth.last == tl
557 unless depth.last == tl
558 depth << tl
558 depth << tl
559 atts = pba( atts )
559 atts = pba( atts )
560 atts = shelve( atts ) if atts
560 atts = shelve( atts ) if atts
561 lines[line_id] = "\t<#{ lT(tl) }l#{ atts }>\n\t<li>#{ content }"
561 lines[line_id] = "\t<#{ lT(tl) }l#{ atts }>\n\t<li>#{ content }"
562 else
562 else
563 lines[line_id] = "\t\t<li>#{ content }"
563 lines[line_id] = "\t\t<li>#{ content }"
564 end
564 end
565 last_line = line_id
565 last_line = line_id
566
566
567 else
567 else
568 last_line = line_id
568 last_line = line_id
569 end
569 end
570 if line_id - last_line > 1 or line_id == lines.length - 1
570 if line_id - last_line > 1 or line_id == lines.length - 1
571 depth.delete_if do |v|
571 depth.delete_if do |v|
572 lines[last_line] << "</li>\n\t</#{ lT( v ) }l>"
572 lines[last_line] << "</li>\n\t</#{ lT( v ) }l>"
573 end
573 end
574 end
574 end
575 end
575 end
576 lines.join( "\n" )
576 lines.join( "\n" )
577 end
577 end
578 end
578 end
579
579
580 QUOTES_RE = /(^>+([^\n]*?)\n?)+/m
580 QUOTES_RE = /(^>+([^\n]*?)\n?)+/m
581 QUOTES_CONTENT_RE = /^([> ]+)(.*)$/m
581 QUOTES_CONTENT_RE = /^([> ]+)(.*)$/m
582
582
583 def block_textile_quotes( text )
583 def block_textile_quotes( text )
584 text.gsub!( QUOTES_RE ) do |match|
584 text.gsub!( QUOTES_RE ) do |match|
585 lines = match.split( /\n/ )
585 lines = match.split( /\n/ )
586 quotes = ''
586 quotes = ''
587 indent = 0
587 indent = 0
588 lines.each do |line|
588 lines.each do |line|
589 line =~ QUOTES_CONTENT_RE
589 line =~ QUOTES_CONTENT_RE
590 bq,content = $1, $2
590 bq,content = $1, $2
591 l = bq.count('>')
591 l = bq.count('>')
592 if l != indent
592 if l != indent
593 quotes << ("\n\n" + (l>indent ? '<blockquote>' * (l-indent) : '</blockquote>' * (indent-l)) + "\n\n")
593 quotes << ("\n\n" + (l>indent ? '<blockquote>' * (l-indent) : '</blockquote>' * (indent-l)) + "\n\n")
594 indent = l
594 indent = l
595 end
595 end
596 quotes << (content + "\n")
596 quotes << (content + "\n")
597 end
597 end
598 quotes << ("\n" + '</blockquote>' * indent + "\n\n")
598 quotes << ("\n" + '</blockquote>' * indent + "\n\n")
599 quotes
599 quotes
600 end
600 end
601 end
601 end
602
602
603 CODE_RE = /(\W)
603 CODE_RE = /(\W)
604 @
604 @
605 (?:\|(\w+?)\|)?
605 (?:\|(\w+?)\|)?
606 (.+?)
606 (.+?)
607 @
607 @
608 (?=\W)/x
608 (?=\W)/x
609
609
610 def inline_textile_code( text )
610 def inline_textile_code( text )
611 text.gsub!( CODE_RE ) do |m|
611 text.gsub!( CODE_RE ) do |m|
612 before,lang,code,after = $~[1..4]
612 before,lang,code,after = $~[1..4]
613 lang = " lang=\"#{ lang }\"" if lang
613 lang = " lang=\"#{ lang }\"" if lang
614 rip_offtags( "#{ before }<code#{ lang }>#{ code }</code>#{ after }" )
614 rip_offtags( "#{ before }<code#{ lang }>#{ code }</code>#{ after }" )
615 end
615 end
616 end
616 end
617
617
618 def lT( text )
618 def lT( text )
619 text =~ /\#$/ ? 'o' : 'u'
619 text =~ /\#$/ ? 'o' : 'u'
620 end
620 end
621
621
622 def hard_break( text )
622 def hard_break( text )
623 text.gsub!( /(.)\n(?!\Z| *([#*=]+(\s|$)|[{|]))/, "\\1<br />" ) if hard_breaks
623 text.gsub!( /(.)\n(?!\Z| *([#*=]+(\s|$)|[{|]))/, "\\1<br />" ) if hard_breaks
624 end
624 end
625
625
626 BLOCKS_GROUP_RE = /\n{2,}(?! )/m
626 BLOCKS_GROUP_RE = /\n{2,}(?! )/m
627
627
628 def blocks( text, deep_code = false )
628 def blocks( text, deep_code = false )
629 text.replace( text.split( BLOCKS_GROUP_RE ).collect do |blk|
629 text.replace( text.split( BLOCKS_GROUP_RE ).collect do |blk|
630 plain = blk !~ /\A[#*> ]/
630 plain = blk !~ /\A[#*> ]/
631
631
632 # skip blocks that are complex HTML
632 # skip blocks that are complex HTML
633 if blk =~ /^<\/?(\w+).*>/ and not SIMPLE_HTML_TAGS.include? $1
633 if blk =~ /^<\/?(\w+).*>/ and not SIMPLE_HTML_TAGS.include? $1
634 blk
634 blk
635 else
635 else
636 # search for indentation levels
636 # search for indentation levels
637 blk.strip!
637 blk.strip!
638 if blk.empty?
638 if blk.empty?
639 blk
639 blk
640 else
640 else
641 code_blk = nil
641 code_blk = nil
642 blk.gsub!( /((?:\n(?:\n^ +[^\n]*)+)+)/m ) do |iblk|
642 blk.gsub!( /((?:\n(?:\n^ +[^\n]*)+)+)/m ) do |iblk|
643 flush_left iblk
643 flush_left iblk
644 blocks iblk, plain
644 blocks iblk, plain
645 iblk.gsub( /^(\S)/, "\t\\1" )
645 iblk.gsub( /^(\S)/, "\t\\1" )
646 if plain
646 if plain
647 code_blk = iblk; ""
647 code_blk = iblk; ""
648 else
648 else
649 iblk
649 iblk
650 end
650 end
651 end
651 end
652
652
653 block_applied = 0
653 block_applied = 0
654 @rules.each do |rule_name|
654 @rules.each do |rule_name|
655 block_applied += 1 if ( rule_name.to_s.match /^block_/ and method( rule_name ).call( blk ) )
655 block_applied += 1 if ( rule_name.to_s.match /^block_/ and method( rule_name ).call( blk ) )
656 end
656 end
657 if block_applied.zero?
657 if block_applied.zero?
658 if deep_code
658 if deep_code
659 blk = "\t<pre><code>#{ blk }</code></pre>"
659 blk = "\t<pre><code>#{ blk }</code></pre>"
660 else
660 else
661 blk = "\t<p>#{ blk }</p>"
661 blk = "\t<p>#{ blk }</p>"
662 end
662 end
663 end
663 end
664 # hard_break blk
664 # hard_break blk
665 blk + "\n#{ code_blk }"
665 blk + "\n#{ code_blk }"
666 end
666 end
667 end
667 end
668
668
669 end.join( "\n\n" ) )
669 end.join( "\n\n" ) )
670 end
670 end
671
671
672 def textile_bq( tag, atts, cite, content )
672 def textile_bq( tag, atts, cite, content )
673 cite, cite_title = check_refs( cite )
673 cite, cite_title = check_refs( cite )
674 cite = " cite=\"#{ cite }\"" if cite
674 cite = " cite=\"#{ cite }\"" if cite
675 atts = shelve( atts ) if atts
675 atts = shelve( atts ) if atts
676 "\t<blockquote#{ cite }>\n\t\t<p#{ atts }>#{ content }</p>\n\t</blockquote>"
676 "\t<blockquote#{ cite }>\n\t\t<p#{ atts }>#{ content }</p>\n\t</blockquote>"
677 end
677 end
678
678
679 def textile_p( tag, atts, cite, content )
679 def textile_p( tag, atts, cite, content )
680 atts = shelve( atts ) if atts
680 atts = shelve( atts ) if atts
681 "\t<#{ tag }#{ atts }>#{ content }</#{ tag }>"
681 "\t<#{ tag }#{ atts }>#{ content }</#{ tag }>"
682 end
682 end
683
683
684 alias textile_h1 textile_p
684 alias textile_h1 textile_p
685 alias textile_h2 textile_p
685 alias textile_h2 textile_p
686 alias textile_h3 textile_p
686 alias textile_h3 textile_p
687 alias textile_h4 textile_p
687 alias textile_h4 textile_p
688 alias textile_h5 textile_p
688 alias textile_h5 textile_p
689 alias textile_h6 textile_p
689 alias textile_h6 textile_p
690
690
691 def textile_fn_( tag, num, atts, cite, content )
691 def textile_fn_( tag, num, atts, cite, content )
692 atts << " id=\"fn#{ num }\" class=\"footnote\""
692 atts << " id=\"fn#{ num }\" class=\"footnote\""
693 content = "<sup>#{ num }</sup> #{ content }"
693 content = "<sup>#{ num }</sup> #{ content }"
694 atts = shelve( atts ) if atts
694 atts = shelve( atts ) if atts
695 "\t<p#{ atts }>#{ content }</p>"
695 "\t<p#{ atts }>#{ content }</p>"
696 end
696 end
697
697
698 BLOCK_RE = /^(([a-z]+)(\d*))(#{A}#{C})\.(?::(\S+))? (.*)$/m
698 BLOCK_RE = /^(([a-z]+)(\d*))(#{A}#{C})\.(?::(\S+))? (.*)$/m
699
699
700 def block_textile_prefix( text )
700 def block_textile_prefix( text )
701 if text =~ BLOCK_RE
701 if text =~ BLOCK_RE
702 tag,tagpre,num,atts,cite,content = $~[1..6]
702 tag,tagpre,num,atts,cite,content = $~[1..6]
703 atts = pba( atts )
703 atts = pba( atts )
704
704
705 # pass to prefix handler
705 # pass to prefix handler
706 if respond_to? "textile_#{ tag }", true
706 if respond_to? "textile_#{ tag }", true
707 text.gsub!( $&, method( "textile_#{ tag }" ).call( tag, atts, cite, content ) )
707 text.gsub!( $&, method( "textile_#{ tag }" ).call( tag, atts, cite, content ) )
708 elsif respond_to? "textile_#{ tagpre }_", true
708 elsif respond_to? "textile_#{ tagpre }_", true
709 text.gsub!( $&, method( "textile_#{ tagpre }_" ).call( tagpre, num, atts, cite, content ) )
709 text.gsub!( $&, method( "textile_#{ tagpre }_" ).call( tagpre, num, atts, cite, content ) )
710 end
710 end
711 end
711 end
712 end
712 end
713
713
714 SETEXT_RE = /\A(.+?)\n([=-])[=-]* *$/m
714 SETEXT_RE = /\A(.+?)\n([=-])[=-]* *$/m
715 def block_markdown_setext( text )
715 def block_markdown_setext( text )
716 if text =~ SETEXT_RE
716 if text =~ SETEXT_RE
717 tag = if $2 == "="; "h1"; else; "h2"; end
717 tag = if $2 == "="; "h1"; else; "h2"; end
718 blk, cont = "<#{ tag }>#{ $1 }</#{ tag }>", $'
718 blk, cont = "<#{ tag }>#{ $1 }</#{ tag }>", $'
719 blocks cont
719 blocks cont
720 text.replace( blk + cont )
720 text.replace( blk + cont )
721 end
721 end
722 end
722 end
723
723
724 ATX_RE = /\A(\#{1,6}) # $1 = string of #'s
724 ATX_RE = /\A(\#{1,6}) # $1 = string of #'s
725 [ ]*
725 [ ]*
726 (.+?) # $2 = Header text
726 (.+?) # $2 = Header text
727 [ ]*
727 [ ]*
728 \#* # optional closing #'s (not counted)
728 \#* # optional closing #'s (not counted)
729 $/x
729 $/x
730 def block_markdown_atx( text )
730 def block_markdown_atx( text )
731 if text =~ ATX_RE
731 if text =~ ATX_RE
732 tag = "h#{ $1.length }"
732 tag = "h#{ $1.length }"
733 blk, cont = "<#{ tag }>#{ $2 }</#{ tag }>\n\n", $'
733 blk, cont = "<#{ tag }>#{ $2 }</#{ tag }>\n\n", $'
734 blocks cont
734 blocks cont
735 text.replace( blk + cont )
735 text.replace( blk + cont )
736 end
736 end
737 end
737 end
738
738
739 MARKDOWN_BQ_RE = /\A(^ *> ?.+$(.+\n)*\n*)+/m
739 MARKDOWN_BQ_RE = /\A(^ *> ?.+$(.+\n)*\n*)+/m
740
740
741 def block_markdown_bq( text )
741 def block_markdown_bq( text )
742 text.gsub!( MARKDOWN_BQ_RE ) do |blk|
742 text.gsub!( MARKDOWN_BQ_RE ) do |blk|
743 blk.gsub!( /^ *> ?/, '' )
743 blk.gsub!( /^ *> ?/, '' )
744 flush_left blk
744 flush_left blk
745 blocks blk
745 blocks blk
746 blk.gsub!( /^(\S)/, "\t\\1" )
746 blk.gsub!( /^(\S)/, "\t\\1" )
747 "<blockquote>\n#{ blk }\n</blockquote>\n\n"
747 "<blockquote>\n#{ blk }\n</blockquote>\n\n"
748 end
748 end
749 end
749 end
750
750
751 MARKDOWN_RULE_RE = /^(#{
751 MARKDOWN_RULE_RE = /^(#{
752 ['*', '-', '_'].collect { |ch| ' ?(' + Regexp::quote( ch ) + ' ?){3,}' }.join( '|' )
752 ['*', '-', '_'].collect { |ch| ' ?(' + Regexp::quote( ch ) + ' ?){3,}' }.join( '|' )
753 })$/
753 })$/
754
754
755 def block_markdown_rule( text )
755 def block_markdown_rule( text )
756 text.gsub!( MARKDOWN_RULE_RE ) do |blk|
756 text.gsub!( MARKDOWN_RULE_RE ) do |blk|
757 "<hr />"
757 "<hr />"
758 end
758 end
759 end
759 end
760
760
761 # XXX TODO XXX
761 # XXX TODO XXX
762 def block_markdown_lists( text )
762 def block_markdown_lists( text )
763 end
763 end
764
764
765 def inline_textile_span( text )
765 def inline_textile_span( text )
766 QTAGS.each do |qtag_rc, ht, qtag_re, rtype|
766 QTAGS.each do |qtag_rc, ht, qtag_re, rtype|
767 text.gsub!( qtag_re ) do |m|
767 text.gsub!( qtag_re ) do |m|
768
768
769 case rtype
769 case rtype
770 when :limit
770 when :limit
771 sta,qtag,atts,cite,content = $~[1..5]
771 sta,qtag,atts,cite,content = $~[1..5]
772 else
772 else
773 qtag,atts,cite,content = $~[1..4]
773 qtag,atts,cite,content = $~[1..4]
774 sta = ''
774 sta = ''
775 end
775 end
776 atts = pba( atts )
776 atts = pba( atts )
777 atts << " cite=\"#{ cite }\"" if cite
777 atts << " cite=\"#{ cite }\"" if cite
778 atts = shelve( atts ) if atts
778 atts = shelve( atts ) if atts
779
779
780 "#{ sta }<#{ ht }#{ atts }>#{ content }</#{ ht }>"
780 "#{ sta }<#{ ht }#{ atts }>#{ content }</#{ ht }>"
781
781
782 end
782 end
783 end
783 end
784 end
784 end
785
785
786 LINK_RE = /
786 LINK_RE = /
787 ([\s\[{(]|[#{PUNCT}])? # $pre
787 ([\s\[{(]|[#{PUNCT}])? # $pre
788 " # start
788 " # start
789 (#{C}) # $atts
789 (#{C}) # $atts
790 ([^"\n]+?) # $text
790 ([^"\n]+?) # $text
791 \s?
791 \s?
792 (?:\(([^)]+?)\)(?="))? # $title
792 (?:\(([^)]+?)\)(?="))? # $title
793 ":
793 ":
794 ( # $url
794 ( # $url
795 (\/|[a-zA-Z]+:\/\/|www\.) # $proto
795 (\/|[a-zA-Z]+:\/\/|www\.|mailto:) # $proto
796 [\w\/]\S+?
796 [\w\/]\S+?
797 )
797 )
798 (\/)? # $slash
798 (\/)? # $slash
799 ([^\w\=\/;\(\)]*?) # $post
799 ([^\w\=\/;\(\)]*?) # $post
800 (?=<|\s|$)
800 (?=<|\s|$)
801 /x
801 /x
802 #"
802 #"
803 def inline_textile_link( text )
803 def inline_textile_link( text )
804 text.gsub!( LINK_RE ) do |m|
804 text.gsub!( LINK_RE ) do |m|
805 pre,atts,text,title,url,proto,slash,post = $~[1..8]
805 pre,atts,text,title,url,proto,slash,post = $~[1..8]
806
806
807 url, url_title = check_refs( url )
807 url, url_title = check_refs( url )
808 title ||= url_title
808 title ||= url_title
809
809
810 # Idea below : an URL with unbalanced parethesis and
810 # Idea below : an URL with unbalanced parethesis and
811 # ending by ')' is put into external parenthesis
811 # ending by ')' is put into external parenthesis
812 if ( url[-1]==?) and ((url.count("(") - url.count(")")) < 0 ) )
812 if ( url[-1]==?) and ((url.count("(") - url.count(")")) < 0 ) )
813 url=url[0..-2] # discard closing parenth from url
813 url=url[0..-2] # discard closing parenth from url
814 post = ")"+post # add closing parenth to post
814 post = ")"+post # add closing parenth to post
815 end
815 end
816 atts = pba( atts )
816 atts = pba( atts )
817 atts = " href=\"#{ url }#{ slash }\"#{ atts }"
817 atts = " href=\"#{ url }#{ slash }\"#{ atts }"
818 atts << " title=\"#{ htmlesc title }\"" if title
818 atts << " title=\"#{ htmlesc title }\"" if title
819 atts = shelve( atts ) if atts
819 atts = shelve( atts ) if atts
820
820
821 external = (url =~ /^https?:\/\//) ? ' class="external"' : ''
821 external = (url =~ /^https?:\/\//) ? ' class="external"' : ''
822
822
823 "#{ pre }<a#{ atts }#{ external }>#{ text }</a>#{ post }"
823 "#{ pre }<a#{ atts }#{ external }>#{ text }</a>#{ post }"
824 end
824 end
825 end
825 end
826
826
827 MARKDOWN_REFLINK_RE = /
827 MARKDOWN_REFLINK_RE = /
828 \[([^\[\]]+)\] # $text
828 \[([^\[\]]+)\] # $text
829 [ ]? # opt. space
829 [ ]? # opt. space
830 (?:\n[ ]*)? # one optional newline followed by spaces
830 (?:\n[ ]*)? # one optional newline followed by spaces
831 \[(.*?)\] # $id
831 \[(.*?)\] # $id
832 /x
832 /x
833
833
834 def inline_markdown_reflink( text )
834 def inline_markdown_reflink( text )
835 text.gsub!( MARKDOWN_REFLINK_RE ) do |m|
835 text.gsub!( MARKDOWN_REFLINK_RE ) do |m|
836 text, id = $~[1..2]
836 text, id = $~[1..2]
837
837
838 if id.empty?
838 if id.empty?
839 url, title = check_refs( text )
839 url, title = check_refs( text )
840 else
840 else
841 url, title = check_refs( id )
841 url, title = check_refs( id )
842 end
842 end
843
843
844 atts = " href=\"#{ url }\""
844 atts = " href=\"#{ url }\""
845 atts << " title=\"#{ title }\"" if title
845 atts << " title=\"#{ title }\"" if title
846 atts = shelve( atts )
846 atts = shelve( atts )
847
847
848 "<a#{ atts }>#{ text }</a>"
848 "<a#{ atts }>#{ text }</a>"
849 end
849 end
850 end
850 end
851
851
852 MARKDOWN_LINK_RE = /
852 MARKDOWN_LINK_RE = /
853 \[([^\[\]]+)\] # $text
853 \[([^\[\]]+)\] # $text
854 \( # open paren
854 \( # open paren
855 [ \t]* # opt space
855 [ \t]* # opt space
856 <?(.+?)>? # $href
856 <?(.+?)>? # $href
857 [ \t]* # opt space
857 [ \t]* # opt space
858 (?: # whole title
858 (?: # whole title
859 (['"]) # $quote
859 (['"]) # $quote
860 (.*?) # $title
860 (.*?) # $title
861 \3 # matching quote
861 \3 # matching quote
862 )? # title is optional
862 )? # title is optional
863 \)
863 \)
864 /x
864 /x
865
865
866 def inline_markdown_link( text )
866 def inline_markdown_link( text )
867 text.gsub!( MARKDOWN_LINK_RE ) do |m|
867 text.gsub!( MARKDOWN_LINK_RE ) do |m|
868 text, url, quote, title = $~[1..4]
868 text, url, quote, title = $~[1..4]
869
869
870 atts = " href=\"#{ url }\""
870 atts = " href=\"#{ url }\""
871 atts << " title=\"#{ title }\"" if title
871 atts << " title=\"#{ title }\"" if title
872 atts = shelve( atts )
872 atts = shelve( atts )
873
873
874 "<a#{ atts }>#{ text }</a>"
874 "<a#{ atts }>#{ text }</a>"
875 end
875 end
876 end
876 end
877
877
878 TEXTILE_REFS_RE = /(^ *)\[([^\[\n]+?)\](#{HYPERLINK})(?=\s|$)/
878 TEXTILE_REFS_RE = /(^ *)\[([^\[\n]+?)\](#{HYPERLINK})(?=\s|$)/
879 MARKDOWN_REFS_RE = /(^ *)\[([^\n]+?)\]:\s+<?(#{HYPERLINK})>?(?:\s+"((?:[^"]|\\")+)")?(?=\s|$)/m
879 MARKDOWN_REFS_RE = /(^ *)\[([^\n]+?)\]:\s+<?(#{HYPERLINK})>?(?:\s+"((?:[^"]|\\")+)")?(?=\s|$)/m
880
880
881 def refs( text )
881 def refs( text )
882 @rules.each do |rule_name|
882 @rules.each do |rule_name|
883 method( rule_name ).call( text ) if rule_name.to_s.match /^refs_/
883 method( rule_name ).call( text ) if rule_name.to_s.match /^refs_/
884 end
884 end
885 end
885 end
886
886
887 def refs_textile( text )
887 def refs_textile( text )
888 text.gsub!( TEXTILE_REFS_RE ) do |m|
888 text.gsub!( TEXTILE_REFS_RE ) do |m|
889 flag, url = $~[2..3]
889 flag, url = $~[2..3]
890 @urlrefs[flag.downcase] = [url, nil]
890 @urlrefs[flag.downcase] = [url, nil]
891 nil
891 nil
892 end
892 end
893 end
893 end
894
894
895 def refs_markdown( text )
895 def refs_markdown( text )
896 text.gsub!( MARKDOWN_REFS_RE ) do |m|
896 text.gsub!( MARKDOWN_REFS_RE ) do |m|
897 flag, url = $~[2..3]
897 flag, url = $~[2..3]
898 title = $~[6]
898 title = $~[6]
899 @urlrefs[flag.downcase] = [url, title]
899 @urlrefs[flag.downcase] = [url, title]
900 nil
900 nil
901 end
901 end
902 end
902 end
903
903
904 def check_refs( text )
904 def check_refs( text )
905 ret = @urlrefs[text.downcase] if text
905 ret = @urlrefs[text.downcase] if text
906 ret || [text, nil]
906 ret || [text, nil]
907 end
907 end
908
908
909 IMAGE_RE = /
909 IMAGE_RE = /
910 (<p>|.|^) # start of line?
910 (<p>|\s|^) # start of line?
911 \! # opening
911 \! # opening
912 (\<|\=|\>)? # optional alignment atts
912 (\<|\=|\>)? # optional alignment atts
913 (#{C}) # optional style,class atts
913 (#{C}) # optional style,class atts
914 (?:\. )? # optional dot-space
914 (?:\. )? # optional dot-space
915 ([^\s(!]+?) # presume this is the src
915 ([^\s(!]+?) # presume this is the src
916 \s? # optional space
916 \s? # optional space
917 (?:\(((?:[^\(\)]|\([^\)]+\))+?)\))? # optional title
917 (?:\(((?:[^\(\)]|\([^\)]+\))+?)\))? # optional title
918 \! # closing
918 \! # closing
919 (?::#{ HYPERLINK })? # optional href
919 (?::#{ HYPERLINK })? # optional href
920 /x
920 /x
921
921
922 def inline_textile_image( text )
922 def inline_textile_image( text )
923 text.gsub!( IMAGE_RE ) do |m|
923 text.gsub!( IMAGE_RE ) do |m|
924 stln,algn,atts,url,title,href,href_a1,href_a2 = $~[1..8]
924 stln,algn,atts,url,title,href,href_a1,href_a2 = $~[1..8]
925 htmlesc title
925 htmlesc title
926 atts = pba( atts )
926 atts = pba( atts )
927 atts = " src=\"#{ url }\"#{ atts }"
927 atts = " src=\"#{ url }\"#{ atts }"
928 atts << " title=\"#{ title }\"" if title
928 atts << " title=\"#{ title }\"" if title
929 atts << " alt=\"#{ title }\""
929 atts << " alt=\"#{ title }\""
930 # size = @getimagesize($url);
930 # size = @getimagesize($url);
931 # if($size) $atts.= " $size[3]";
931 # if($size) $atts.= " $size[3]";
932
932
933 href, alt_title = check_refs( href ) if href
933 href, alt_title = check_refs( href ) if href
934 url, url_title = check_refs( url )
934 url, url_title = check_refs( url )
935
935
936 out = ''
936 out = ''
937 out << "<a#{ shelve( " href=\"#{ href }\"" ) }>" if href
937 out << "<a#{ shelve( " href=\"#{ href }\"" ) }>" if href
938 out << "<img#{ shelve( atts ) } />"
938 out << "<img#{ shelve( atts ) } />"
939 out << "</a>#{ href_a1 }#{ href_a2 }" if href
939 out << "</a>#{ href_a1 }#{ href_a2 }" if href
940
940
941 if algn
941 if algn
942 algn = h_align( algn )
942 algn = h_align( algn )
943 if stln == "<p>"
943 if stln == "<p>"
944 out = "<p style=\"float:#{ algn }\">#{ out }"
944 out = "<p style=\"float:#{ algn }\">#{ out }"
945 else
945 else
946 out = "#{ stln }<div style=\"float:#{ algn }\">#{ out }</div>"
946 out = "#{ stln }<div style=\"float:#{ algn }\">#{ out }</div>"
947 end
947 end
948 else
948 else
949 out = stln + out
949 out = stln + out
950 end
950 end
951
951
952 out
952 out
953 end
953 end
954 end
954 end
955
955
956 def shelve( val )
956 def shelve( val )
957 @shelf << val
957 @shelf << val
958 " :redsh##{ @shelf.length }:"
958 " :redsh##{ @shelf.length }:"
959 end
959 end
960
960
961 def retrieve( text )
961 def retrieve( text )
962 @shelf.each_with_index do |r, i|
962 @shelf.each_with_index do |r, i|
963 text.gsub!( " :redsh##{ i + 1 }:", r )
963 text.gsub!( " :redsh##{ i + 1 }:", r )
964 end
964 end
965 end
965 end
966
966
967 def incoming_entities( text )
967 def incoming_entities( text )
968 ## turn any incoming ampersands into a dummy character for now.
968 ## turn any incoming ampersands into a dummy character for now.
969 ## This uses a negative lookahead for alphanumerics followed by a semicolon,
969 ## This uses a negative lookahead for alphanumerics followed by a semicolon,
970 ## implying an incoming html entity, to be skipped
970 ## implying an incoming html entity, to be skipped
971
971
972 text.gsub!( /&(?![#a-z0-9]+;)/i, "x%x%" )
972 text.gsub!( /&(?![#a-z0-9]+;)/i, "x%x%" )
973 end
973 end
974
974
975 def no_textile( text )
975 def no_textile( text )
976 text.gsub!( /(^|\s)==([^=]+.*?)==(\s|$)?/,
976 text.gsub!( /(^|\s)==([^=]+.*?)==(\s|$)?/,
977 '\1<notextile>\2</notextile>\3' )
977 '\1<notextile>\2</notextile>\3' )
978 text.gsub!( /^ *==([^=]+.*?)==/m,
978 text.gsub!( /^ *==([^=]+.*?)==/m,
979 '\1<notextile>\2</notextile>\3' )
979 '\1<notextile>\2</notextile>\3' )
980 end
980 end
981
981
982 def clean_white_space( text )
982 def clean_white_space( text )
983 # normalize line breaks
983 # normalize line breaks
984 text.gsub!( /\r\n/, "\n" )
984 text.gsub!( /\r\n/, "\n" )
985 text.gsub!( /\r/, "\n" )
985 text.gsub!( /\r/, "\n" )
986 text.gsub!( /\t/, ' ' )
986 text.gsub!( /\t/, ' ' )
987 text.gsub!( /^ +$/, '' )
987 text.gsub!( /^ +$/, '' )
988 text.gsub!( /\n{3,}/, "\n\n" )
988 text.gsub!( /\n{3,}/, "\n\n" )
989 text.gsub!( /"$/, "\" " )
989 text.gsub!( /"$/, "\" " )
990
990
991 # if entire document is indented, flush
991 # if entire document is indented, flush
992 # to the left side
992 # to the left side
993 flush_left text
993 flush_left text
994 end
994 end
995
995
996 def flush_left( text )
996 def flush_left( text )
997 indt = 0
997 indt = 0
998 if text =~ /^ /
998 if text =~ /^ /
999 while text !~ /^ {#{indt}}\S/
999 while text !~ /^ {#{indt}}\S/
1000 indt += 1
1000 indt += 1
1001 end unless text.empty?
1001 end unless text.empty?
1002 if indt.nonzero?
1002 if indt.nonzero?
1003 text.gsub!( /^ {#{indt}}/, '' )
1003 text.gsub!( /^ {#{indt}}/, '' )
1004 end
1004 end
1005 end
1005 end
1006 end
1006 end
1007
1007
1008 def footnote_ref( text )
1008 def footnote_ref( text )
1009 text.gsub!( /\b\[([0-9]+?)\](\s)?/,
1009 text.gsub!( /\b\[([0-9]+?)\](\s)?/,
1010 '<sup><a href="#fn\1">\1</a></sup>\2' )
1010 '<sup><a href="#fn\1">\1</a></sup>\2' )
1011 end
1011 end
1012
1012
1013 OFFTAGS = /(code|pre|kbd|notextile)/
1013 OFFTAGS = /(code|pre|kbd|notextile)/
1014 OFFTAG_MATCH = /(?:(<\/#{ OFFTAGS }>)|(<#{ OFFTAGS }[^>]*>))(.*?)(?=<\/?#{ OFFTAGS }|\Z)/mi
1014 OFFTAG_MATCH = /(?:(<\/#{ OFFTAGS }>)|(<#{ OFFTAGS }[^>]*>))(.*?)(?=<\/?#{ OFFTAGS }|\Z)/mi
1015 OFFTAG_OPEN = /<#{ OFFTAGS }/
1015 OFFTAG_OPEN = /<#{ OFFTAGS }/
1016 OFFTAG_CLOSE = /<\/?#{ OFFTAGS }/
1016 OFFTAG_CLOSE = /<\/?#{ OFFTAGS }/
1017 HASTAG_MATCH = /(<\/?\w[^\n]*?>)/m
1017 HASTAG_MATCH = /(<\/?\w[^\n]*?>)/m
1018 ALLTAG_MATCH = /(<\/?\w[^\n]*?>)|.*?(?=<\/?\w[^\n]*?>|$)/m
1018 ALLTAG_MATCH = /(<\/?\w[^\n]*?>)|.*?(?=<\/?\w[^\n]*?>|$)/m
1019
1019
1020 def glyphs_textile( text, level = 0 )
1020 def glyphs_textile( text, level = 0 )
1021 if text !~ HASTAG_MATCH
1021 if text !~ HASTAG_MATCH
1022 pgl text
1022 pgl text
1023 footnote_ref text
1023 footnote_ref text
1024 else
1024 else
1025 codepre = 0
1025 codepre = 0
1026 text.gsub!( ALLTAG_MATCH ) do |line|
1026 text.gsub!( ALLTAG_MATCH ) do |line|
1027 ## matches are off if we're between <code>, <pre> etc.
1027 ## matches are off if we're between <code>, <pre> etc.
1028 if $1
1028 if $1
1029 if line =~ OFFTAG_OPEN
1029 if line =~ OFFTAG_OPEN
1030 codepre += 1
1030 codepre += 1
1031 elsif line =~ OFFTAG_CLOSE
1031 elsif line =~ OFFTAG_CLOSE
1032 codepre -= 1
1032 codepre -= 1
1033 codepre = 0 if codepre < 0
1033 codepre = 0 if codepre < 0
1034 end
1034 end
1035 elsif codepre.zero?
1035 elsif codepre.zero?
1036 glyphs_textile( line, level + 1 )
1036 glyphs_textile( line, level + 1 )
1037 else
1037 else
1038 htmlesc( line, :NoQuotes )
1038 htmlesc( line, :NoQuotes )
1039 end
1039 end
1040 # p [level, codepre, line]
1040 # p [level, codepre, line]
1041
1041
1042 line
1042 line
1043 end
1043 end
1044 end
1044 end
1045 end
1045 end
1046
1046
1047 def rip_offtags( text )
1047 def rip_offtags( text )
1048 if text =~ /<.*>/
1048 if text =~ /<.*>/
1049 ## strip and encode <pre> content
1049 ## strip and encode <pre> content
1050 codepre, used_offtags = 0, {}
1050 codepre, used_offtags = 0, {}
1051 text.gsub!( OFFTAG_MATCH ) do |line|
1051 text.gsub!( OFFTAG_MATCH ) do |line|
1052 if $3
1052 if $3
1053 offtag, aftertag = $4, $5
1053 offtag, aftertag = $4, $5
1054 codepre += 1
1054 codepre += 1
1055 used_offtags[offtag] = true
1055 used_offtags[offtag] = true
1056 if codepre - used_offtags.length > 0
1056 if codepre - used_offtags.length > 0
1057 htmlesc( line, :NoQuotes )
1057 htmlesc( line, :NoQuotes )
1058 @pre_list.last << line
1058 @pre_list.last << line
1059 line = ""
1059 line = ""
1060 else
1060 else
1061 htmlesc( aftertag, :NoQuotes ) if aftertag
1061 htmlesc( aftertag, :NoQuotes ) if aftertag
1062 line = "<redpre##{ @pre_list.length }>"
1062 line = "<redpre##{ @pre_list.length }>"
1063 $3.match(/<#{ OFFTAGS }([^>]*)>/)
1063 $3.match(/<#{ OFFTAGS }([^>]*)>/)
1064 tag = $1
1064 tag = $1
1065 $2.to_s.match(/(class\=\S+)/i)
1065 $2.to_s.match(/(class\=\S+)/i)
1066 tag << " #{$1}" if $1
1066 tag << " #{$1}" if $1
1067 @pre_list << "<#{ tag }>#{ aftertag }"
1067 @pre_list << "<#{ tag }>#{ aftertag }"
1068 end
1068 end
1069 elsif $1 and codepre > 0
1069 elsif $1 and codepre > 0
1070 if codepre - used_offtags.length > 0
1070 if codepre - used_offtags.length > 0
1071 htmlesc( line, :NoQuotes )
1071 htmlesc( line, :NoQuotes )
1072 @pre_list.last << line
1072 @pre_list.last << line
1073 line = ""
1073 line = ""
1074 end
1074 end
1075 codepre -= 1 unless codepre.zero?
1075 codepre -= 1 unless codepre.zero?
1076 used_offtags = {} if codepre.zero?
1076 used_offtags = {} if codepre.zero?
1077 end
1077 end
1078 line
1078 line
1079 end
1079 end
1080 end
1080 end
1081 text
1081 text
1082 end
1082 end
1083
1083
1084 def smooth_offtags( text )
1084 def smooth_offtags( text )
1085 unless @pre_list.empty?
1085 unless @pre_list.empty?
1086 ## replace <pre> content
1086 ## replace <pre> content
1087 text.gsub!( /<redpre#(\d+)>/ ) { @pre_list[$1.to_i] }
1087 text.gsub!( /<redpre#(\d+)>/ ) { @pre_list[$1.to_i] }
1088 end
1088 end
1089 end
1089 end
1090
1090
1091 def inline( text )
1091 def inline( text )
1092 [/^inline_/, /^glyphs_/].each do |meth_re|
1092 [/^inline_/, /^glyphs_/].each do |meth_re|
1093 @rules.each do |rule_name|
1093 @rules.each do |rule_name|
1094 method( rule_name ).call( text ) if rule_name.to_s.match( meth_re )
1094 method( rule_name ).call( text ) if rule_name.to_s.match( meth_re )
1095 end
1095 end
1096 end
1096 end
1097 end
1097 end
1098
1098
1099 def h_align( text )
1099 def h_align( text )
1100 H_ALGN_VALS[text]
1100 H_ALGN_VALS[text]
1101 end
1101 end
1102
1102
1103 def v_align( text )
1103 def v_align( text )
1104 V_ALGN_VALS[text]
1104 V_ALGN_VALS[text]
1105 end
1105 end
1106
1106
1107 def textile_popup_help( name, windowW, windowH )
1107 def textile_popup_help( name, windowW, windowH )
1108 ' <a target="_blank" href="http://hobix.com/textile/#' + helpvar + '" onclick="window.open(this.href, \'popupwindow\', \'width=' + windowW + ',height=' + windowH + ',scrollbars,resizable\'); return false;">' + name + '</a><br />'
1108 ' <a target="_blank" href="http://hobix.com/textile/#' + helpvar + '" onclick="window.open(this.href, \'popupwindow\', \'width=' + windowW + ',height=' + windowH + ',scrollbars,resizable\'); return false;">' + name + '</a><br />'
1109 end
1109 end
1110
1110
1111 # HTML cleansing stuff
1111 # HTML cleansing stuff
1112 BASIC_TAGS = {
1112 BASIC_TAGS = {
1113 'a' => ['href', 'title'],
1113 'a' => ['href', 'title'],
1114 'img' => ['src', 'alt', 'title'],
1114 'img' => ['src', 'alt', 'title'],
1115 'br' => [],
1115 'br' => [],
1116 'i' => nil,
1116 'i' => nil,
1117 'u' => nil,
1117 'u' => nil,
1118 'b' => nil,
1118 'b' => nil,
1119 'pre' => nil,
1119 'pre' => nil,
1120 'kbd' => nil,
1120 'kbd' => nil,
1121 'code' => ['lang'],
1121 'code' => ['lang'],
1122 'cite' => nil,
1122 'cite' => nil,
1123 'strong' => nil,
1123 'strong' => nil,
1124 'em' => nil,
1124 'em' => nil,
1125 'ins' => nil,
1125 'ins' => nil,
1126 'sup' => nil,
1126 'sup' => nil,
1127 'sub' => nil,
1127 'sub' => nil,
1128 'del' => nil,
1128 'del' => nil,
1129 'table' => nil,
1129 'table' => nil,
1130 'tr' => nil,
1130 'tr' => nil,
1131 'td' => ['colspan', 'rowspan'],
1131 'td' => ['colspan', 'rowspan'],
1132 'th' => nil,
1132 'th' => nil,
1133 'ol' => nil,
1133 'ol' => nil,
1134 'ul' => nil,
1134 'ul' => nil,
1135 'li' => nil,
1135 'li' => nil,
1136 'p' => nil,
1136 'p' => nil,
1137 'h1' => nil,
1137 'h1' => nil,
1138 'h2' => nil,
1138 'h2' => nil,
1139 'h3' => nil,
1139 'h3' => nil,
1140 'h4' => nil,
1140 'h4' => nil,
1141 'h5' => nil,
1141 'h5' => nil,
1142 'h6' => nil,
1142 'h6' => nil,
1143 'blockquote' => ['cite']
1143 'blockquote' => ['cite']
1144 }
1144 }
1145
1145
1146 def clean_html( text, tags = BASIC_TAGS )
1146 def clean_html( text, tags = BASIC_TAGS )
1147 text.gsub!( /<!\[CDATA\[/, '' )
1147 text.gsub!( /<!\[CDATA\[/, '' )
1148 text.gsub!( /<(\/*)(\w+)([^>]*)>/ ) do
1148 text.gsub!( /<(\/*)(\w+)([^>]*)>/ ) do
1149 raw = $~
1149 raw = $~
1150 tag = raw[2].downcase
1150 tag = raw[2].downcase
1151 if tags.has_key? tag
1151 if tags.has_key? tag
1152 pcs = [tag]
1152 pcs = [tag]
1153 tags[tag].each do |prop|
1153 tags[tag].each do |prop|
1154 ['"', "'", ''].each do |q|
1154 ['"', "'", ''].each do |q|
1155 q2 = ( q != '' ? q : '\s' )
1155 q2 = ( q != '' ? q : '\s' )
1156 if raw[3] =~ /#{prop}\s*=\s*#{q}([^#{q2}]+)#{q}/i
1156 if raw[3] =~ /#{prop}\s*=\s*#{q}([^#{q2}]+)#{q}/i
1157 attrv = $1
1157 attrv = $1
1158 next if prop == 'src' and attrv =~ %r{^(?!http)\w+:}
1158 next if prop == 'src' and attrv =~ %r{^(?!http)\w+:}
1159 pcs << "#{prop}=\"#{$1.gsub('"', '\\"')}\""
1159 pcs << "#{prop}=\"#{$1.gsub('"', '\\"')}\""
1160 break
1160 break
1161 end
1161 end
1162 end
1162 end
1163 end if tags[tag]
1163 end if tags[tag]
1164 "<#{raw[1]}#{pcs.join " "}>"
1164 "<#{raw[1]}#{pcs.join " "}>"
1165 else
1165 else
1166 " "
1166 " "
1167 end
1167 end
1168 end
1168 end
1169 end
1169 end
1170
1170
1171 ALLOWED_TAGS = %w(redpre pre code notextile)
1171 ALLOWED_TAGS = %w(redpre pre code notextile)
1172
1172
1173 def escape_html_tags(text)
1173 def escape_html_tags(text)
1174 text.gsub!(%r{<(\/?([!\w]+)[^<>\n]*)(>?)}) {|m| ALLOWED_TAGS.include?($2) ? "<#{$1}#{$3}" : "&lt;#{$1}#{'&gt;' unless $3.blank?}" }
1174 text.gsub!(%r{<(\/?([!\w]+)[^<>\n]*)(>?)}) {|m| ALLOWED_TAGS.include?($2) ? "<#{$1}#{$3}" : "&lt;#{$1}#{'&gt;' unless $3.blank?}" }
1175 end
1175 end
1176 end
1176 end
1177
1177
@@ -1,205 +1,205
1 # redMine - project management software
1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 require 'redmine/scm/adapters/abstract_adapter'
18 require 'redmine/scm/adapters/abstract_adapter'
19
19
20 module Redmine
20 module Redmine
21 module Scm
21 module Scm
22 module Adapters
22 module Adapters
23 class MercurialAdapter < AbstractAdapter
23 class MercurialAdapter < AbstractAdapter
24
24
25 # Mercurial executable name
25 # Mercurial executable name
26 HG_BIN = "hg"
26 HG_BIN = "hg"
27 TEMPLATES_DIR = File.dirname(__FILE__) + "/mercurial"
27 TEMPLATES_DIR = File.dirname(__FILE__) + "/mercurial"
28 TEMPLATE_NAME = "hg-template"
28 TEMPLATE_NAME = "hg-template"
29 TEMPLATE_EXTENSION = "tmpl"
29 TEMPLATE_EXTENSION = "tmpl"
30
30
31 class << self
31 class << self
32 def client_version
32 def client_version
33 @@client_version ||= (hgversion || [])
33 @@client_version ||= (hgversion || [])
34 end
34 end
35
35
36 def hgversion
36 def hgversion
37 # The hg version is expressed either as a
37 # The hg version is expressed either as a
38 # release number (eg 0.9.5 or 1.0) or as a revision
38 # release number (eg 0.9.5 or 1.0) or as a revision
39 # id composed of 12 hexa characters.
39 # id composed of 12 hexa characters.
40 theversion = hgversion_from_command_line
40 theversion = hgversion_from_command_line
41 if theversion.match(/^\d+(\.\d+)+/)
41 if theversion.match(/^\d+(\.\d+)+/)
42 theversion.split(".").collect(&:to_i)
42 theversion.split(".").collect(&:to_i)
43 end
43 end
44 end
44 end
45
45
46 def hgversion_from_command_line
46 def hgversion_from_command_line
47 %x{#{HG_BIN} --version}.match(/\(version (.*)\)/)[1]
47 %x{#{HG_BIN} --version}.match(/\(version (.*)\)/)[1]
48 end
48 end
49
49
50 def template_path
50 def template_path
51 @@template_path ||= template_path_for(client_version)
51 @@template_path ||= template_path_for(client_version)
52 end
52 end
53
53
54 def template_path_for(version)
54 def template_path_for(version)
55 if ((version <=> [0,9,5]) > 0) || version.empty?
55 if ((version <=> [0,9,5]) > 0) || version.empty?
56 ver = "1.0"
56 ver = "1.0"
57 else
57 else
58 ver = "0.9.5"
58 ver = "0.9.5"
59 end
59 end
60 "#{TEMPLATES_DIR}/#{TEMPLATE_NAME}-#{ver}.#{TEMPLATE_EXTENSION}"
60 "#{TEMPLATES_DIR}/#{TEMPLATE_NAME}-#{ver}.#{TEMPLATE_EXTENSION}"
61 end
61 end
62 end
62 end
63
63
64 def info
64 def info
65 cmd = "#{HG_BIN} -R #{target('')} root"
65 cmd = "#{HG_BIN} -R #{target('')} root"
66 root_url = nil
66 root_url = nil
67 shellout(cmd) do |io|
67 shellout(cmd) do |io|
68 root_url = io.gets
68 root_url = io.gets
69 end
69 end
70 return nil if $? && $?.exitstatus != 0
70 return nil if $? && $?.exitstatus != 0
71 info = Info.new({:root_url => root_url.chomp,
71 info = Info.new({:root_url => root_url.chomp,
72 :lastrev => revisions(nil,nil,nil,{:limit => 1}).last
72 :lastrev => revisions(nil,nil,nil,{:limit => 1}).last
73 })
73 })
74 info
74 info
75 rescue CommandFailed
75 rescue CommandFailed
76 return nil
76 return nil
77 end
77 end
78
78
79 def entries(path=nil, identifier=nil)
79 def entries(path=nil, identifier=nil)
80 path ||= ''
80 path ||= ''
81 entries = Entries.new
81 entries = Entries.new
82 cmd = "#{HG_BIN} -R #{target('')} --cwd #{target('')} locate"
82 cmd = "#{HG_BIN} -R #{target('')} --cwd #{target('')} locate"
83 cmd << " -r " + (identifier ? identifier.to_s : "tip")
83 cmd << " -r " + (identifier ? identifier.to_s : "tip")
84 cmd << " " + shell_quote("path:#{path}") unless path.empty?
84 cmd << " " + shell_quote("path:#{path}") unless path.empty?
85 shellout(cmd) do |io|
85 shellout(cmd) do |io|
86 io.each_line do |line|
86 io.each_line do |line|
87 # HG uses antislashs as separator on Windows
87 # HG uses antislashs as separator on Windows
88 line = line.gsub(/\\/, "/")
88 line = line.gsub(/\\/, "/")
89 if path.empty? or e = line.gsub!(%r{^#{with_trailling_slash(path)}},'')
89 if path.empty? or e = line.gsub!(%r{^#{with_trailling_slash(path)}},'')
90 e ||= line
90 e ||= line
91 e = e.chomp.split(%r{[\/\\]})
91 e = e.chomp.split(%r{[\/\\]})
92 entries << Entry.new({:name => e.first,
92 entries << Entry.new({:name => e.first,
93 :path => (path.nil? or path.empty? ? e.first : "#{with_trailling_slash(path)}#{e.first}"),
93 :path => (path.nil? or path.empty? ? e.first : "#{with_trailling_slash(path)}#{e.first}"),
94 :kind => (e.size > 1 ? 'dir' : 'file'),
94 :kind => (e.size > 1 ? 'dir' : 'file'),
95 :lastrev => Revision.new
95 :lastrev => Revision.new
96 }) unless entries.detect{|entry| entry.name == e.first}
96 }) unless entries.detect{|entry| entry.name == e.first}
97 end
97 end
98 end
98 end
99 end
99 end
100 return nil if $? && $?.exitstatus != 0
100 return nil if $? && $?.exitstatus != 0
101 entries.sort_by_name
101 entries.sort_by_name
102 end
102 end
103
103
104 # Fetch the revisions by using a template file that
104 # Fetch the revisions by using a template file that
105 # makes Mercurial produce a xml output.
105 # makes Mercurial produce a xml output.
106 def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={})
106 def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={})
107 revisions = Revisions.new
107 revisions = Revisions.new
108 cmd = "#{HG_BIN} --debug --encoding utf8 -R #{target('')} log -C --style #{self.class.template_path}"
108 cmd = "#{HG_BIN} --debug --encoding utf8 -R #{target('')} log -C --style #{shell_quote self.class.template_path}"
109 if identifier_from && identifier_to
109 if identifier_from && identifier_to
110 cmd << " -r #{identifier_from.to_i}:#{identifier_to.to_i}"
110 cmd << " -r #{identifier_from.to_i}:#{identifier_to.to_i}"
111 elsif identifier_from
111 elsif identifier_from
112 cmd << " -r #{identifier_from.to_i}:"
112 cmd << " -r #{identifier_from.to_i}:"
113 end
113 end
114 cmd << " --limit #{options[:limit].to_i}" if options[:limit]
114 cmd << " --limit #{options[:limit].to_i}" if options[:limit]
115 cmd << " #{path}" if path
115 cmd << " #{path}" if path
116 shellout(cmd) do |io|
116 shellout(cmd) do |io|
117 begin
117 begin
118 # HG doesn't close the XML Document...
118 # HG doesn't close the XML Document...
119 doc = REXML::Document.new(io.read << "</log>")
119 doc = REXML::Document.new(io.read << "</log>")
120 doc.elements.each("log/logentry") do |logentry|
120 doc.elements.each("log/logentry") do |logentry|
121 paths = []
121 paths = []
122 copies = logentry.get_elements('paths/path-copied')
122 copies = logentry.get_elements('paths/path-copied')
123 logentry.elements.each("paths/path") do |path|
123 logentry.elements.each("paths/path") do |path|
124 # Detect if the added file is a copy
124 # Detect if the added file is a copy
125 if path.attributes['action'] == 'A' and c = copies.find{ |e| e.text == path.text }
125 if path.attributes['action'] == 'A' and c = copies.find{ |e| e.text == path.text }
126 from_path = c.attributes['copyfrom-path']
126 from_path = c.attributes['copyfrom-path']
127 from_rev = logentry.attributes['revision']
127 from_rev = logentry.attributes['revision']
128 end
128 end
129 paths << {:action => path.attributes['action'],
129 paths << {:action => path.attributes['action'],
130 :path => "/#{path.text}",
130 :path => "/#{path.text}",
131 :from_path => from_path ? "/#{from_path}" : nil,
131 :from_path => from_path ? "/#{from_path}" : nil,
132 :from_revision => from_rev ? from_rev : nil
132 :from_revision => from_rev ? from_rev : nil
133 }
133 }
134 end
134 end
135 paths.sort! { |x,y| x[:path] <=> y[:path] }
135 paths.sort! { |x,y| x[:path] <=> y[:path] }
136
136
137 revisions << Revision.new({:identifier => logentry.attributes['revision'],
137 revisions << Revision.new({:identifier => logentry.attributes['revision'],
138 :scmid => logentry.attributes['node'],
138 :scmid => logentry.attributes['node'],
139 :author => (logentry.elements['author'] ? logentry.elements['author'].text : ""),
139 :author => (logentry.elements['author'] ? logentry.elements['author'].text : ""),
140 :time => Time.parse(logentry.elements['date'].text).localtime,
140 :time => Time.parse(logentry.elements['date'].text).localtime,
141 :message => logentry.elements['msg'].text,
141 :message => logentry.elements['msg'].text,
142 :paths => paths
142 :paths => paths
143 })
143 })
144 end
144 end
145 rescue
145 rescue
146 logger.debug($!)
146 logger.debug($!)
147 end
147 end
148 end
148 end
149 return nil if $? && $?.exitstatus != 0
149 return nil if $? && $?.exitstatus != 0
150 revisions
150 revisions
151 end
151 end
152
152
153 def diff(path, identifier_from, identifier_to=nil)
153 def diff(path, identifier_from, identifier_to=nil)
154 path ||= ''
154 path ||= ''
155 if identifier_to
155 if identifier_to
156 identifier_to = identifier_to.to_i
156 identifier_to = identifier_to.to_i
157 else
157 else
158 identifier_to = identifier_from.to_i - 1
158 identifier_to = identifier_from.to_i - 1
159 end
159 end
160 cmd = "#{HG_BIN} -R #{target('')} diff -r #{identifier_to} -r #{identifier_from} --nodates"
160 cmd = "#{HG_BIN} -R #{target('')} diff -r #{identifier_to} -r #{identifier_from} --nodates"
161 cmd << " -I #{target(path)}" unless path.empty?
161 cmd << " -I #{target(path)}" unless path.empty?
162 diff = []
162 diff = []
163 shellout(cmd) do |io|
163 shellout(cmd) do |io|
164 io.each_line do |line|
164 io.each_line do |line|
165 diff << line
165 diff << line
166 end
166 end
167 end
167 end
168 return nil if $? && $?.exitstatus != 0
168 return nil if $? && $?.exitstatus != 0
169 diff
169 diff
170 end
170 end
171
171
172 def cat(path, identifier=nil)
172 def cat(path, identifier=nil)
173 cmd = "#{HG_BIN} -R #{target('')} cat"
173 cmd = "#{HG_BIN} -R #{target('')} cat"
174 cmd << " -r " + (identifier ? identifier.to_s : "tip")
174 cmd << " -r " + (identifier ? identifier.to_s : "tip")
175 cmd << " #{target(path)}"
175 cmd << " #{target(path)}"
176 cat = nil
176 cat = nil
177 shellout(cmd) do |io|
177 shellout(cmd) do |io|
178 io.binmode
178 io.binmode
179 cat = io.read
179 cat = io.read
180 end
180 end
181 return nil if $? && $?.exitstatus != 0
181 return nil if $? && $?.exitstatus != 0
182 cat
182 cat
183 end
183 end
184
184
185 def annotate(path, identifier=nil)
185 def annotate(path, identifier=nil)
186 path ||= ''
186 path ||= ''
187 cmd = "#{HG_BIN} -R #{target('')}"
187 cmd = "#{HG_BIN} -R #{target('')}"
188 cmd << " annotate -n -u"
188 cmd << " annotate -n -u"
189 cmd << " -r " + (identifier ? identifier.to_s : "tip")
189 cmd << " -r " + (identifier ? identifier.to_s : "tip")
190 cmd << " -r #{identifier.to_i}" if identifier
190 cmd << " -r #{identifier.to_i}" if identifier
191 cmd << " #{target(path)}"
191 cmd << " #{target(path)}"
192 blame = Annotate.new
192 blame = Annotate.new
193 shellout(cmd) do |io|
193 shellout(cmd) do |io|
194 io.each_line do |line|
194 io.each_line do |line|
195 next unless line =~ %r{^([^:]+)\s(\d+):(.*)$}
195 next unless line =~ %r{^([^:]+)\s(\d+):(.*)$}
196 blame.add_line($3.rstrip, Revision.new(:identifier => $2.to_i, :author => $1.strip))
196 blame.add_line($3.rstrip, Revision.new(:identifier => $2.to_i, :author => $1.strip))
197 end
197 end
198 end
198 end
199 return nil if $? && $?.exitstatus != 0
199 return nil if $? && $?.exitstatus != 0
200 blame
200 blame
201 end
201 end
202 end
202 end
203 end
203 end
204 end
204 end
205 end
205 end
@@ -1,37 +1,46
1 # redMine - project management software
1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 require File.dirname(__FILE__) + '/../test_helper'
18 require File.dirname(__FILE__) + '/../test_helper'
19
19
20 class AttachmentTest < Test::Unit::TestCase
20 class AttachmentTest < Test::Unit::TestCase
21 fixtures :issues, :users
21 fixtures :issues, :users
22
22
23 def setup
23 def setup
24 end
24 end
25
26 def test_create
27 a = Attachment.new(:container => Issue.find(1),
28 :file => test_uploaded_file("testfile.txt", "text/plain"),
29 :author => User.find(1))
30 assert a.save
31 assert_equal 'testfile.txt', a.filename
32 assert_equal 59, a.filesize
33 assert_equal 'text/plain', a.content_type
34 assert_equal 0, a.downloads
35 assert_equal Digest::MD5.hexdigest(test_uploaded_file("testfile.txt", "text/plain").read), a.digest
36 assert File.exist?(a.diskfile)
37 end
25
38
26 def test_diskfilename
39 def test_diskfilename
27 assert Attachment.disk_filename("test_file.txt") =~ /^\d{12}_test_file.txt$/
40 assert Attachment.disk_filename("test_file.txt") =~ /^\d{12}_test_file.txt$/
28 assert_equal 'test_file.txt', Attachment.disk_filename("test_file.txt")[13..-1]
41 assert_equal 'test_file.txt', Attachment.disk_filename("test_file.txt")[13..-1]
29 assert_equal '770c509475505f37c2b8fb6030434d6b.txt', Attachment.disk_filename("test_accentuΓ©.txt")[13..-1]
42 assert_equal '770c509475505f37c2b8fb6030434d6b.txt', Attachment.disk_filename("test_accentuΓ©.txt")[13..-1]
30 assert_equal 'f8139524ebb8f32e51976982cd20a85d', Attachment.disk_filename("test_accentuΓ©")[13..-1]
43 assert_equal 'f8139524ebb8f32e51976982cd20a85d', Attachment.disk_filename("test_accentuΓ©")[13..-1]
31 assert_equal 'cbb5b0f30978ba03731d61f9f6d10011', Attachment.disk_filename("test_accentuΓ©.Γ§a")[13..-1]
44 assert_equal 'cbb5b0f30978ba03731d61f9f6d10011', Attachment.disk_filename("test_accentuΓ©.Γ§a")[13..-1]
32 end
45 end
33
34 def test_digest
35 assert_equal '1478adae0d4eb06d35897518540e25d6', Attachment.digest(Test::Unit::TestCase.fixture_path + "/files/testfile.txt")
36 end
37 end
46 end
@@ -1,449 +1,455
1 # redMine - project management software
1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 require File.dirname(__FILE__) + '/../../test_helper'
18 require File.dirname(__FILE__) + '/../../test_helper'
19
19
20 class ApplicationHelperTest < HelperTestCase
20 class ApplicationHelperTest < HelperTestCase
21 include ApplicationHelper
21 include ApplicationHelper
22 include ActionView::Helpers::TextHelper
22 include ActionView::Helpers::TextHelper
23 fixtures :projects, :roles, :enabled_modules, :users,
23 fixtures :projects, :roles, :enabled_modules, :users,
24 :repositories, :changesets,
24 :repositories, :changesets,
25 :trackers, :issue_statuses, :issues, :versions, :documents,
25 :trackers, :issue_statuses, :issues, :versions, :documents,
26 :wikis, :wiki_pages, :wiki_contents,
26 :wikis, :wiki_pages, :wiki_contents,
27 :boards, :messages,
27 :boards, :messages,
28 :attachments
28 :attachments
29
29
30 def setup
30 def setup
31 super
31 super
32 end
32 end
33
33
34 def test_auto_links
34 def test_auto_links
35 to_test = {
35 to_test = {
36 'http://foo.bar' => '<a class="external" href="http://foo.bar">http://foo.bar</a>',
36 'http://foo.bar' => '<a class="external" href="http://foo.bar">http://foo.bar</a>',
37 'http://foo.bar/~user' => '<a class="external" href="http://foo.bar/~user">http://foo.bar/~user</a>',
37 'http://foo.bar/~user' => '<a class="external" href="http://foo.bar/~user">http://foo.bar/~user</a>',
38 'http://foo.bar.' => '<a class="external" href="http://foo.bar">http://foo.bar</a>.',
38 'http://foo.bar.' => '<a class="external" href="http://foo.bar">http://foo.bar</a>.',
39 'https://foo.bar.' => '<a class="external" href="https://foo.bar">https://foo.bar</a>.',
39 'https://foo.bar.' => '<a class="external" href="https://foo.bar">https://foo.bar</a>.',
40 'This is a link: http://foo.bar.' => 'This is a link: <a class="external" href="http://foo.bar">http://foo.bar</a>.',
40 'This is a link: http://foo.bar.' => 'This is a link: <a class="external" href="http://foo.bar">http://foo.bar</a>.',
41 'A link (eg. http://foo.bar).' => 'A link (eg. <a class="external" href="http://foo.bar">http://foo.bar</a>).',
41 'A link (eg. http://foo.bar).' => 'A link (eg. <a class="external" href="http://foo.bar">http://foo.bar</a>).',
42 'http://foo.bar/foo.bar#foo.bar.' => '<a class="external" href="http://foo.bar/foo.bar#foo.bar">http://foo.bar/foo.bar#foo.bar</a>.',
42 'http://foo.bar/foo.bar#foo.bar.' => '<a class="external" href="http://foo.bar/foo.bar#foo.bar">http://foo.bar/foo.bar#foo.bar</a>.',
43 'http://www.foo.bar/Test_(foobar)' => '<a class="external" href="http://www.foo.bar/Test_(foobar)">http://www.foo.bar/Test_(foobar)</a>',
43 'http://www.foo.bar/Test_(foobar)' => '<a class="external" href="http://www.foo.bar/Test_(foobar)">http://www.foo.bar/Test_(foobar)</a>',
44 '(see inline link : http://www.foo.bar/Test_(foobar))' => '(see inline link : <a class="external" href="http://www.foo.bar/Test_(foobar)">http://www.foo.bar/Test_(foobar)</a>)',
44 '(see inline link : http://www.foo.bar/Test_(foobar))' => '(see inline link : <a class="external" href="http://www.foo.bar/Test_(foobar)">http://www.foo.bar/Test_(foobar)</a>)',
45 '(see inline link : http://www.foo.bar/Test)' => '(see inline link : <a class="external" href="http://www.foo.bar/Test">http://www.foo.bar/Test</a>)',
45 '(see inline link : http://www.foo.bar/Test)' => '(see inline link : <a class="external" href="http://www.foo.bar/Test">http://www.foo.bar/Test</a>)',
46 '(see inline link : http://www.foo.bar/Test).' => '(see inline link : <a class="external" href="http://www.foo.bar/Test">http://www.foo.bar/Test</a>).',
46 '(see inline link : http://www.foo.bar/Test).' => '(see inline link : <a class="external" href="http://www.foo.bar/Test">http://www.foo.bar/Test</a>).',
47 '(see "inline link":http://www.foo.bar/Test_(foobar))' => '(see <a href="http://www.foo.bar/Test_(foobar)" class="external">inline link</a>)',
47 '(see "inline link":http://www.foo.bar/Test_(foobar))' => '(see <a href="http://www.foo.bar/Test_(foobar)" class="external">inline link</a>)',
48 '(see "inline link":http://www.foo.bar/Test)' => '(see <a href="http://www.foo.bar/Test" class="external">inline link</a>)',
48 '(see "inline link":http://www.foo.bar/Test)' => '(see <a href="http://www.foo.bar/Test" class="external">inline link</a>)',
49 '(see "inline link":http://www.foo.bar/Test).' => '(see <a href="http://www.foo.bar/Test" class="external">inline link</a>).',
49 '(see "inline link":http://www.foo.bar/Test).' => '(see <a href="http://www.foo.bar/Test" class="external">inline link</a>).',
50 'www.foo.bar' => '<a class="external" href="http://www.foo.bar">www.foo.bar</a>',
50 'www.foo.bar' => '<a class="external" href="http://www.foo.bar">www.foo.bar</a>',
51 'http://foo.bar/page?p=1&t=z&s=' => '<a class="external" href="http://foo.bar/page?p=1&#38;t=z&#38;s=">http://foo.bar/page?p=1&#38;t=z&#38;s=</a>',
51 'http://foo.bar/page?p=1&t=z&s=' => '<a class="external" href="http://foo.bar/page?p=1&#38;t=z&#38;s=">http://foo.bar/page?p=1&#38;t=z&#38;s=</a>',
52 'http://foo.bar/page#125' => '<a class="external" href="http://foo.bar/page#125">http://foo.bar/page#125</a>',
52 'http://foo.bar/page#125' => '<a class="external" href="http://foo.bar/page#125">http://foo.bar/page#125</a>',
53 'http://foo@www.bar.com' => '<a class="external" href="http://foo@www.bar.com">http://foo@www.bar.com</a>',
53 'http://foo@www.bar.com' => '<a class="external" href="http://foo@www.bar.com">http://foo@www.bar.com</a>',
54 'http://foo:bar@www.bar.com' => '<a class="external" href="http://foo:bar@www.bar.com">http://foo:bar@www.bar.com</a>',
54 'http://foo:bar@www.bar.com' => '<a class="external" href="http://foo:bar@www.bar.com">http://foo:bar@www.bar.com</a>',
55 'ftp://foo.bar' => '<a class="external" href="ftp://foo.bar">ftp://foo.bar</a>',
55 'ftp://foo.bar' => '<a class="external" href="ftp://foo.bar">ftp://foo.bar</a>',
56 'ftps://foo.bar' => '<a class="external" href="ftps://foo.bar">ftps://foo.bar</a>',
56 'ftps://foo.bar' => '<a class="external" href="ftps://foo.bar">ftps://foo.bar</a>',
57 'sftp://foo.bar' => '<a class="external" href="sftp://foo.bar">sftp://foo.bar</a>',
57 'sftp://foo.bar' => '<a class="external" href="sftp://foo.bar">sftp://foo.bar</a>',
58 # two exclamation marks
59 'http://example.net/path!602815048C7B5C20!302.html' => '<a class="external" href="http://example.net/path!602815048C7B5C20!302.html">http://example.net/path!602815048C7B5C20!302.html</a>',
58 }
60 }
59 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
61 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
60 end
62 end
61
63
62 def test_auto_mailto
64 def test_auto_mailto
63 assert_equal '<p><a href="mailto:test@foo.bar" class="email">test@foo.bar</a></p>',
65 assert_equal '<p><a href="mailto:test@foo.bar" class="email">test@foo.bar</a></p>',
64 textilizable('test@foo.bar')
66 textilizable('test@foo.bar')
65 end
67 end
66
68
67 def test_inline_images
69 def test_inline_images
68 to_test = {
70 to_test = {
69 '!http://foo.bar/image.jpg!' => '<img src="http://foo.bar/image.jpg" alt="" />',
71 '!http://foo.bar/image.jpg!' => '<img src="http://foo.bar/image.jpg" alt="" />',
70 'floating !>http://foo.bar/image.jpg!' => 'floating <div style="float:right"><img src="http://foo.bar/image.jpg" alt="" /></div>',
72 'floating !>http://foo.bar/image.jpg!' => 'floating <div style="float:right"><img src="http://foo.bar/image.jpg" alt="" /></div>',
71 'with class !(some-class)http://foo.bar/image.jpg!' => 'with class <img src="http://foo.bar/image.jpg" class="some-class" alt="" />',
73 'with class !(some-class)http://foo.bar/image.jpg!' => 'with class <img src="http://foo.bar/image.jpg" class="some-class" alt="" />',
72 # inline styles should be stripped
74 # inline styles should be stripped
73 'with style !{width:100px;height100px}http://foo.bar/image.jpg!' => 'with style <img src="http://foo.bar/image.jpg" alt="" />',
75 'with style !{width:100px;height100px}http://foo.bar/image.jpg!' => 'with style <img src="http://foo.bar/image.jpg" alt="" />',
74 'with title !http://foo.bar/image.jpg(This is a title)!' => 'with title <img src="http://foo.bar/image.jpg" title="This is a title" alt="This is a title" />',
76 'with title !http://foo.bar/image.jpg(This is a title)!' => 'with title <img src="http://foo.bar/image.jpg" title="This is a title" alt="This is a title" />',
75 'with title !http://foo.bar/image.jpg(This is a double-quoted "title")!' => 'with title <img src="http://foo.bar/image.jpg" title="This is a double-quoted &quot;title&quot;" alt="This is a double-quoted &quot;title&quot;" />',
77 'with title !http://foo.bar/image.jpg(This is a double-quoted "title")!' => 'with title <img src="http://foo.bar/image.jpg" title="This is a double-quoted &quot;title&quot;" alt="This is a double-quoted &quot;title&quot;" />',
76 }
78 }
77 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
79 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
78 end
80 end
79
81
80 def test_acronyms
82 def test_acronyms
81 to_test = {
83 to_test = {
82 'this is an acronym: GPL(General Public License)' => 'this is an acronym: <acronym title="General Public License">GPL</acronym>',
84 'this is an acronym: GPL(General Public License)' => 'this is an acronym: <acronym title="General Public License">GPL</acronym>',
83 'GPL(This is a double-quoted "title")' => '<acronym title="This is a double-quoted &quot;title&quot;">GPL</acronym>',
85 'GPL(This is a double-quoted "title")' => '<acronym title="This is a double-quoted &quot;title&quot;">GPL</acronym>',
84 }
86 }
85 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
87 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
86
88
87 end
89 end
88
90
89 def test_attached_images
91 def test_attached_images
90 to_test = {
92 to_test = {
91 'Inline image: !logo.gif!' => 'Inline image: <img src="/attachments/download/3" title="This is a logo" alt="This is a logo" />',
93 'Inline image: !logo.gif!' => 'Inline image: <img src="/attachments/download/3" title="This is a logo" alt="This is a logo" />',
92 'Inline image: !logo.GIF!' => 'Inline image: <img src="/attachments/download/3" title="This is a logo" alt="This is a logo" />',
94 'Inline image: !logo.GIF!' => 'Inline image: <img src="/attachments/download/3" title="This is a logo" alt="This is a logo" />',
93 'No match: !ogo.gif!' => 'No match: <img src="ogo.gif" alt="" />',
95 'No match: !ogo.gif!' => 'No match: <img src="ogo.gif" alt="" />',
94 'No match: !ogo.GIF!' => 'No match: <img src="ogo.GIF" alt="" />'
96 'No match: !ogo.GIF!' => 'No match: <img src="ogo.GIF" alt="" />'
95 }
97 }
96 attachments = Attachment.find(:all)
98 attachments = Attachment.find(:all)
97 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text, :attachments => attachments) }
99 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text, :attachments => attachments) }
98 end
100 end
99
101
100 def test_textile_external_links
102 def test_textile_external_links
101 to_test = {
103 to_test = {
102 'This is a "link":http://foo.bar' => 'This is a <a href="http://foo.bar" class="external">link</a>',
104 'This is a "link":http://foo.bar' => 'This is a <a href="http://foo.bar" class="external">link</a>',
103 'This is an intern "link":/foo/bar' => 'This is an intern <a href="/foo/bar">link</a>',
105 'This is an intern "link":/foo/bar' => 'This is an intern <a href="/foo/bar">link</a>',
104 '"link (Link title)":http://foo.bar' => '<a href="http://foo.bar" title="Link title" class="external">link</a>',
106 '"link (Link title)":http://foo.bar' => '<a href="http://foo.bar" title="Link title" class="external">link</a>',
105 '"link (Link title with "double-quotes")":http://foo.bar' => '<a href="http://foo.bar" title="Link title with &quot;double-quotes&quot;" class="external">link</a>',
107 '"link (Link title with "double-quotes")":http://foo.bar' => '<a href="http://foo.bar" title="Link title with &quot;double-quotes&quot;" class="external">link</a>',
106 "This is not a \"Link\":\n\nAnother paragraph" => "This is not a \"Link\":</p>\n\n\n\t<p>Another paragraph",
108 "This is not a \"Link\":\n\nAnother paragraph" => "This is not a \"Link\":</p>\n\n\n\t<p>Another paragraph",
107 # no multiline link text
109 # no multiline link text
108 "This is a double quote \"on the first line\nand another on a second line\":test" => "This is a double quote \"on the first line<br />\nand another on a second line\":test"
110 "This is a double quote \"on the first line\nand another on a second line\":test" => "This is a double quote \"on the first line<br />\nand another on a second line\":test",
111 # mailto link
112 "\"system administrator\":mailto:sysadmin@example.com?subject=redmine%20permissions" => "<a href=\"mailto:sysadmin@example.com?subject=redmine%20permissions\">system administrator</a>",
113 # two exclamation marks
114 '"a link":http://example.net/path!602815048C7B5C20!302.html' => '<a href="http://example.net/path!602815048C7B5C20!302.html" class="external">a link</a>',
109 }
115 }
110 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
116 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
111 end
117 end
112
118
113 def test_redmine_links
119 def test_redmine_links
114 issue_link = link_to('#3', {:controller => 'issues', :action => 'show', :id => 3},
120 issue_link = link_to('#3', {:controller => 'issues', :action => 'show', :id => 3},
115 :class => 'issue', :title => 'Error 281 when updating a recipe (New)')
121 :class => 'issue', :title => 'Error 281 when updating a recipe (New)')
116
122
117 changeset_link = link_to('r1', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 1},
123 changeset_link = link_to('r1', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 1},
118 :class => 'changeset', :title => 'My very first commit')
124 :class => 'changeset', :title => 'My very first commit')
119
125
120 document_link = link_to('Test document', {:controller => 'documents', :action => 'show', :id => 1},
126 document_link = link_to('Test document', {:controller => 'documents', :action => 'show', :id => 1},
121 :class => 'document')
127 :class => 'document')
122
128
123 version_link = link_to('1.0', {:controller => 'versions', :action => 'show', :id => 2},
129 version_link = link_to('1.0', {:controller => 'versions', :action => 'show', :id => 2},
124 :class => 'version')
130 :class => 'version')
125
131
126 message_url = {:controller => 'messages', :action => 'show', :board_id => 1, :id => 4}
132 message_url = {:controller => 'messages', :action => 'show', :board_id => 1, :id => 4}
127
133
128 source_url = {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file']}
134 source_url = {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file']}
129 source_url_with_ext = {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file.ext']}
135 source_url_with_ext = {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file.ext']}
130
136
131 to_test = {
137 to_test = {
132 # tickets
138 # tickets
133 '#3, #3 and #3.' => "#{issue_link}, #{issue_link} and #{issue_link}.",
139 '#3, #3 and #3.' => "#{issue_link}, #{issue_link} and #{issue_link}.",
134 # changesets
140 # changesets
135 'r1' => changeset_link,
141 'r1' => changeset_link,
136 # documents
142 # documents
137 'document#1' => document_link,
143 'document#1' => document_link,
138 'document:"Test document"' => document_link,
144 'document:"Test document"' => document_link,
139 # versions
145 # versions
140 'version#2' => version_link,
146 'version#2' => version_link,
141 'version:1.0' => version_link,
147 'version:1.0' => version_link,
142 'version:"1.0"' => version_link,
148 'version:"1.0"' => version_link,
143 # source
149 # source
144 'source:/some/file' => link_to('source:/some/file', source_url, :class => 'source'),
150 'source:/some/file' => link_to('source:/some/file', source_url, :class => 'source'),
145 'source:/some/file.' => link_to('source:/some/file', source_url, :class => 'source') + ".",
151 'source:/some/file.' => link_to('source:/some/file', source_url, :class => 'source') + ".",
146 'source:/some/file.ext.' => link_to('source:/some/file.ext', source_url_with_ext, :class => 'source') + ".",
152 'source:/some/file.ext.' => link_to('source:/some/file.ext', source_url_with_ext, :class => 'source') + ".",
147 'source:/some/file. ' => link_to('source:/some/file', source_url, :class => 'source') + ".",
153 'source:/some/file. ' => link_to('source:/some/file', source_url, :class => 'source') + ".",
148 'source:/some/file.ext. ' => link_to('source:/some/file.ext', source_url_with_ext, :class => 'source') + ".",
154 'source:/some/file.ext. ' => link_to('source:/some/file.ext', source_url_with_ext, :class => 'source') + ".",
149 'source:/some/file, ' => link_to('source:/some/file', source_url, :class => 'source') + ",",
155 'source:/some/file, ' => link_to('source:/some/file', source_url, :class => 'source') + ",",
150 'source:/some/file@52' => link_to('source:/some/file@52', source_url.merge(:rev => 52), :class => 'source'),
156 'source:/some/file@52' => link_to('source:/some/file@52', source_url.merge(:rev => 52), :class => 'source'),
151 'source:/some/file.ext@52' => link_to('source:/some/file.ext@52', source_url_with_ext.merge(:rev => 52), :class => 'source'),
157 'source:/some/file.ext@52' => link_to('source:/some/file.ext@52', source_url_with_ext.merge(:rev => 52), :class => 'source'),
152 'source:/some/file#L110' => link_to('source:/some/file#L110', source_url.merge(:anchor => 'L110'), :class => 'source'),
158 'source:/some/file#L110' => link_to('source:/some/file#L110', source_url.merge(:anchor => 'L110'), :class => 'source'),
153 'source:/some/file.ext#L110' => link_to('source:/some/file.ext#L110', source_url_with_ext.merge(:anchor => 'L110'), :class => 'source'),
159 'source:/some/file.ext#L110' => link_to('source:/some/file.ext#L110', source_url_with_ext.merge(:anchor => 'L110'), :class => 'source'),
154 'source:/some/file@52#L110' => link_to('source:/some/file@52#L110', source_url.merge(:rev => 52, :anchor => 'L110'), :class => 'source'),
160 'source:/some/file@52#L110' => link_to('source:/some/file@52#L110', source_url.merge(:rev => 52, :anchor => 'L110'), :class => 'source'),
155 'export:/some/file' => link_to('export:/some/file', source_url.merge(:format => 'raw'), :class => 'source download'),
161 'export:/some/file' => link_to('export:/some/file', source_url.merge(:format => 'raw'), :class => 'source download'),
156 # message
162 # message
157 'message#4' => link_to('Post 2', message_url, :class => 'message'),
163 'message#4' => link_to('Post 2', message_url, :class => 'message'),
158 'message#5' => link_to('RE: post 2', message_url.merge(:anchor => 'message-5'), :class => 'message'),
164 'message#5' => link_to('RE: post 2', message_url.merge(:anchor => 'message-5'), :class => 'message'),
159 # escaping
165 # escaping
160 '!#3.' => '#3.',
166 '!#3.' => '#3.',
161 '!r1' => 'r1',
167 '!r1' => 'r1',
162 '!document#1' => 'document#1',
168 '!document#1' => 'document#1',
163 '!document:"Test document"' => 'document:"Test document"',
169 '!document:"Test document"' => 'document:"Test document"',
164 '!version#2' => 'version#2',
170 '!version#2' => 'version#2',
165 '!version:1.0' => 'version:1.0',
171 '!version:1.0' => 'version:1.0',
166 '!version:"1.0"' => 'version:"1.0"',
172 '!version:"1.0"' => 'version:"1.0"',
167 '!source:/some/file' => 'source:/some/file',
173 '!source:/some/file' => 'source:/some/file',
168 # invalid expressions
174 # invalid expressions
169 'source:' => 'source:',
175 'source:' => 'source:',
170 # url hash
176 # url hash
171 "http://foo.bar/FAQ#3" => '<a class="external" href="http://foo.bar/FAQ#3">http://foo.bar/FAQ#3</a>',
177 "http://foo.bar/FAQ#3" => '<a class="external" href="http://foo.bar/FAQ#3">http://foo.bar/FAQ#3</a>',
172 }
178 }
173 @project = Project.find(1)
179 @project = Project.find(1)
174 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
180 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
175 end
181 end
176
182
177 def test_wiki_links
183 def test_wiki_links
178 to_test = {
184 to_test = {
179 '[[CookBook documentation]]' => '<a href="/wiki/ecookbook/CookBook_documentation" class="wiki-page">CookBook documentation</a>',
185 '[[CookBook documentation]]' => '<a href="/wiki/ecookbook/CookBook_documentation" class="wiki-page">CookBook documentation</a>',
180 '[[Another page|Page]]' => '<a href="/wiki/ecookbook/Another_page" class="wiki-page">Page</a>',
186 '[[Another page|Page]]' => '<a href="/wiki/ecookbook/Another_page" class="wiki-page">Page</a>',
181 # link with anchor
187 # link with anchor
182 '[[CookBook documentation#One-section]]' => '<a href="/wiki/ecookbook/CookBook_documentation#One-section" class="wiki-page">CookBook documentation</a>',
188 '[[CookBook documentation#One-section]]' => '<a href="/wiki/ecookbook/CookBook_documentation#One-section" class="wiki-page">CookBook documentation</a>',
183 '[[Another page#anchor|Page]]' => '<a href="/wiki/ecookbook/Another_page#anchor" class="wiki-page">Page</a>',
189 '[[Another page#anchor|Page]]' => '<a href="/wiki/ecookbook/Another_page#anchor" class="wiki-page">Page</a>',
184 # page that doesn't exist
190 # page that doesn't exist
185 '[[Unknown page]]' => '<a href="/wiki/ecookbook/Unknown_page" class="wiki-page new">Unknown page</a>',
191 '[[Unknown page]]' => '<a href="/wiki/ecookbook/Unknown_page" class="wiki-page new">Unknown page</a>',
186 '[[Unknown page|404]]' => '<a href="/wiki/ecookbook/Unknown_page" class="wiki-page new">404</a>',
192 '[[Unknown page|404]]' => '<a href="/wiki/ecookbook/Unknown_page" class="wiki-page new">404</a>',
187 # link to another project wiki
193 # link to another project wiki
188 '[[onlinestore:]]' => '<a href="/wiki/onlinestore/" class="wiki-page">onlinestore</a>',
194 '[[onlinestore:]]' => '<a href="/wiki/onlinestore/" class="wiki-page">onlinestore</a>',
189 '[[onlinestore:|Wiki]]' => '<a href="/wiki/onlinestore/" class="wiki-page">Wiki</a>',
195 '[[onlinestore:|Wiki]]' => '<a href="/wiki/onlinestore/" class="wiki-page">Wiki</a>',
190 '[[onlinestore:Start page]]' => '<a href="/wiki/onlinestore/Start_page" class="wiki-page">Start page</a>',
196 '[[onlinestore:Start page]]' => '<a href="/wiki/onlinestore/Start_page" class="wiki-page">Start page</a>',
191 '[[onlinestore:Start page|Text]]' => '<a href="/wiki/onlinestore/Start_page" class="wiki-page">Text</a>',
197 '[[onlinestore:Start page|Text]]' => '<a href="/wiki/onlinestore/Start_page" class="wiki-page">Text</a>',
192 '[[onlinestore:Unknown page]]' => '<a href="/wiki/onlinestore/Unknown_page" class="wiki-page new">Unknown page</a>',
198 '[[onlinestore:Unknown page]]' => '<a href="/wiki/onlinestore/Unknown_page" class="wiki-page new">Unknown page</a>',
193 # striked through link
199 # striked through link
194 '-[[Another page|Page]]-' => '<del><a href="/wiki/ecookbook/Another_page" class="wiki-page">Page</a></del>',
200 '-[[Another page|Page]]-' => '<del><a href="/wiki/ecookbook/Another_page" class="wiki-page">Page</a></del>',
195 '-[[Another page|Page]] link-' => '<del><a href="/wiki/ecookbook/Another_page" class="wiki-page">Page</a> link</del>',
201 '-[[Another page|Page]] link-' => '<del><a href="/wiki/ecookbook/Another_page" class="wiki-page">Page</a> link</del>',
196 # escaping
202 # escaping
197 '![[Another page|Page]]' => '[[Another page|Page]]',
203 '![[Another page|Page]]' => '[[Another page|Page]]',
198 }
204 }
199 @project = Project.find(1)
205 @project = Project.find(1)
200 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
206 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
201 end
207 end
202
208
203 def test_html_tags
209 def test_html_tags
204 to_test = {
210 to_test = {
205 "<div>content</div>" => "<p>&lt;div&gt;content&lt;/div&gt;</p>",
211 "<div>content</div>" => "<p>&lt;div&gt;content&lt;/div&gt;</p>",
206 "<div class=\"bold\">content</div>" => "<p>&lt;div class=\"bold\"&gt;content&lt;/div&gt;</p>",
212 "<div class=\"bold\">content</div>" => "<p>&lt;div class=\"bold\"&gt;content&lt;/div&gt;</p>",
207 "<script>some script;</script>" => "<p>&lt;script&gt;some script;&lt;/script&gt;</p>",
213 "<script>some script;</script>" => "<p>&lt;script&gt;some script;&lt;/script&gt;</p>",
208 # do not escape pre/code tags
214 # do not escape pre/code tags
209 "<pre>\nline 1\nline2</pre>" => "<pre>\nline 1\nline2</pre>",
215 "<pre>\nline 1\nline2</pre>" => "<pre>\nline 1\nline2</pre>",
210 "<pre><code>\nline 1\nline2</code></pre>" => "<pre><code>\nline 1\nline2</code></pre>",
216 "<pre><code>\nline 1\nline2</code></pre>" => "<pre><code>\nline 1\nline2</code></pre>",
211 "<pre><div>content</div></pre>" => "<pre>&lt;div&gt;content&lt;/div&gt;</pre>",
217 "<pre><div>content</div></pre>" => "<pre>&lt;div&gt;content&lt;/div&gt;</pre>",
212 "HTML comment: <!-- no comments -->" => "<p>HTML comment: &lt;!-- no comments --&gt;</p>",
218 "HTML comment: <!-- no comments -->" => "<p>HTML comment: &lt;!-- no comments --&gt;</p>",
213 "<!-- opening comment" => "<p>&lt;!-- opening comment</p>",
219 "<!-- opening comment" => "<p>&lt;!-- opening comment</p>",
214 # remove attributes except class
220 # remove attributes except class
215 "<pre class='foo'>some text</pre>" => "<pre class='foo'>some text</pre>",
221 "<pre class='foo'>some text</pre>" => "<pre class='foo'>some text</pre>",
216 "<pre onmouseover='alert(1)'>some text</pre>" => "<pre>some text</pre>",
222 "<pre onmouseover='alert(1)'>some text</pre>" => "<pre>some text</pre>",
217 }
223 }
218 to_test.each { |text, result| assert_equal result, textilizable(text) }
224 to_test.each { |text, result| assert_equal result, textilizable(text) }
219 end
225 end
220
226
221 def test_allowed_html_tags
227 def test_allowed_html_tags
222 to_test = {
228 to_test = {
223 "<pre>preformatted text</pre>" => "<pre>preformatted text</pre>",
229 "<pre>preformatted text</pre>" => "<pre>preformatted text</pre>",
224 "<notextile>no *textile* formatting</notextile>" => "no *textile* formatting",
230 "<notextile>no *textile* formatting</notextile>" => "no *textile* formatting",
225 "<notextile>this is <tag>a tag</tag></notextile>" => "this is &lt;tag&gt;a tag&lt;/tag&gt;"
231 "<notextile>this is <tag>a tag</tag></notextile>" => "this is &lt;tag&gt;a tag&lt;/tag&gt;"
226 }
232 }
227 to_test.each { |text, result| assert_equal result, textilizable(text) }
233 to_test.each { |text, result| assert_equal result, textilizable(text) }
228 end
234 end
229
235
230 def syntax_highlight
236 def syntax_highlight
231 raw = <<-RAW
237 raw = <<-RAW
232 <pre><code class="ruby">
238 <pre><code class="ruby">
233 # Some ruby code here
239 # Some ruby code here
234 </pre></code>
240 </pre></code>
235 RAW
241 RAW
236
242
237 expected = <<-EXPECTED
243 expected = <<-EXPECTED
238 <pre><code class="ruby CodeRay"><span class="no">1</span> <span class="c"># Some ruby code here</span>
244 <pre><code class="ruby CodeRay"><span class="no">1</span> <span class="c"># Some ruby code here</span>
239 </pre></code>
245 </pre></code>
240 EXPECTED
246 EXPECTED
241
247
242 assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '')
248 assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '')
243 end
249 end
244
250
245 def test_wiki_links_in_tables
251 def test_wiki_links_in_tables
246 to_test = {"|[[Page|Link title]]|[[Other Page|Other title]]|\n|Cell 21|[[Last page]]|" =>
252 to_test = {"|[[Page|Link title]]|[[Other Page|Other title]]|\n|Cell 21|[[Last page]]|" =>
247 '<tr><td><a href="/wiki/ecookbook/Page" class="wiki-page new">Link title</a></td>' +
253 '<tr><td><a href="/wiki/ecookbook/Page" class="wiki-page new">Link title</a></td>' +
248 '<td><a href="/wiki/ecookbook/Other_Page" class="wiki-page new">Other title</a></td>' +
254 '<td><a href="/wiki/ecookbook/Other_Page" class="wiki-page new">Other title</a></td>' +
249 '</tr><tr><td>Cell 21</td><td><a href="/wiki/ecookbook/Last_page" class="wiki-page new">Last page</a></td></tr>'
255 '</tr><tr><td>Cell 21</td><td><a href="/wiki/ecookbook/Last_page" class="wiki-page new">Last page</a></td></tr>'
250 }
256 }
251 @project = Project.find(1)
257 @project = Project.find(1)
252 to_test.each { |text, result| assert_equal "<table>#{result}</table>", textilizable(text).gsub(/[\t\n]/, '') }
258 to_test.each { |text, result| assert_equal "<table>#{result}</table>", textilizable(text).gsub(/[\t\n]/, '') }
253 end
259 end
254
260
255 def test_text_formatting
261 def test_text_formatting
256 to_test = {'*_+bold, italic and underline+_*' => '<strong><em><ins>bold, italic and underline</ins></em></strong>',
262 to_test = {'*_+bold, italic and underline+_*' => '<strong><em><ins>bold, italic and underline</ins></em></strong>',
257 '(_text within parentheses_)' => '(<em>text within parentheses</em>)',
263 '(_text within parentheses_)' => '(<em>text within parentheses</em>)',
258 'a *Humane Web* Text Generator' => 'a <strong>Humane Web</strong> Text Generator',
264 'a *Humane Web* Text Generator' => 'a <strong>Humane Web</strong> Text Generator',
259 'a H *umane* W *eb* T *ext* G *enerator*' => 'a H <strong>umane</strong> W <strong>eb</strong> T <strong>ext</strong> G <strong>enerator</strong>',
265 'a H *umane* W *eb* T *ext* G *enerator*' => 'a H <strong>umane</strong> W <strong>eb</strong> T <strong>ext</strong> G <strong>enerator</strong>',
260 'a *H* umane *W* eb *T* ext *G* enerator' => 'a <strong>H</strong> umane <strong>W</strong> eb <strong>T</strong> ext <strong>G</strong> enerator',
266 'a *H* umane *W* eb *T* ext *G* enerator' => 'a <strong>H</strong> umane <strong>W</strong> eb <strong>T</strong> ext <strong>G</strong> enerator',
261 }
267 }
262 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
268 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
263 end
269 end
264
270
265 def test_wiki_horizontal_rule
271 def test_wiki_horizontal_rule
266 assert_equal '<hr />', textilizable('---')
272 assert_equal '<hr />', textilizable('---')
267 assert_equal '<p>Dashes: ---</p>', textilizable('Dashes: ---')
273 assert_equal '<p>Dashes: ---</p>', textilizable('Dashes: ---')
268 end
274 end
269
275
270 def test_acronym
276 def test_acronym
271 assert_equal '<p>This is an acronym: <acronym title="American Civil Liberties Union">ACLU</acronym>.</p>',
277 assert_equal '<p>This is an acronym: <acronym title="American Civil Liberties Union">ACLU</acronym>.</p>',
272 textilizable('This is an acronym: ACLU(American Civil Liberties Union).')
278 textilizable('This is an acronym: ACLU(American Civil Liberties Union).')
273 end
279 end
274
280
275 def test_footnotes
281 def test_footnotes
276 raw = <<-RAW
282 raw = <<-RAW
277 This is some text[1].
283 This is some text[1].
278
284
279 fn1. This is the foot note
285 fn1. This is the foot note
280 RAW
286 RAW
281
287
282 expected = <<-EXPECTED
288 expected = <<-EXPECTED
283 <p>This is some text<sup><a href=\"#fn1\">1</a></sup>.</p>
289 <p>This is some text<sup><a href=\"#fn1\">1</a></sup>.</p>
284 <p id="fn1" class="footnote"><sup>1</sup> This is the foot note</p>
290 <p id="fn1" class="footnote"><sup>1</sup> This is the foot note</p>
285 EXPECTED
291 EXPECTED
286
292
287 assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '')
293 assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '')
288 end
294 end
289
295
290 def test_table_of_content
296 def test_table_of_content
291 raw = <<-RAW
297 raw = <<-RAW
292 {{toc}}
298 {{toc}}
293
299
294 h1. Title
300 h1. Title
295
301
296 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sed libero.
302 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sed libero.
297
303
298 h2. Subtitle
304 h2. Subtitle
299
305
300 Nullam commodo metus accumsan nulla. Curabitur lobortis dui id dolor.
306 Nullam commodo metus accumsan nulla. Curabitur lobortis dui id dolor.
301
307
302 h2. Subtitle with %{color:red}red text%
308 h2. Subtitle with %{color:red}red text%
303
309
304 h1. Another title
310 h1. Another title
305
311
306 RAW
312 RAW
307
313
308 expected = '<ul class="toc">' +
314 expected = '<ul class="toc">' +
309 '<li class="heading1"><a href="#Title">Title</a></li>' +
315 '<li class="heading1"><a href="#Title">Title</a></li>' +
310 '<li class="heading2"><a href="#Subtitle">Subtitle</a></li>' +
316 '<li class="heading2"><a href="#Subtitle">Subtitle</a></li>' +
311 '<li class="heading2"><a href="#Subtitle-with-red-text">Subtitle with red text</a></li>' +
317 '<li class="heading2"><a href="#Subtitle-with-red-text">Subtitle with red text</a></li>' +
312 '<li class="heading1"><a href="#Another-title">Another title</a></li>' +
318 '<li class="heading1"><a href="#Another-title">Another title</a></li>' +
313 '</ul>'
319 '</ul>'
314
320
315 assert textilizable(raw).gsub("\n", "").include?(expected)
321 assert textilizable(raw).gsub("\n", "").include?(expected)
316 end
322 end
317
323
318 def test_blockquote
324 def test_blockquote
319 # orig raw text
325 # orig raw text
320 raw = <<-RAW
326 raw = <<-RAW
321 John said:
327 John said:
322 > Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sed libero.
328 > Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sed libero.
323 > Nullam commodo metus accumsan nulla. Curabitur lobortis dui id dolor.
329 > Nullam commodo metus accumsan nulla. Curabitur lobortis dui id dolor.
324 > * Donec odio lorem,
330 > * Donec odio lorem,
325 > * sagittis ac,
331 > * sagittis ac,
326 > * malesuada in,
332 > * malesuada in,
327 > * adipiscing eu, dolor.
333 > * adipiscing eu, dolor.
328 >
334 >
329 > >Nulla varius pulvinar diam. Proin id arcu id lorem scelerisque condimentum. Proin vehicula turpis vitae lacus.
335 > >Nulla varius pulvinar diam. Proin id arcu id lorem scelerisque condimentum. Proin vehicula turpis vitae lacus.
330 > Proin a tellus. Nam vel neque.
336 > Proin a tellus. Nam vel neque.
331
337
332 He's right.
338 He's right.
333 RAW
339 RAW
334
340
335 # expected html
341 # expected html
336 expected = <<-EXPECTED
342 expected = <<-EXPECTED
337 <p>John said:</p>
343 <p>John said:</p>
338 <blockquote>
344 <blockquote>
339 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sed libero.
345 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sed libero.
340 Nullam commodo metus accumsan nulla. Curabitur lobortis dui id dolor.
346 Nullam commodo metus accumsan nulla. Curabitur lobortis dui id dolor.
341 <ul>
347 <ul>
342 <li>Donec odio lorem,</li>
348 <li>Donec odio lorem,</li>
343 <li>sagittis ac,</li>
349 <li>sagittis ac,</li>
344 <li>malesuada in,</li>
350 <li>malesuada in,</li>
345 <li>adipiscing eu, dolor.</li>
351 <li>adipiscing eu, dolor.</li>
346 </ul>
352 </ul>
347 <blockquote>
353 <blockquote>
348 <p>Nulla varius pulvinar diam. Proin id arcu id lorem scelerisque condimentum. Proin vehicula turpis vitae lacus.</p>
354 <p>Nulla varius pulvinar diam. Proin id arcu id lorem scelerisque condimentum. Proin vehicula turpis vitae lacus.</p>
349 </blockquote>
355 </blockquote>
350 <p>Proin a tellus. Nam vel neque.</p>
356 <p>Proin a tellus. Nam vel neque.</p>
351 </blockquote>
357 </blockquote>
352 <p>He's right.</p>
358 <p>He's right.</p>
353 EXPECTED
359 EXPECTED
354
360
355 assert_equal expected.gsub(%r{\s+}, ''), textilizable(raw).gsub(%r{\s+}, '')
361 assert_equal expected.gsub(%r{\s+}, ''), textilizable(raw).gsub(%r{\s+}, '')
356 end
362 end
357
363
358 def test_table
364 def test_table
359 raw = <<-RAW
365 raw = <<-RAW
360 This is a table with empty cells:
366 This is a table with empty cells:
361
367
362 |cell11|cell12||
368 |cell11|cell12||
363 |cell21||cell23|
369 |cell21||cell23|
364 |cell31|cell32|cell33|
370 |cell31|cell32|cell33|
365 RAW
371 RAW
366
372
367 expected = <<-EXPECTED
373 expected = <<-EXPECTED
368 <p>This is a table with empty cells:</p>
374 <p>This is a table with empty cells:</p>
369
375
370 <table>
376 <table>
371 <tr><td>cell11</td><td>cell12</td><td></td></tr>
377 <tr><td>cell11</td><td>cell12</td><td></td></tr>
372 <tr><td>cell21</td><td></td><td>cell23</td></tr>
378 <tr><td>cell21</td><td></td><td>cell23</td></tr>
373 <tr><td>cell31</td><td>cell32</td><td>cell33</td></tr>
379 <tr><td>cell31</td><td>cell32</td><td>cell33</td></tr>
374 </table>
380 </table>
375 EXPECTED
381 EXPECTED
376
382
377 assert_equal expected.gsub(%r{\s+}, ''), textilizable(raw).gsub(%r{\s+}, '')
383 assert_equal expected.gsub(%r{\s+}, ''), textilizable(raw).gsub(%r{\s+}, '')
378 end
384 end
379
385
380 def test_default_formatter
386 def test_default_formatter
381 Setting.text_formatting = 'unknown'
387 Setting.text_formatting = 'unknown'
382 text = 'a *link*: http://www.example.net/'
388 text = 'a *link*: http://www.example.net/'
383 assert_equal '<p>a *link*: <a href="http://www.example.net/">http://www.example.net/</a></p>', textilizable(text)
389 assert_equal '<p>a *link*: <a href="http://www.example.net/">http://www.example.net/</a></p>', textilizable(text)
384 Setting.text_formatting = 'textile'
390 Setting.text_formatting = 'textile'
385 end
391 end
386
392
387 def test_date_format_default
393 def test_date_format_default
388 today = Date.today
394 today = Date.today
389 Setting.date_format = ''
395 Setting.date_format = ''
390 assert_equal l_date(today), format_date(today)
396 assert_equal l_date(today), format_date(today)
391 end
397 end
392
398
393 def test_date_format
399 def test_date_format
394 today = Date.today
400 today = Date.today
395 Setting.date_format = '%d %m %Y'
401 Setting.date_format = '%d %m %Y'
396 assert_equal today.strftime('%d %m %Y'), format_date(today)
402 assert_equal today.strftime('%d %m %Y'), format_date(today)
397 end
403 end
398
404
399 def test_time_format_default
405 def test_time_format_default
400 now = Time.now
406 now = Time.now
401 Setting.date_format = ''
407 Setting.date_format = ''
402 Setting.time_format = ''
408 Setting.time_format = ''
403 assert_equal l_datetime(now), format_time(now)
409 assert_equal l_datetime(now), format_time(now)
404 assert_equal l_time(now), format_time(now, false)
410 assert_equal l_time(now), format_time(now, false)
405 end
411 end
406
412
407 def test_time_format
413 def test_time_format
408 now = Time.now
414 now = Time.now
409 Setting.date_format = '%d %m %Y'
415 Setting.date_format = '%d %m %Y'
410 Setting.time_format = '%H %M'
416 Setting.time_format = '%H %M'
411 assert_equal now.strftime('%d %m %Y %H %M'), format_time(now)
417 assert_equal now.strftime('%d %m %Y %H %M'), format_time(now)
412 assert_equal now.strftime('%H %M'), format_time(now, false)
418 assert_equal now.strftime('%H %M'), format_time(now, false)
413 end
419 end
414
420
415 def test_utc_time_format
421 def test_utc_time_format
416 now = Time.now.utc
422 now = Time.now.utc
417 Setting.date_format = '%d %m %Y'
423 Setting.date_format = '%d %m %Y'
418 Setting.time_format = '%H %M'
424 Setting.time_format = '%H %M'
419 assert_equal Time.now.strftime('%d %m %Y %H %M'), format_time(now)
425 assert_equal Time.now.strftime('%d %m %Y %H %M'), format_time(now)
420 assert_equal Time.now.strftime('%H %M'), format_time(now, false)
426 assert_equal Time.now.strftime('%H %M'), format_time(now, false)
421 end
427 end
422
428
423 def test_due_date_distance_in_words
429 def test_due_date_distance_in_words
424 to_test = { Date.today => 'Due in 0 days',
430 to_test = { Date.today => 'Due in 0 days',
425 Date.today + 1 => 'Due in 1 day',
431 Date.today + 1 => 'Due in 1 day',
426 Date.today + 100 => 'Due in 100 days',
432 Date.today + 100 => 'Due in 100 days',
427 Date.today + 20000 => 'Due in 20000 days',
433 Date.today + 20000 => 'Due in 20000 days',
428 Date.today - 1 => '1 day late',
434 Date.today - 1 => '1 day late',
429 Date.today - 100 => '100 days late',
435 Date.today - 100 => '100 days late',
430 Date.today - 20000 => '20000 days late',
436 Date.today - 20000 => '20000 days late',
431 }
437 }
432 to_test.each do |date, expected|
438 to_test.each do |date, expected|
433 assert_equal expected, due_date_distance_in_words(date)
439 assert_equal expected, due_date_distance_in_words(date)
434 end
440 end
435 end
441 end
436
442
437 def test_avatar
443 def test_avatar
438 # turn on avatars
444 # turn on avatars
439 Setting.gravatar_enabled = '1'
445 Setting.gravatar_enabled = '1'
440 assert avatar(User.find_by_mail('jsmith@somenet.foo')).include?(Digest::MD5.hexdigest('jsmith@somenet.foo'))
446 assert avatar(User.find_by_mail('jsmith@somenet.foo')).include?(Digest::MD5.hexdigest('jsmith@somenet.foo'))
441 assert avatar('jsmith <jsmith@somenet.foo>').include?(Digest::MD5.hexdigest('jsmith@somenet.foo'))
447 assert avatar('jsmith <jsmith@somenet.foo>').include?(Digest::MD5.hexdigest('jsmith@somenet.foo'))
442 assert_nil avatar('jsmith')
448 assert_nil avatar('jsmith')
443 assert_nil avatar(nil)
449 assert_nil avatar(nil)
444
450
445 # turn off avatars
451 # turn off avatars
446 Setting.gravatar_enabled = '0'
452 Setting.gravatar_enabled = '0'
447 assert_nil avatar(User.find_by_mail('jsmith@somenet.foo'))
453 assert_nil avatar(User.find_by_mail('jsmith@somenet.foo'))
448 end
454 end
449 end
455 end
General Comments 0
You need to be logged in to leave comments. Login now