@@ -1,618 +1,619 | |||||
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 'coderay' |
|
18 | require 'coderay' | |
19 | require 'coderay/helpers/file_type' |
|
19 | require 'coderay/helpers/file_type' | |
20 | require 'forwardable' |
|
20 | require 'forwardable' | |
21 | require 'cgi' |
|
21 | require 'cgi' | |
22 |
|
22 | |||
23 | module ApplicationHelper |
|
23 | module ApplicationHelper | |
24 | include Redmine::WikiFormatting::Macros::Definitions |
|
24 | include Redmine::WikiFormatting::Macros::Definitions | |
25 | include GravatarHelper::PublicMethods |
|
25 | include GravatarHelper::PublicMethods | |
26 |
|
26 | |||
27 | extend Forwardable |
|
27 | extend Forwardable | |
28 | def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter |
|
28 | def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter | |
29 |
|
29 | |||
30 | def current_role |
|
30 | def current_role | |
31 | @current_role ||= User.current.role_for_project(@project) |
|
31 | @current_role ||= User.current.role_for_project(@project) | |
32 | end |
|
32 | end | |
33 |
|
33 | |||
34 | # Return true if user is authorized for controller/action, otherwise false |
|
34 | # Return true if user is authorized for controller/action, otherwise false | |
35 | def authorize_for(controller, action) |
|
35 | def authorize_for(controller, action) | |
36 | User.current.allowed_to?({:controller => controller, :action => action}, @project) |
|
36 | User.current.allowed_to?({:controller => controller, :action => action}, @project) | |
37 | end |
|
37 | end | |
38 |
|
38 | |||
39 | # Display a link if user is authorized |
|
39 | # Display a link if user is authorized | |
40 | def link_to_if_authorized(name, options = {}, html_options = nil, *parameters_for_method_reference) |
|
40 | def link_to_if_authorized(name, options = {}, html_options = nil, *parameters_for_method_reference) | |
41 | link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for(options[:controller] || params[:controller], options[:action]) |
|
41 | link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for(options[:controller] || params[:controller], options[:action]) | |
42 | end |
|
42 | end | |
43 |
|
43 | |||
44 | # Display a link to remote if user is authorized |
|
44 | # Display a link to remote if user is authorized | |
45 | def link_to_remote_if_authorized(name, options = {}, html_options = nil) |
|
45 | def link_to_remote_if_authorized(name, options = {}, html_options = nil) | |
46 | url = options[:url] || {} |
|
46 | url = options[:url] || {} | |
47 | link_to_remote(name, options, html_options) if authorize_for(url[:controller] || params[:controller], url[:action]) |
|
47 | link_to_remote(name, options, html_options) if authorize_for(url[:controller] || params[:controller], url[:action]) | |
48 | end |
|
48 | end | |
49 |
|
49 | |||
50 | # Display a link to user's account page |
|
50 | # Display a link to user's account page | |
51 | def link_to_user(user, options={}) |
|
51 | def link_to_user(user, options={}) | |
52 | (user && !user.anonymous?) ? link_to(user.name(options[:format]), :controller => 'account', :action => 'show', :id => user) : 'Anonymous' |
|
52 | (user && !user.anonymous?) ? link_to(user.name(options[:format]), :controller => 'account', :action => 'show', :id => user) : 'Anonymous' | |
53 | end |
|
53 | end | |
54 |
|
54 | |||
55 | def link_to_issue(issue, options={}) |
|
55 | def link_to_issue(issue, options={}) | |
56 | options[:class] ||= '' |
|
56 | options[:class] ||= '' | |
57 | options[:class] << ' issue' |
|
57 | options[:class] << ' issue' | |
58 | options[:class] << ' closed' if issue.closed? |
|
58 | options[:class] << ' closed' if issue.closed? | |
59 | link_to "#{issue.tracker.name} ##{issue.id}", {:controller => "issues", :action => "show", :id => issue}, options |
|
59 | link_to "#{issue.tracker.name} ##{issue.id}", {:controller => "issues", :action => "show", :id => issue}, options | |
60 | end |
|
60 | end | |
61 |
|
61 | |||
62 | # Generates a link to an attachment. |
|
62 | # Generates a link to an attachment. | |
63 | # Options: |
|
63 | # Options: | |
64 | # * :text - Link text (default to attachment filename) |
|
64 | # * :text - Link text (default to attachment filename) | |
65 | # * :download - Force download (default: false) |
|
65 | # * :download - Force download (default: false) | |
66 | def link_to_attachment(attachment, options={}) |
|
66 | def link_to_attachment(attachment, options={}) | |
67 | text = options.delete(:text) || attachment.filename |
|
67 | text = options.delete(:text) || attachment.filename | |
68 | action = options.delete(:download) ? 'download' : 'show' |
|
68 | action = options.delete(:download) ? 'download' : 'show' | |
69 |
|
69 | |||
70 | link_to(h(text), {:controller => 'attachments', :action => action, :id => attachment, :filename => attachment.filename }, options) |
|
70 | link_to(h(text), {:controller => 'attachments', :action => action, :id => attachment, :filename => attachment.filename }, options) | |
71 | end |
|
71 | end | |
72 |
|
72 | |||
73 | def toggle_link(name, id, options={}) |
|
73 | def toggle_link(name, id, options={}) | |
74 | onclick = "Element.toggle('#{id}'); " |
|
74 | onclick = "Element.toggle('#{id}'); " | |
75 | onclick << (options[:focus] ? "Form.Element.focus('#{options[:focus]}'); " : "this.blur(); ") |
|
75 | onclick << (options[:focus] ? "Form.Element.focus('#{options[:focus]}'); " : "this.blur(); ") | |
76 | onclick << "return false;" |
|
76 | onclick << "return false;" | |
77 | link_to(name, "#", :onclick => onclick) |
|
77 | link_to(name, "#", :onclick => onclick) | |
78 | end |
|
78 | end | |
79 |
|
79 | |||
80 | def image_to_function(name, function, html_options = {}) |
|
80 | def image_to_function(name, function, html_options = {}) | |
81 | html_options.symbolize_keys! |
|
81 | html_options.symbolize_keys! | |
82 | tag(:input, html_options.merge({ |
|
82 | tag(:input, html_options.merge({ | |
83 | :type => "image", :src => image_path(name), |
|
83 | :type => "image", :src => image_path(name), | |
84 | :onclick => (html_options[:onclick] ? "#{html_options[:onclick]}; " : "") + "#{function};" |
|
84 | :onclick => (html_options[:onclick] ? "#{html_options[:onclick]}; " : "") + "#{function};" | |
85 | })) |
|
85 | })) | |
86 | end |
|
86 | end | |
87 |
|
87 | |||
88 | def prompt_to_remote(name, text, param, url, html_options = {}) |
|
88 | def prompt_to_remote(name, text, param, url, html_options = {}) | |
89 | html_options[:onclick] = "promptToRemote('#{text}', '#{param}', '#{url_for(url)}'); return false;" |
|
89 | html_options[:onclick] = "promptToRemote('#{text}', '#{param}', '#{url_for(url)}'); return false;" | |
90 | link_to name, {}, html_options |
|
90 | link_to name, {}, html_options | |
91 | end |
|
91 | end | |
92 |
|
92 | |||
93 | def format_date(date) |
|
93 | def format_date(date) | |
94 | return nil unless date |
|
94 | return nil unless date | |
95 | # "Setting.date_format.size < 2" is a temporary fix (content of date_format setting changed) |
|
95 | # "Setting.date_format.size < 2" is a temporary fix (content of date_format setting changed) | |
96 | @date_format ||= (Setting.date_format.blank? || Setting.date_format.size < 2 ? l(:general_fmt_date) : Setting.date_format) |
|
96 | @date_format ||= (Setting.date_format.blank? || Setting.date_format.size < 2 ? l(:general_fmt_date) : Setting.date_format) | |
97 | date.strftime(@date_format) |
|
97 | date.strftime(@date_format) | |
98 | end |
|
98 | end | |
99 |
|
99 | |||
100 | def format_time(time, include_date = true) |
|
100 | def format_time(time, include_date = true) | |
101 | return nil unless time |
|
101 | return nil unless time | |
102 | time = time.to_time if time.is_a?(String) |
|
102 | time = time.to_time if time.is_a?(String) | |
103 | zone = User.current.time_zone |
|
103 | zone = User.current.time_zone | |
104 | local = zone ? time.in_time_zone(zone) : (time.utc? ? time.localtime : time) |
|
104 | local = zone ? time.in_time_zone(zone) : (time.utc? ? time.localtime : time) | |
105 | @date_format ||= (Setting.date_format.blank? || Setting.date_format.size < 2 ? l(:general_fmt_date) : Setting.date_format) |
|
105 | @date_format ||= (Setting.date_format.blank? || Setting.date_format.size < 2 ? l(:general_fmt_date) : Setting.date_format) | |
106 | @time_format ||= (Setting.time_format.blank? ? l(:general_fmt_time) : Setting.time_format) |
|
106 | @time_format ||= (Setting.time_format.blank? ? l(:general_fmt_time) : Setting.time_format) | |
107 | include_date ? local.strftime("#{@date_format} #{@time_format}") : local.strftime(@time_format) |
|
107 | include_date ? local.strftime("#{@date_format} #{@time_format}") : local.strftime(@time_format) | |
108 | end |
|
108 | end | |
109 |
|
109 | |||
110 | def format_activity_title(text) |
|
110 | def format_activity_title(text) | |
111 | h(truncate_single_line(text, 100)) |
|
111 | h(truncate_single_line(text, 100)) | |
112 | end |
|
112 | end | |
113 |
|
113 | |||
114 | def format_activity_day(date) |
|
114 | def format_activity_day(date) | |
115 | date == Date.today ? l(:label_today).titleize : format_date(date) |
|
115 | date == Date.today ? l(:label_today).titleize : format_date(date) | |
116 | end |
|
116 | end | |
117 |
|
117 | |||
118 | def format_activity_description(text) |
|
118 | def format_activity_description(text) | |
119 | h(truncate(text.to_s, 250).gsub(%r{<(pre|code)>.*$}m, '...')) |
|
119 | h(truncate(text.to_s, 250).gsub(%r{<(pre|code)>.*$}m, '...')) | |
120 | end |
|
120 | end | |
121 |
|
121 | |||
122 | def distance_of_date_in_words(from_date, to_date = 0) |
|
122 | def distance_of_date_in_words(from_date, to_date = 0) | |
123 | from_date = from_date.to_date if from_date.respond_to?(:to_date) |
|
123 | from_date = from_date.to_date if from_date.respond_to?(:to_date) | |
124 | to_date = to_date.to_date if to_date.respond_to?(:to_date) |
|
124 | to_date = to_date.to_date if to_date.respond_to?(:to_date) | |
125 | distance_in_days = (to_date - from_date).abs |
|
125 | distance_in_days = (to_date - from_date).abs | |
126 | lwr(:actionview_datehelper_time_in_words_day, distance_in_days) |
|
126 | lwr(:actionview_datehelper_time_in_words_day, distance_in_days) | |
127 | end |
|
127 | end | |
128 |
|
128 | |||
129 | def due_date_distance_in_words(date) |
|
129 | def due_date_distance_in_words(date) | |
130 | if date |
|
130 | if date | |
131 | l((date < Date.today ? :label_roadmap_overdue : :label_roadmap_due_in), distance_of_date_in_words(Date.today, date)) |
|
131 | l((date < Date.today ? :label_roadmap_overdue : :label_roadmap_due_in), distance_of_date_in_words(Date.today, date)) | |
132 | end |
|
132 | end | |
133 | end |
|
133 | end | |
134 |
|
134 | |||
135 | def render_page_hierarchy(pages, node=nil) |
|
135 | def render_page_hierarchy(pages, node=nil) | |
136 | content = '' |
|
136 | content = '' | |
137 | if pages[node] |
|
137 | if pages[node] | |
138 | content << "<ul class=\"pages-hierarchy\">\n" |
|
138 | content << "<ul class=\"pages-hierarchy\">\n" | |
139 | pages[node].each do |page| |
|
139 | pages[node].each do |page| | |
140 | content << "<li>" |
|
140 | content << "<li>" | |
141 | content << link_to(h(page.pretty_title), {:controller => 'wiki', :action => 'index', :id => page.project, :page => page.title}, |
|
141 | content << link_to(h(page.pretty_title), {:controller => 'wiki', :action => 'index', :id => page.project, :page => page.title}, | |
142 | :title => (page.respond_to?(:updated_on) ? l(:label_updated_time, distance_of_time_in_words(Time.now, page.updated_on)) : nil)) |
|
142 | :title => (page.respond_to?(:updated_on) ? l(:label_updated_time, distance_of_time_in_words(Time.now, page.updated_on)) : nil)) | |
143 | content << "\n" + render_page_hierarchy(pages, page.id) if pages[page.id] |
|
143 | content << "\n" + render_page_hierarchy(pages, page.id) if pages[page.id] | |
144 | content << "</li>\n" |
|
144 | content << "</li>\n" | |
145 | end |
|
145 | end | |
146 | content << "</ul>\n" |
|
146 | content << "</ul>\n" | |
147 | end |
|
147 | end | |
148 | content |
|
148 | content | |
149 | end |
|
149 | end | |
150 |
|
150 | |||
151 | # Truncates and returns the string as a single line |
|
151 | # Truncates and returns the string as a single line | |
152 | def truncate_single_line(string, *args) |
|
152 | def truncate_single_line(string, *args) | |
153 | truncate(string, *args).gsub(%r{[\r\n]+}m, ' ') |
|
153 | truncate(string, *args).gsub(%r{[\r\n]+}m, ' ') | |
154 | end |
|
154 | end | |
155 |
|
155 | |||
156 | def html_hours(text) |
|
156 | def html_hours(text) | |
157 | text.gsub(%r{(\d+)\.(\d+)}, '<span class="hours hours-int">\1</span><span class="hours hours-dec">.\2</span>') |
|
157 | text.gsub(%r{(\d+)\.(\d+)}, '<span class="hours hours-int">\1</span><span class="hours hours-dec">.\2</span>') | |
158 | end |
|
158 | end | |
159 |
|
159 | |||
160 | def authoring(created, author, options={}) |
|
160 | def authoring(created, author, options={}) | |
161 | time_tag = @project.nil? ? content_tag('acronym', distance_of_time_in_words(Time.now, created), :title => format_time(created)) : |
|
161 | time_tag = @project.nil? ? content_tag('acronym', distance_of_time_in_words(Time.now, created), :title => format_time(created)) : | |
162 | link_to(distance_of_time_in_words(Time.now, created), |
|
162 | link_to(distance_of_time_in_words(Time.now, created), | |
163 | {:controller => 'projects', :action => 'activity', :id => @project, :from => created.to_date}, |
|
163 | {:controller => 'projects', :action => 'activity', :id => @project, :from => created.to_date}, | |
164 | :title => format_time(created)) |
|
164 | :title => format_time(created)) | |
165 | author_tag = (author.is_a?(User) && !author.anonymous?) ? link_to(h(author), :controller => 'account', :action => 'show', :id => author) : h(author || 'Anonymous') |
|
165 | author_tag = (author.is_a?(User) && !author.anonymous?) ? link_to(h(author), :controller => 'account', :action => 'show', :id => author) : h(author || 'Anonymous') | |
166 | l(options[:label] || :label_added_time_by, author_tag, time_tag) |
|
166 | l(options[:label] || :label_added_time_by, author_tag, time_tag) | |
167 | end |
|
167 | end | |
168 |
|
168 | |||
169 | def l_or_humanize(s, options={}) |
|
169 | def l_or_humanize(s, options={}) | |
170 | k = "#{options[:prefix]}#{s}".to_sym |
|
170 | k = "#{options[:prefix]}#{s}".to_sym | |
171 | l_has_string?(k) ? l(k) : s.to_s.humanize |
|
171 | l_has_string?(k) ? l(k) : s.to_s.humanize | |
172 | end |
|
172 | end | |
173 |
|
173 | |||
174 | def day_name(day) |
|
174 | def day_name(day) | |
175 | l(:general_day_names).split(',')[day-1] |
|
175 | l(:general_day_names).split(',')[day-1] | |
176 | end |
|
176 | end | |
177 |
|
177 | |||
178 | def month_name(month) |
|
178 | def month_name(month) | |
179 | l(:actionview_datehelper_select_month_names).split(',')[month-1] |
|
179 | l(:actionview_datehelper_select_month_names).split(',')[month-1] | |
180 | end |
|
180 | end | |
181 |
|
181 | |||
182 | def syntax_highlight(name, content) |
|
182 | def syntax_highlight(name, content) | |
183 | type = CodeRay::FileType[name] |
|
183 | type = CodeRay::FileType[name] | |
184 | type ? CodeRay.scan(content, type).html : h(content) |
|
184 | type ? CodeRay.scan(content, type).html : h(content) | |
185 | end |
|
185 | end | |
186 |
|
186 | |||
187 | def to_path_param(path) |
|
187 | def to_path_param(path) | |
188 | path.to_s.split(%r{[/\\]}).select {|p| !p.blank?} |
|
188 | path.to_s.split(%r{[/\\]}).select {|p| !p.blank?} | |
189 | end |
|
189 | end | |
190 |
|
190 | |||
191 | def pagination_links_full(paginator, count=nil, options={}) |
|
191 | def pagination_links_full(paginator, count=nil, options={}) | |
192 | page_param = options.delete(:page_param) || :page |
|
192 | page_param = options.delete(:page_param) || :page | |
193 | url_param = params.dup |
|
193 | url_param = params.dup | |
194 | # don't reuse params if filters are present |
|
194 | # don't reuse params if filters are present | |
195 | url_param.clear if url_param.has_key?(:set_filter) |
|
195 | url_param.clear if url_param.has_key?(:set_filter) | |
196 |
|
196 | |||
197 | html = '' |
|
197 | html = '' | |
198 | html << link_to_remote(('« ' + l(:label_previous)), |
|
198 | html << link_to_remote(('« ' + l(:label_previous)), | |
199 | {:update => 'content', |
|
199 | {:update => 'content', | |
200 | :url => url_param.merge(page_param => paginator.current.previous), |
|
200 | :url => url_param.merge(page_param => paginator.current.previous), | |
201 | :complete => 'window.scrollTo(0,0)'}, |
|
201 | :complete => 'window.scrollTo(0,0)'}, | |
202 | {:href => url_for(:params => url_param.merge(page_param => paginator.current.previous))}) + ' ' if paginator.current.previous |
|
202 | {:href => url_for(:params => url_param.merge(page_param => paginator.current.previous))}) + ' ' if paginator.current.previous | |
203 |
|
203 | |||
204 | html << (pagination_links_each(paginator, options) do |n| |
|
204 | html << (pagination_links_each(paginator, options) do |n| | |
205 | link_to_remote(n.to_s, |
|
205 | link_to_remote(n.to_s, | |
206 | {:url => {:params => url_param.merge(page_param => n)}, |
|
206 | {:url => {:params => url_param.merge(page_param => n)}, | |
207 | :update => 'content', |
|
207 | :update => 'content', | |
208 | :complete => 'window.scrollTo(0,0)'}, |
|
208 | :complete => 'window.scrollTo(0,0)'}, | |
209 | {:href => url_for(:params => url_param.merge(page_param => n))}) |
|
209 | {:href => url_for(:params => url_param.merge(page_param => n))}) | |
210 | end || '') |
|
210 | end || '') | |
211 |
|
211 | |||
212 | html << ' ' + link_to_remote((l(:label_next) + ' »'), |
|
212 | html << ' ' + link_to_remote((l(:label_next) + ' »'), | |
213 | {:update => 'content', |
|
213 | {:update => 'content', | |
214 | :url => url_param.merge(page_param => paginator.current.next), |
|
214 | :url => url_param.merge(page_param => paginator.current.next), | |
215 | :complete => 'window.scrollTo(0,0)'}, |
|
215 | :complete => 'window.scrollTo(0,0)'}, | |
216 | {:href => url_for(:params => url_param.merge(page_param => paginator.current.next))}) if paginator.current.next |
|
216 | {:href => url_for(:params => url_param.merge(page_param => paginator.current.next))}) if paginator.current.next | |
217 |
|
217 | |||
218 | unless count.nil? |
|
218 | unless count.nil? | |
219 | html << [" (#{paginator.current.first_item}-#{paginator.current.last_item}/#{count})", per_page_links(paginator.items_per_page)].compact.join(' | ') |
|
219 | html << [" (#{paginator.current.first_item}-#{paginator.current.last_item}/#{count})", per_page_links(paginator.items_per_page)].compact.join(' | ') | |
220 | end |
|
220 | end | |
221 |
|
221 | |||
222 | html |
|
222 | html | |
223 | end |
|
223 | end | |
224 |
|
224 | |||
225 | def per_page_links(selected=nil) |
|
225 | def per_page_links(selected=nil) | |
226 | url_param = params.dup |
|
226 | url_param = params.dup | |
227 | url_param.clear if url_param.has_key?(:set_filter) |
|
227 | url_param.clear if url_param.has_key?(:set_filter) | |
228 |
|
228 | |||
229 | links = Setting.per_page_options_array.collect do |n| |
|
229 | links = Setting.per_page_options_array.collect do |n| | |
230 | n == selected ? n : link_to_remote(n, {:update => "content", :url => params.dup.merge(:per_page => n)}, |
|
230 | n == selected ? n : link_to_remote(n, {:update => "content", :url => params.dup.merge(:per_page => n)}, | |
231 | {:href => url_for(url_param.merge(:per_page => n))}) |
|
231 | {:href => url_for(url_param.merge(:per_page => n))}) | |
232 | end |
|
232 | end | |
233 | links.size > 1 ? l(:label_display_per_page, links.join(', ')) : nil |
|
233 | links.size > 1 ? l(:label_display_per_page, links.join(', ')) : nil | |
234 | end |
|
234 | end | |
235 |
|
235 | |||
236 | def breadcrumb(*args) |
|
236 | def breadcrumb(*args) | |
237 | elements = args.flatten |
|
237 | elements = args.flatten | |
238 | elements.any? ? content_tag('p', args.join(' » ') + ' » ', :class => 'breadcrumb') : nil |
|
238 | elements.any? ? content_tag('p', args.join(' » ') + ' » ', :class => 'breadcrumb') : nil | |
239 | end |
|
239 | end | |
240 |
|
240 | |||
241 | def html_title(*args) |
|
241 | def html_title(*args) | |
242 | if args.empty? |
|
242 | if args.empty? | |
243 | title = [] |
|
243 | title = [] | |
244 | title << @project.name if @project |
|
244 | title << @project.name if @project | |
245 | title += @html_title if @html_title |
|
245 | title += @html_title if @html_title | |
246 | title << Setting.app_title |
|
246 | title << Setting.app_title | |
247 | title.compact.join(' - ') |
|
247 | title.compact.join(' - ') | |
248 | else |
|
248 | else | |
249 | @html_title ||= [] |
|
249 | @html_title ||= [] | |
250 | @html_title += args |
|
250 | @html_title += args | |
251 | end |
|
251 | end | |
252 | end |
|
252 | end | |
253 |
|
253 | |||
254 | def accesskey(s) |
|
254 | def accesskey(s) | |
255 | Redmine::AccessKeys.key_for s |
|
255 | Redmine::AccessKeys.key_for s | |
256 | end |
|
256 | end | |
257 |
|
257 | |||
258 | # Formats text according to system settings. |
|
258 | # Formats text according to system settings. | |
259 | # 2 ways to call this method: |
|
259 | # 2 ways to call this method: | |
260 | # * with a String: textilizable(text, options) |
|
260 | # * with a String: textilizable(text, options) | |
261 | # * with an object and one of its attribute: textilizable(issue, :description, options) |
|
261 | # * with an object and one of its attribute: textilizable(issue, :description, options) | |
262 | def textilizable(*args) |
|
262 | def textilizable(*args) | |
263 | options = args.last.is_a?(Hash) ? args.pop : {} |
|
263 | options = args.last.is_a?(Hash) ? args.pop : {} | |
264 | case args.size |
|
264 | case args.size | |
265 | when 1 |
|
265 | when 1 | |
266 | obj = options[:object] |
|
266 | obj = options[:object] | |
267 | text = args.shift |
|
267 | text = args.shift | |
268 | when 2 |
|
268 | when 2 | |
269 | obj = args.shift |
|
269 | obj = args.shift | |
270 | text = obj.send(args.shift).to_s |
|
270 | text = obj.send(args.shift).to_s | |
271 | else |
|
271 | else | |
272 | raise ArgumentError, 'invalid arguments to textilizable' |
|
272 | raise ArgumentError, 'invalid arguments to textilizable' | |
273 | end |
|
273 | end | |
274 | return '' if text.blank? |
|
274 | return '' if text.blank? | |
275 |
|
275 | |||
276 | only_path = options.delete(:only_path) == false ? false : true |
|
276 | only_path = options.delete(:only_path) == false ? false : true | |
277 |
|
277 | |||
278 | # when using an image link, try to use an attachment, if possible |
|
278 | # when using an image link, try to use an attachment, if possible | |
279 | attachments = options[:attachments] || (obj && obj.respond_to?(:attachments) ? obj.attachments : nil) |
|
279 | attachments = options[:attachments] || (obj && obj.respond_to?(:attachments) ? obj.attachments : nil) | |
280 |
|
280 | |||
281 | if attachments |
|
281 | if attachments | |
282 | attachments = attachments.sort_by(&:created_on).reverse |
|
282 | attachments = attachments.sort_by(&:created_on).reverse | |
283 | text = text.gsub(/!((\<|\=|\>)?(\([^\)]+\))?(\[[^\]]+\])?(\{[^\}]+\})?)(\S+\.(bmp|gif|jpg|jpeg|png))!/i) do |m| |
|
283 | text = text.gsub(/!((\<|\=|\>)?(\([^\)]+\))?(\[[^\]]+\])?(\{[^\}]+\})?)(\S+\.(bmp|gif|jpg|jpeg|png))!/i) do |m| | |
284 | style = $1 |
|
284 | style = $1 | |
285 | filename = $6 |
|
285 | filename = $6 | |
286 | rf = Regexp.new(Regexp.escape(filename), Regexp::IGNORECASE) |
|
286 | rf = Regexp.new(Regexp.escape(filename), Regexp::IGNORECASE) | |
287 | # search for the picture in attachments |
|
287 | # search for the picture in attachments | |
288 | if found = attachments.detect { |att| att.filename =~ rf } |
|
288 | if found = attachments.detect { |att| att.filename =~ rf } | |
289 | image_url = url_for :only_path => only_path, :controller => 'attachments', :action => 'download', :id => found |
|
289 | image_url = url_for :only_path => only_path, :controller => 'attachments', :action => 'download', :id => found | |
290 | desc = found.description.to_s.gsub(/^([^\(\)]*).*$/, "\\1") |
|
290 | desc = found.description.to_s.gsub(/^([^\(\)]*).*$/, "\\1") | |
291 | alt = desc.blank? ? nil : "(#{desc})" |
|
291 | alt = desc.blank? ? nil : "(#{desc})" | |
292 | "!#{style}#{image_url}#{alt}!" |
|
292 | "!#{style}#{image_url}#{alt}!" | |
293 | else |
|
293 | else | |
294 | "!#{style}#{filename}!" |
|
294 | "!#{style}#{filename}!" | |
295 | end |
|
295 | end | |
296 | end |
|
296 | end | |
297 | end |
|
297 | end | |
298 |
|
298 | |||
299 | text = Redmine::WikiFormatting.to_html(Setting.text_formatting, text) { |macro, args| exec_macro(macro, obj, args) } |
|
299 | text = Redmine::WikiFormatting.to_html(Setting.text_formatting, text) { |macro, args| exec_macro(macro, obj, args) } | |
300 |
|
300 | |||
301 | # different methods for formatting wiki links |
|
301 | # different methods for formatting wiki links | |
302 | case options[:wiki_links] |
|
302 | case options[:wiki_links] | |
303 | when :local |
|
303 | when :local | |
304 | # used for local links to html files |
|
304 | # used for local links to html files | |
305 | format_wiki_link = Proc.new {|project, title, anchor| "#{title}.html" } |
|
305 | format_wiki_link = Proc.new {|project, title, anchor| "#{title}.html" } | |
306 | when :anchor |
|
306 | when :anchor | |
307 | # used for single-file wiki export |
|
307 | # used for single-file wiki export | |
308 | format_wiki_link = Proc.new {|project, title, anchor| "##{title}" } |
|
308 | format_wiki_link = Proc.new {|project, title, anchor| "##{title}" } | |
309 | else |
|
309 | else | |
310 | format_wiki_link = Proc.new {|project, title, anchor| url_for(:only_path => only_path, :controller => 'wiki', :action => 'index', :id => project, :page => title, :anchor => anchor) } |
|
310 | format_wiki_link = Proc.new {|project, title, anchor| url_for(:only_path => only_path, :controller => 'wiki', :action => 'index', :id => project, :page => title, :anchor => anchor) } | |
311 | end |
|
311 | end | |
312 |
|
312 | |||
313 | project = options[:project] || @project || (obj && obj.respond_to?(:project) ? obj.project : nil) |
|
313 | project = options[:project] || @project || (obj && obj.respond_to?(:project) ? obj.project : nil) | |
314 |
|
314 | |||
315 | # Wiki links |
|
315 | # Wiki links | |
316 | # |
|
316 | # | |
317 | # Examples: |
|
317 | # Examples: | |
318 | # [[mypage]] |
|
318 | # [[mypage]] | |
319 | # [[mypage|mytext]] |
|
319 | # [[mypage|mytext]] | |
320 | # wiki links can refer other project wikis, using project name or identifier: |
|
320 | # wiki links can refer other project wikis, using project name or identifier: | |
321 | # [[project:]] -> wiki starting page |
|
321 | # [[project:]] -> wiki starting page | |
322 | # [[project:|mytext]] |
|
322 | # [[project:|mytext]] | |
323 | # [[project:mypage]] |
|
323 | # [[project:mypage]] | |
324 | # [[project:mypage|mytext]] |
|
324 | # [[project:mypage|mytext]] | |
325 | text = text.gsub(/(!)?(\[\[([^\]\n\|]+)(\|([^\]\n\|]+))?\]\])/) do |m| |
|
325 | text = text.gsub(/(!)?(\[\[([^\]\n\|]+)(\|([^\]\n\|]+))?\]\])/) do |m| | |
326 | link_project = project |
|
326 | link_project = project | |
327 | esc, all, page, title = $1, $2, $3, $5 |
|
327 | esc, all, page, title = $1, $2, $3, $5 | |
328 | if esc.nil? |
|
328 | if esc.nil? | |
329 | if page =~ /^([^\:]+)\:(.*)$/ |
|
329 | if page =~ /^([^\:]+)\:(.*)$/ | |
330 | link_project = Project.find_by_name($1) || Project.find_by_identifier($1) |
|
330 | link_project = Project.find_by_name($1) || Project.find_by_identifier($1) | |
331 | page = $2 |
|
331 | page = $2 | |
332 | title ||= $1 if page.blank? |
|
332 | title ||= $1 if page.blank? | |
333 | end |
|
333 | end | |
334 |
|
334 | |||
335 | if link_project && link_project.wiki |
|
335 | if link_project && link_project.wiki | |
336 | # extract anchor |
|
336 | # extract anchor | |
337 | anchor = nil |
|
337 | anchor = nil | |
338 | if page =~ /^(.+?)\#(.+)$/ |
|
338 | if page =~ /^(.+?)\#(.+)$/ | |
339 | page, anchor = $1, $2 |
|
339 | page, anchor = $1, $2 | |
340 | end |
|
340 | end | |
341 | # check if page exists |
|
341 | # check if page exists | |
342 | wiki_page = link_project.wiki.find_page(page) |
|
342 | wiki_page = link_project.wiki.find_page(page) | |
343 | link_to((title || page), format_wiki_link.call(link_project, Wiki.titleize(page), anchor), |
|
343 | link_to((title || page), format_wiki_link.call(link_project, Wiki.titleize(page), anchor), | |
344 | :class => ('wiki-page' + (wiki_page ? '' : ' new'))) |
|
344 | :class => ('wiki-page' + (wiki_page ? '' : ' new'))) | |
345 | else |
|
345 | else | |
346 | # project or wiki doesn't exist |
|
346 | # project or wiki doesn't exist | |
347 | title || page |
|
347 | title || page | |
348 | end |
|
348 | end | |
349 | else |
|
349 | else | |
350 | all |
|
350 | all | |
351 | end |
|
351 | end | |
352 | end |
|
352 | end | |
353 |
|
353 | |||
354 | # Redmine links |
|
354 | # Redmine links | |
355 | # |
|
355 | # | |
356 | # Examples: |
|
356 | # Examples: | |
357 | # Issues: |
|
357 | # Issues: | |
358 | # #52 -> Link to issue #52 |
|
358 | # #52 -> Link to issue #52 | |
359 | # Changesets: |
|
359 | # Changesets: | |
360 | # r52 -> Link to revision 52 |
|
360 | # r52 -> Link to revision 52 | |
361 | # commit:a85130f -> Link to scmid starting with a85130f |
|
361 | # commit:a85130f -> Link to scmid starting with a85130f | |
362 | # Documents: |
|
362 | # Documents: | |
363 | # document#17 -> Link to document with id 17 |
|
363 | # document#17 -> Link to document with id 17 | |
364 | # document:Greetings -> Link to the document with title "Greetings" |
|
364 | # document:Greetings -> Link to the document with title "Greetings" | |
365 | # document:"Some document" -> Link to the document with title "Some document" |
|
365 | # document:"Some document" -> Link to the document with title "Some document" | |
366 | # Versions: |
|
366 | # Versions: | |
367 | # version#3 -> Link to version with id 3 |
|
367 | # version#3 -> Link to version with id 3 | |
368 | # version:1.0.0 -> Link to version named "1.0.0" |
|
368 | # version:1.0.0 -> Link to version named "1.0.0" | |
369 | # version:"1.0 beta 2" -> Link to version named "1.0 beta 2" |
|
369 | # version:"1.0 beta 2" -> Link to version named "1.0 beta 2" | |
370 | # Attachments: |
|
370 | # Attachments: | |
371 | # attachment:file.zip -> Link to the attachment of the current object named file.zip |
|
371 | # attachment:file.zip -> Link to the attachment of the current object named file.zip | |
372 | # Source files: |
|
372 | # Source files: | |
373 | # source:some/file -> Link to the file located at /some/file in the project's repository |
|
373 | # source:some/file -> Link to the file located at /some/file in the project's repository | |
374 | # source:some/file@52 -> Link to the file's revision 52 |
|
374 | # source:some/file@52 -> Link to the file's revision 52 | |
375 | # source:some/file#L120 -> Link to line 120 of the file |
|
375 | # source:some/file#L120 -> Link to line 120 of the file | |
376 | # source:some/file@52#L120 -> Link to line 120 of the file's revision 52 |
|
376 | # source:some/file@52#L120 -> Link to line 120 of the file's revision 52 | |
377 | # export:some/file -> Force the download of the file |
|
377 | # export:some/file -> Force the download of the file | |
378 | # Forum messages: |
|
378 | # Forum messages: | |
379 | # message#1218 -> Link to message with id 1218 |
|
379 | # message#1218 -> Link to message with id 1218 | |
380 | text = text.gsub(%r{([\s\(,\-\>]|^)(!)?(attachment|document|version|commit|source|export|message)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|\s|<|$)}) do |m| |
|
380 | text = text.gsub(%r{([\s\(,\-\>]|^)(!)?(attachment|document|version|commit|source|export|message)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|\s|<|$)}) do |m| | |
381 | leading, esc, prefix, sep, oid = $1, $2, $3, $5 || $7, $6 || $8 |
|
381 | leading, esc, prefix, sep, oid = $1, $2, $3, $5 || $7, $6 || $8 | |
382 | link = nil |
|
382 | link = nil | |
383 | if esc.nil? |
|
383 | if esc.nil? | |
384 | if prefix.nil? && sep == 'r' |
|
384 | if prefix.nil? && sep == 'r' | |
385 | if project && (changeset = project.changesets.find_by_revision(oid)) |
|
385 | if project && (changeset = project.changesets.find_by_revision(oid)) | |
386 | link = link_to("r#{oid}", {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => oid}, |
|
386 | link = link_to("r#{oid}", {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => oid}, | |
387 | :class => 'changeset', |
|
387 | :class => 'changeset', | |
388 | :title => truncate_single_line(changeset.comments, 100)) |
|
388 | :title => truncate_single_line(changeset.comments, 100)) | |
389 | end |
|
389 | end | |
390 | elsif sep == '#' |
|
390 | elsif sep == '#' | |
391 | oid = oid.to_i |
|
391 | oid = oid.to_i | |
392 | case prefix |
|
392 | case prefix | |
393 | when nil |
|
393 | when nil | |
394 | if issue = Issue.find_by_id(oid, :include => [:project, :status], :conditions => Project.visible_by(User.current)) |
|
394 | if issue = Issue.find_by_id(oid, :include => [:project, :status], :conditions => Project.visible_by(User.current)) | |
395 | link = link_to("##{oid}", {:only_path => only_path, :controller => 'issues', :action => 'show', :id => oid}, |
|
395 | link = link_to("##{oid}", {:only_path => only_path, :controller => 'issues', :action => 'show', :id => oid}, | |
396 | :class => (issue.closed? ? 'issue closed' : 'issue'), |
|
396 | :class => (issue.closed? ? 'issue closed' : 'issue'), | |
397 | :title => "#{truncate(issue.subject, 100)} (#{issue.status.name})") |
|
397 | :title => "#{truncate(issue.subject, 100)} (#{issue.status.name})") | |
398 | link = content_tag('del', link) if issue.closed? |
|
398 | link = content_tag('del', link) if issue.closed? | |
399 | end |
|
399 | end | |
400 | when 'document' |
|
400 | when 'document' | |
401 | if document = Document.find_by_id(oid, :include => [:project], :conditions => Project.visible_by(User.current)) |
|
401 | if document = Document.find_by_id(oid, :include => [:project], :conditions => Project.visible_by(User.current)) | |
402 | link = link_to h(document.title), {:only_path => only_path, :controller => 'documents', :action => 'show', :id => document}, |
|
402 | link = link_to h(document.title), {:only_path => only_path, :controller => 'documents', :action => 'show', :id => document}, | |
403 | :class => 'document' |
|
403 | :class => 'document' | |
404 | end |
|
404 | end | |
405 | when 'version' |
|
405 | when 'version' | |
406 | if version = Version.find_by_id(oid, :include => [:project], :conditions => Project.visible_by(User.current)) |
|
406 | if version = Version.find_by_id(oid, :include => [:project], :conditions => Project.visible_by(User.current)) | |
407 | link = link_to h(version.name), {:only_path => only_path, :controller => 'versions', :action => 'show', :id => version}, |
|
407 | link = link_to h(version.name), {:only_path => only_path, :controller => 'versions', :action => 'show', :id => version}, | |
408 | :class => 'version' |
|
408 | :class => 'version' | |
409 | end |
|
409 | end | |
410 | when 'message' |
|
410 | when 'message' | |
411 | if message = Message.find_by_id(oid, :include => [:parent, {:board => :project}], :conditions => Project.visible_by(User.current)) |
|
411 | if message = Message.find_by_id(oid, :include => [:parent, {:board => :project}], :conditions => Project.visible_by(User.current)) | |
412 | link = link_to h(truncate(message.subject, 60)), {:only_path => only_path, |
|
412 | link = link_to h(truncate(message.subject, 60)), {:only_path => only_path, | |
413 | :controller => 'messages', |
|
413 | :controller => 'messages', | |
414 | :action => 'show', |
|
414 | :action => 'show', | |
415 | :board_id => message.board, |
|
415 | :board_id => message.board, | |
416 | :id => message.root, |
|
416 | :id => message.root, | |
417 | :anchor => (message.parent ? "message-#{message.id}" : nil)}, |
|
417 | :anchor => (message.parent ? "message-#{message.id}" : nil)}, | |
418 | :class => 'message' |
|
418 | :class => 'message' | |
419 | end |
|
419 | end | |
420 | end |
|
420 | end | |
421 | elsif sep == ':' |
|
421 | elsif sep == ':' | |
422 | # removes the double quotes if any |
|
422 | # removes the double quotes if any | |
423 | name = oid.gsub(%r{^"(.*)"$}, "\\1") |
|
423 | name = oid.gsub(%r{^"(.*)"$}, "\\1") | |
424 | case prefix |
|
424 | case prefix | |
425 | when 'document' |
|
425 | when 'document' | |
426 | if project && document = project.documents.find_by_title(name) |
|
426 | if project && document = project.documents.find_by_title(name) | |
427 | link = link_to h(document.title), {:only_path => only_path, :controller => 'documents', :action => 'show', :id => document}, |
|
427 | link = link_to h(document.title), {:only_path => only_path, :controller => 'documents', :action => 'show', :id => document}, | |
428 | :class => 'document' |
|
428 | :class => 'document' | |
429 | end |
|
429 | end | |
430 | when 'version' |
|
430 | when 'version' | |
431 | if project && version = project.versions.find_by_name(name) |
|
431 | if project && version = project.versions.find_by_name(name) | |
432 | link = link_to h(version.name), {:only_path => only_path, :controller => 'versions', :action => 'show', :id => version}, |
|
432 | link = link_to h(version.name), {:only_path => only_path, :controller => 'versions', :action => 'show', :id => version}, | |
433 | :class => 'version' |
|
433 | :class => 'version' | |
434 | end |
|
434 | end | |
435 | when 'commit' |
|
435 | when 'commit' | |
436 | if project && (changeset = project.changesets.find(:first, :conditions => ["scmid LIKE ?", "#{name}%"])) |
|
436 | if project && (changeset = project.changesets.find(:first, :conditions => ["scmid LIKE ?", "#{name}%"])) | |
437 | link = link_to h("#{name}"), {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => changeset.revision}, |
|
437 | link = link_to h("#{name}"), {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => changeset.revision}, | |
438 | :class => 'changeset', |
|
438 | :class => 'changeset', | |
439 | :title => truncate_single_line(changeset.comments, 100) |
|
439 | :title => truncate_single_line(changeset.comments, 100) | |
440 | end |
|
440 | end | |
441 | when 'source', 'export' |
|
441 | when 'source', 'export' | |
442 | if project && project.repository |
|
442 | if project && project.repository | |
443 | name =~ %r{^[/\\]*(.*?)(@([0-9a-f]+))?(#(L\d+))?$} |
|
443 | name =~ %r{^[/\\]*(.*?)(@([0-9a-f]+))?(#(L\d+))?$} | |
444 | path, rev, anchor = $1, $3, $5 |
|
444 | path, rev, anchor = $1, $3, $5 | |
445 | link = link_to h("#{prefix}:#{name}"), {:controller => 'repositories', :action => 'entry', :id => project, |
|
445 | link = link_to h("#{prefix}:#{name}"), {:controller => 'repositories', :action => 'entry', :id => project, | |
446 | :path => to_path_param(path), |
|
446 | :path => to_path_param(path), | |
447 | :rev => rev, |
|
447 | :rev => rev, | |
448 | :anchor => anchor, |
|
448 | :anchor => anchor, | |
449 | :format => (prefix == 'export' ? 'raw' : nil)}, |
|
449 | :format => (prefix == 'export' ? 'raw' : nil)}, | |
450 | :class => (prefix == 'export' ? 'source download' : 'source') |
|
450 | :class => (prefix == 'export' ? 'source download' : 'source') | |
451 | end |
|
451 | end | |
452 | when 'attachment' |
|
452 | when 'attachment' | |
453 | if attachments && attachment = attachments.detect {|a| a.filename == name } |
|
453 | if attachments && attachment = attachments.detect {|a| a.filename == name } | |
454 | link = link_to h(attachment.filename), {:only_path => only_path, :controller => 'attachments', :action => 'download', :id => attachment}, |
|
454 | link = link_to h(attachment.filename), {:only_path => only_path, :controller => 'attachments', :action => 'download', :id => attachment}, | |
455 | :class => 'attachment' |
|
455 | :class => 'attachment' | |
456 | end |
|
456 | end | |
457 | end |
|
457 | end | |
458 | end |
|
458 | end | |
459 | end |
|
459 | end | |
460 | leading + (link || "#{prefix}#{sep}#{oid}") |
|
460 | leading + (link || "#{prefix}#{sep}#{oid}") | |
461 | end |
|
461 | end | |
462 |
|
462 | |||
463 | text |
|
463 | text | |
464 | end |
|
464 | end | |
465 |
|
465 | |||
466 | # Same as Rails' simple_format helper without using paragraphs |
|
466 | # Same as Rails' simple_format helper without using paragraphs | |
467 | def simple_format_without_paragraph(text) |
|
467 | def simple_format_without_paragraph(text) | |
468 | text.to_s. |
|
468 | text.to_s. | |
469 | gsub(/\r\n?/, "\n"). # \r\n and \r -> \n |
|
469 | gsub(/\r\n?/, "\n"). # \r\n and \r -> \n | |
470 | gsub(/\n\n+/, "<br /><br />"). # 2+ newline -> 2 br |
|
470 | gsub(/\n\n+/, "<br /><br />"). # 2+ newline -> 2 br | |
471 | gsub(/([^\n]\n)(?=[^\n])/, '\1<br />') # 1 newline -> br |
|
471 | gsub(/([^\n]\n)(?=[^\n])/, '\1<br />') # 1 newline -> br | |
472 | end |
|
472 | end | |
473 |
|
473 | |||
474 | def error_messages_for(object_name, options = {}) |
|
474 | def error_messages_for(object_name, options = {}) | |
475 | options = options.symbolize_keys |
|
475 | options = options.symbolize_keys | |
476 | object = instance_variable_get("@#{object_name}") |
|
476 | object = instance_variable_get("@#{object_name}") | |
477 | if object && !object.errors.empty? |
|
477 | if object && !object.errors.empty? | |
478 | # build full_messages here with controller current language |
|
478 | # build full_messages here with controller current language | |
479 | full_messages = [] |
|
479 | full_messages = [] | |
480 | object.errors.each do |attr, msg| |
|
480 | object.errors.each do |attr, msg| | |
481 | next if msg.nil? |
|
481 | next if msg.nil? | |
482 | msg = msg.first if msg.is_a? Array |
|
482 | msg = msg.first if msg.is_a? Array | |
483 | if attr == "base" |
|
483 | if attr == "base" | |
484 | full_messages << l(msg) |
|
484 | full_messages << l(msg) | |
485 | else |
|
485 | else | |
486 | full_messages << "« " + (l_has_string?("field_" + attr) ? l("field_" + attr) : object.class.human_attribute_name(attr)) + " » " + l(msg) unless attr == "custom_values" |
|
486 | full_messages << "« " + (l_has_string?("field_" + attr) ? l("field_" + attr) : object.class.human_attribute_name(attr)) + " » " + l(msg) unless attr == "custom_values" | |
487 | end |
|
487 | end | |
488 | end |
|
488 | end | |
489 | # retrieve custom values error messages |
|
489 | # retrieve custom values error messages | |
490 | if object.errors[:custom_values] |
|
490 | if object.errors[:custom_values] | |
491 | object.custom_values.each do |v| |
|
491 | object.custom_values.each do |v| | |
492 | v.errors.each do |attr, msg| |
|
492 | v.errors.each do |attr, msg| | |
493 | next if msg.nil? |
|
493 | next if msg.nil? | |
494 | msg = msg.first if msg.is_a? Array |
|
494 | msg = msg.first if msg.is_a? Array | |
495 | full_messages << "« " + v.custom_field.name + " » " + l(msg) |
|
495 | full_messages << "« " + v.custom_field.name + " » " + l(msg) | |
496 | end |
|
496 | end | |
497 | end |
|
497 | end | |
498 | end |
|
498 | end | |
499 | content_tag("div", |
|
499 | content_tag("div", | |
500 | content_tag( |
|
500 | content_tag( | |
501 | options[:header_tag] || "span", lwr(:gui_validation_error, full_messages.length) + ":" |
|
501 | options[:header_tag] || "span", lwr(:gui_validation_error, full_messages.length) + ":" | |
502 | ) + |
|
502 | ) + | |
503 | content_tag("ul", full_messages.collect { |msg| content_tag("li", msg) }), |
|
503 | content_tag("ul", full_messages.collect { |msg| content_tag("li", msg) }), | |
504 | "id" => options[:id] || "errorExplanation", "class" => options[:class] || "errorExplanation" |
|
504 | "id" => options[:id] || "errorExplanation", "class" => options[:class] || "errorExplanation" | |
505 | ) |
|
505 | ) | |
506 | else |
|
506 | else | |
507 | "" |
|
507 | "" | |
508 | end |
|
508 | end | |
509 | end |
|
509 | end | |
510 |
|
510 | |||
511 | def lang_options_for_select(blank=true) |
|
511 | def lang_options_for_select(blank=true) | |
512 | (blank ? [["(auto)", ""]] : []) + |
|
512 | (blank ? [["(auto)", ""]] : []) + | |
513 | GLoc.valid_languages.collect{|lang| [ ll(lang.to_s, :general_lang_name), lang.to_s]}.sort{|x,y| x.last <=> y.last } |
|
513 | GLoc.valid_languages.collect{|lang| [ ll(lang.to_s, :general_lang_name), lang.to_s]}.sort{|x,y| x.last <=> y.last } | |
514 | end |
|
514 | end | |
515 |
|
515 | |||
516 | def label_tag_for(name, option_tags = nil, options = {}) |
|
516 | def label_tag_for(name, option_tags = nil, options = {}) | |
517 | label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "") |
|
517 | label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "") | |
518 | content_tag("label", label_text) |
|
518 | content_tag("label", label_text) | |
519 | end |
|
519 | end | |
520 |
|
520 | |||
521 | def labelled_tabular_form_for(name, object, options, &proc) |
|
521 | def labelled_tabular_form_for(name, object, options, &proc) | |
522 | options[:html] ||= {} |
|
522 | options[:html] ||= {} | |
523 | options[:html][:class] = 'tabular' unless options[:html].has_key?(:class) |
|
523 | options[:html][:class] = 'tabular' unless options[:html].has_key?(:class) | |
524 | form_for(name, object, options.merge({ :builder => TabularFormBuilder, :lang => current_language}), &proc) |
|
524 | form_for(name, object, options.merge({ :builder => TabularFormBuilder, :lang => current_language}), &proc) | |
525 | end |
|
525 | end | |
526 |
|
526 | |||
527 | def back_url_hidden_field_tag |
|
527 | def back_url_hidden_field_tag | |
528 | back_url = params[:back_url] || request.env['HTTP_REFERER'] |
|
528 | back_url = params[:back_url] || request.env['HTTP_REFERER'] | |
|
529 | back_url = CGI.unescape(back_url.to_s) | |||
529 | hidden_field_tag('back_url', CGI.escape(back_url)) unless back_url.blank? |
|
530 | hidden_field_tag('back_url', CGI.escape(back_url)) unless back_url.blank? | |
530 | end |
|
531 | end | |
531 |
|
532 | |||
532 | def check_all_links(form_name) |
|
533 | def check_all_links(form_name) | |
533 | link_to_function(l(:button_check_all), "checkAll('#{form_name}', true)") + |
|
534 | link_to_function(l(:button_check_all), "checkAll('#{form_name}', true)") + | |
534 | " | " + |
|
535 | " | " + | |
535 | link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)") |
|
536 | link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)") | |
536 | end |
|
537 | end | |
537 |
|
538 | |||
538 | def progress_bar(pcts, options={}) |
|
539 | def progress_bar(pcts, options={}) | |
539 | pcts = [pcts, pcts] unless pcts.is_a?(Array) |
|
540 | pcts = [pcts, pcts] unless pcts.is_a?(Array) | |
540 | pcts[1] = pcts[1] - pcts[0] |
|
541 | pcts[1] = pcts[1] - pcts[0] | |
541 | pcts << (100 - pcts[1] - pcts[0]) |
|
542 | pcts << (100 - pcts[1] - pcts[0]) | |
542 | width = options[:width] || '100px;' |
|
543 | width = options[:width] || '100px;' | |
543 | legend = options[:legend] || '' |
|
544 | legend = options[:legend] || '' | |
544 | content_tag('table', |
|
545 | content_tag('table', | |
545 | content_tag('tr', |
|
546 | content_tag('tr', | |
546 | (pcts[0] > 0 ? content_tag('td', '', :style => "width: #{pcts[0].floor}%;", :class => 'closed') : '') + |
|
547 | (pcts[0] > 0 ? content_tag('td', '', :style => "width: #{pcts[0].floor}%;", :class => 'closed') : '') + | |
547 | (pcts[1] > 0 ? content_tag('td', '', :style => "width: #{pcts[1].floor}%;", :class => 'done') : '') + |
|
548 | (pcts[1] > 0 ? content_tag('td', '', :style => "width: #{pcts[1].floor}%;", :class => 'done') : '') + | |
548 | (pcts[2] > 0 ? content_tag('td', '', :style => "width: #{pcts[2].floor}%;", :class => 'todo') : '') |
|
549 | (pcts[2] > 0 ? content_tag('td', '', :style => "width: #{pcts[2].floor}%;", :class => 'todo') : '') | |
549 | ), :class => 'progress', :style => "width: #{width};") + |
|
550 | ), :class => 'progress', :style => "width: #{width};") + | |
550 | content_tag('p', legend, :class => 'pourcent') |
|
551 | content_tag('p', legend, :class => 'pourcent') | |
551 | end |
|
552 | end | |
552 |
|
553 | |||
553 | def context_menu_link(name, url, options={}) |
|
554 | def context_menu_link(name, url, options={}) | |
554 | options[:class] ||= '' |
|
555 | options[:class] ||= '' | |
555 | if options.delete(:selected) |
|
556 | if options.delete(:selected) | |
556 | options[:class] << ' icon-checked disabled' |
|
557 | options[:class] << ' icon-checked disabled' | |
557 | options[:disabled] = true |
|
558 | options[:disabled] = true | |
558 | end |
|
559 | end | |
559 | if options.delete(:disabled) |
|
560 | if options.delete(:disabled) | |
560 | options.delete(:method) |
|
561 | options.delete(:method) | |
561 | options.delete(:confirm) |
|
562 | options.delete(:confirm) | |
562 | options.delete(:onclick) |
|
563 | options.delete(:onclick) | |
563 | options[:class] << ' disabled' |
|
564 | options[:class] << ' disabled' | |
564 | url = '#' |
|
565 | url = '#' | |
565 | end |
|
566 | end | |
566 | link_to name, url, options |
|
567 | link_to name, url, options | |
567 | end |
|
568 | end | |
568 |
|
569 | |||
569 | def calendar_for(field_id) |
|
570 | def calendar_for(field_id) | |
570 | include_calendar_headers_tags |
|
571 | include_calendar_headers_tags | |
571 | image_tag("calendar.png", {:id => "#{field_id}_trigger",:class => "calendar-trigger"}) + |
|
572 | image_tag("calendar.png", {:id => "#{field_id}_trigger",:class => "calendar-trigger"}) + | |
572 | javascript_tag("Calendar.setup({inputField : '#{field_id}', ifFormat : '%Y-%m-%d', button : '#{field_id}_trigger' });") |
|
573 | javascript_tag("Calendar.setup({inputField : '#{field_id}', ifFormat : '%Y-%m-%d', button : '#{field_id}_trigger' });") | |
573 | end |
|
574 | end | |
574 |
|
575 | |||
575 | def include_calendar_headers_tags |
|
576 | def include_calendar_headers_tags | |
576 | unless @calendar_headers_tags_included |
|
577 | unless @calendar_headers_tags_included | |
577 | @calendar_headers_tags_included = true |
|
578 | @calendar_headers_tags_included = true | |
578 | content_for :header_tags do |
|
579 | content_for :header_tags do | |
579 | javascript_include_tag('calendar/calendar') + |
|
580 | javascript_include_tag('calendar/calendar') + | |
580 | javascript_include_tag("calendar/lang/calendar-#{current_language}.js") + |
|
581 | javascript_include_tag("calendar/lang/calendar-#{current_language}.js") + | |
581 | javascript_include_tag('calendar/calendar-setup') + |
|
582 | javascript_include_tag('calendar/calendar-setup') + | |
582 | stylesheet_link_tag('calendar') |
|
583 | stylesheet_link_tag('calendar') | |
583 | end |
|
584 | end | |
584 | end |
|
585 | end | |
585 | end |
|
586 | end | |
586 |
|
587 | |||
587 | def content_for(name, content = nil, &block) |
|
588 | def content_for(name, content = nil, &block) | |
588 | @has_content ||= {} |
|
589 | @has_content ||= {} | |
589 | @has_content[name] = true |
|
590 | @has_content[name] = true | |
590 | super(name, content, &block) |
|
591 | super(name, content, &block) | |
591 | end |
|
592 | end | |
592 |
|
593 | |||
593 | def has_content?(name) |
|
594 | def has_content?(name) | |
594 | (@has_content && @has_content[name]) || false |
|
595 | (@has_content && @has_content[name]) || false | |
595 | end |
|
596 | end | |
596 |
|
597 | |||
597 | # Returns the avatar image tag for the given +user+ if avatars are enabled |
|
598 | # Returns the avatar image tag for the given +user+ if avatars are enabled | |
598 | # +user+ can be a User or a string that will be scanned for an email address (eg. 'joe <joe@foo.bar>') |
|
599 | # +user+ can be a User or a string that will be scanned for an email address (eg. 'joe <joe@foo.bar>') | |
599 | def avatar(user, options = { }) |
|
600 | def avatar(user, options = { }) | |
600 | if Setting.gravatar_enabled? |
|
601 | if Setting.gravatar_enabled? | |
601 | email = nil |
|
602 | email = nil | |
602 | if user.respond_to?(:mail) |
|
603 | if user.respond_to?(:mail) | |
603 | email = user.mail |
|
604 | email = user.mail | |
604 | elsif user.to_s =~ %r{<(.+?)>} |
|
605 | elsif user.to_s =~ %r{<(.+?)>} | |
605 | email = $1 |
|
606 | email = $1 | |
606 | end |
|
607 | end | |
607 | return gravatar(email.to_s.downcase, options) unless email.blank? rescue nil |
|
608 | return gravatar(email.to_s.downcase, options) unless email.blank? rescue nil | |
608 | end |
|
609 | end | |
609 | end |
|
610 | end | |
610 |
|
611 | |||
611 | private |
|
612 | private | |
612 |
|
613 | |||
613 | def wiki_helper |
|
614 | def wiki_helper | |
614 | helper = Redmine::WikiFormatting.helper_for(Setting.text_formatting) |
|
615 | helper = Redmine::WikiFormatting.helper_for(Setting.text_formatting) | |
615 | extend helper |
|
616 | extend helper | |
616 | return self |
|
617 | return self | |
617 | end |
|
618 | end | |
618 | end |
|
619 | end |
@@ -1,699 +1,699 | |||||
1 | _gloc_rule_default: '|n| n==1 ? "" : "_plural" ' |
|
1 | _gloc_rule_default: '|n| n==1 ? "" : "_plural" ' | |
2 |
|
2 | |||
3 | actionview_datehelper_select_day_prefix: |
|
3 | actionview_datehelper_select_day_prefix: | |
4 | actionview_datehelper_select_month_names: Janeiro,Fevereiro,MarΓ§o,Abril,Maio,Junho,Julho,Agosto,Setembro,Outubro,Novembro,Dezembro |
|
4 | actionview_datehelper_select_month_names: Janeiro,Fevereiro,MarΓ§o,Abril,Maio,Junho,Julho,Agosto,Setembro,Outubro,Novembro,Dezembro | |
5 | actionview_datehelper_select_month_names_abbr: Jan,Fev,Mar,Abr,Mai,Jun,Jul,Ago,Set,Out,Nov,Dez |
|
5 | actionview_datehelper_select_month_names_abbr: Jan,Fev,Mar,Abr,Mai,Jun,Jul,Ago,Set,Out,Nov,Dez | |
6 | actionview_datehelper_select_month_prefix: |
|
6 | actionview_datehelper_select_month_prefix: | |
7 | actionview_datehelper_select_year_prefix: |
|
7 | actionview_datehelper_select_year_prefix: | |
8 | actionview_datehelper_time_in_words_day: 1 dia |
|
8 | actionview_datehelper_time_in_words_day: 1 dia | |
9 | actionview_datehelper_time_in_words_day_plural: %d dias |
|
9 | actionview_datehelper_time_in_words_day_plural: %d dias | |
10 | actionview_datehelper_time_in_words_hour_about: aproximadamente uma hora |
|
10 | actionview_datehelper_time_in_words_hour_about: aproximadamente uma hora | |
11 | actionview_datehelper_time_in_words_hour_about_plural: aproximadamente %d horas |
|
11 | actionview_datehelper_time_in_words_hour_about_plural: aproximadamente %d horas | |
12 | actionview_datehelper_time_in_words_hour_about_single: aproximadamente uma hora |
|
12 | actionview_datehelper_time_in_words_hour_about_single: aproximadamente uma hora | |
13 | actionview_datehelper_time_in_words_minute: 1 minuto |
|
13 | actionview_datehelper_time_in_words_minute: 1 minuto | |
14 | actionview_datehelper_time_in_words_minute_half: meio minuto |
|
14 | actionview_datehelper_time_in_words_minute_half: meio minuto | |
15 | actionview_datehelper_time_in_words_minute_less_than: menos de um minuto |
|
15 | actionview_datehelper_time_in_words_minute_less_than: menos de um minuto | |
16 | actionview_datehelper_time_in_words_minute_plural: %d minutos |
|
16 | actionview_datehelper_time_in_words_minute_plural: %d minutos | |
17 | actionview_datehelper_time_in_words_minute_single: 1 minuto |
|
17 | actionview_datehelper_time_in_words_minute_single: 1 minuto | |
18 | actionview_datehelper_time_in_words_second_less_than: menos de um segundo |
|
18 | actionview_datehelper_time_in_words_second_less_than: menos de um segundo | |
19 | actionview_datehelper_time_in_words_second_less_than_plural: menos de %d segundos |
|
19 | actionview_datehelper_time_in_words_second_less_than_plural: menos de %d segundos | |
20 | actionview_instancetag_blank_option: Selecione |
|
20 | actionview_instancetag_blank_option: Selecione | |
21 |
|
21 | |||
22 | activerecord_error_inclusion: nΓ£o estΓ‘ incluso na lista |
|
22 | activerecord_error_inclusion: nΓ£o estΓ‘ incluso na lista | |
23 | activerecord_error_exclusion: estΓ‘ reservado |
|
23 | activerecord_error_exclusion: estΓ‘ reservado | |
24 | activerecord_error_invalid: Γ© invΓ‘lido |
|
24 | activerecord_error_invalid: Γ© invΓ‘lido | |
25 | activerecord_error_confirmation: confirmaΓ§Γ£o nΓ£o confere |
|
25 | activerecord_error_confirmation: confirmaΓ§Γ£o nΓ£o confere | |
26 | activerecord_error_accepted: deve ser aceito |
|
26 | activerecord_error_accepted: deve ser aceito | |
27 | activerecord_error_empty: nΓ£o pode ficar vazio |
|
27 | activerecord_error_empty: nΓ£o pode ficar vazio | |
28 | activerecord_error_blank: nΓ£o pode ficar em branco |
|
28 | activerecord_error_blank: nΓ£o pode ficar em branco | |
29 | activerecord_error_too_long: Γ© muito longo |
|
29 | activerecord_error_too_long: Γ© muito longo | |
30 | activerecord_error_too_short: Γ© muito curto |
|
30 | activerecord_error_too_short: Γ© muito curto | |
31 | activerecord_error_wrong_length: esta com o tamanho errado |
|
31 | activerecord_error_wrong_length: esta com o tamanho errado | |
32 | activerecord_error_taken: jΓ‘ estΓ‘ em uso |
|
32 | activerecord_error_taken: jΓ‘ estΓ‘ em uso | |
33 | activerecord_error_not_a_number: nΓ£o Γ© um nΓΊmero |
|
33 | activerecord_error_not_a_number: nΓ£o Γ© um nΓΊmero | |
34 | activerecord_error_not_a_date: nΓ£o Γ© uma data vΓ‘lida |
|
34 | activerecord_error_not_a_date: nΓ£o Γ© uma data vΓ‘lida | |
35 | activerecord_error_greater_than_start_date: deve ser maior que a data inicial |
|
35 | activerecord_error_greater_than_start_date: deve ser maior que a data inicial | |
36 | activerecord_error_not_same_project: nΓ£o pertence ao mesmo projeto |
|
36 | activerecord_error_not_same_project: nΓ£o pertence ao mesmo projeto | |
37 | activerecord_error_circular_dependency: Esta relaΓ§Γ£o geraria uma dependΓͺncia circular |
|
37 | activerecord_error_circular_dependency: Esta relaΓ§Γ£o geraria uma dependΓͺncia circular | |
38 |
|
38 | |||
39 | general_fmt_age: %d ano |
|
39 | general_fmt_age: %d ano | |
40 | general_fmt_age_plural: %d anos |
|
40 | general_fmt_age_plural: %d anos | |
41 | general_fmt_date: %%d/%%m/%%Y |
|
41 | general_fmt_date: %%d/%%m/%%Y | |
42 | general_fmt_datetime: %%d/%%m/%%Y %%I:%%M %%p |
|
42 | general_fmt_datetime: %%d/%%m/%%Y %%I:%%M %%p | |
43 | general_fmt_datetime_short: %%b %%d, %%I:%%M %%p |
|
43 | general_fmt_datetime_short: %%b %%d, %%I:%%M %%p | |
44 | general_fmt_time: %%I:%%M %%p |
|
44 | general_fmt_time: %%I:%%M %%p | |
45 | general_text_No: 'NΓ£o' |
|
45 | general_text_No: 'NΓ£o' | |
46 | general_text_Yes: 'Sim' |
|
46 | general_text_Yes: 'Sim' | |
47 | general_text_no: 'nΓ£o' |
|
47 | general_text_no: 'nΓ£o' | |
48 | general_text_yes: 'sim' |
|
48 | general_text_yes: 'sim' | |
49 | general_lang_name: 'PortuguΓͺs(Brasil)' |
|
49 | general_lang_name: 'PortuguΓͺs(Brasil)' | |
50 |
general_csv_separator: ' |
|
50 | general_csv_separator: ';' | |
51 |
general_csv_decimal_separator: ' |
|
51 | general_csv_decimal_separator: ',' | |
52 | general_csv_encoding: ISO-8859-1 |
|
52 | general_csv_encoding: ISO-8859-1 | |
53 | general_pdf_encoding: ISO-8859-1 |
|
53 | general_pdf_encoding: ISO-8859-1 | |
54 | general_day_names: Segunda,TerΓ§a,Quarta,Quinta,Sexta,SΓ‘bado,Domingo |
|
54 | general_day_names: Segunda,TerΓ§a,Quarta,Quinta,Sexta,SΓ‘bado,Domingo | |
55 | general_first_day_of_week: '1' |
|
55 | general_first_day_of_week: '1' | |
56 |
|
56 | |||
57 | notice_account_updated: Conta atualizada com sucesso. |
|
57 | notice_account_updated: Conta atualizada com sucesso. | |
58 | notice_account_invalid_creditentials: UsuΓ‘rio ou senha invΓ‘lido. |
|
58 | notice_account_invalid_creditentials: UsuΓ‘rio ou senha invΓ‘lido. | |
59 | notice_account_password_updated: Senha alterada com sucesso. |
|
59 | notice_account_password_updated: Senha alterada com sucesso. | |
60 | notice_account_wrong_password: Senha invΓ‘lida. |
|
60 | notice_account_wrong_password: Senha invΓ‘lida. | |
61 | notice_account_register_done: Conta criada com sucesso. Para ativar sua conta, clique no link que lhe foi enviado por e-mail. |
|
61 | notice_account_register_done: Conta criada com sucesso. Para ativar sua conta, clique no link que lhe foi enviado por e-mail. | |
62 | notice_account_unknown_email: UsuΓ‘rio desconhecido. |
|
62 | notice_account_unknown_email: UsuΓ‘rio desconhecido. | |
63 | notice_can_t_change_password: Esta conta utiliza autenticaΓ§Γ£o externa. NΓ£o Γ© possΓvel alterar a senha. |
|
63 | notice_can_t_change_password: Esta conta utiliza autenticaΓ§Γ£o externa. NΓ£o Γ© possΓvel alterar a senha. | |
64 | notice_account_lost_email_sent: Um email com instruΓ§Γ΅es para escolher uma nova senha foi enviado para vocΓͺ. |
|
64 | notice_account_lost_email_sent: Um email com instruΓ§Γ΅es para escolher uma nova senha foi enviado para vocΓͺ. | |
65 | notice_account_activated: Sua conta foi ativada. VocΓͺ pode acessΓ‘-la agora. |
|
65 | notice_account_activated: Sua conta foi ativada. VocΓͺ pode acessΓ‘-la agora. | |
66 | notice_successful_create: Criado com sucesso. |
|
66 | notice_successful_create: Criado com sucesso. | |
67 | notice_successful_update: Alterado com sucesso. |
|
67 | notice_successful_update: Alterado com sucesso. | |
68 | notice_successful_delete: ExcluΓdo com sucesso. |
|
68 | notice_successful_delete: ExcluΓdo com sucesso. | |
69 | notice_successful_connection: Conectado com sucesso. |
|
69 | notice_successful_connection: Conectado com sucesso. | |
70 | notice_file_not_found: A pΓ‘gina que vocΓͺ estΓ‘ tentando acessar nΓ£o existe ou foi excluΓda. |
|
70 | notice_file_not_found: A pΓ‘gina que vocΓͺ estΓ‘ tentando acessar nΓ£o existe ou foi excluΓda. | |
71 | notice_locking_conflict: Os dados foram atualizados por outro usuΓ‘rio. |
|
71 | notice_locking_conflict: Os dados foram atualizados por outro usuΓ‘rio. | |
72 | notice_not_authorized: VocΓͺ nΓ£o estΓ‘ autorizado a acessar esta pΓ‘gina. |
|
72 | notice_not_authorized: VocΓͺ nΓ£o estΓ‘ autorizado a acessar esta pΓ‘gina. | |
73 | notice_email_sent: Um email foi enviado para %s |
|
73 | notice_email_sent: Um email foi enviado para %s | |
74 | notice_email_error: Ocorreu um erro ao enviar o e-mail (%s) |
|
74 | notice_email_error: Ocorreu um erro ao enviar o e-mail (%s) | |
75 | notice_feeds_access_key_reseted: Sua chave RSS foi reconfigurada. |
|
75 | notice_feeds_access_key_reseted: Sua chave RSS foi reconfigurada. | |
76 | notice_failed_to_save_issues: "Problema ao salvar %d ticket(s) de %d selecionados: %s." |
|
76 | notice_failed_to_save_issues: "Problema ao salvar %d ticket(s) de %d selecionados: %s." | |
77 | notice_no_issue_selected: "Nenhum ticket selecionado! Por favor, marque os tickets que vocΓͺ deseja editar." |
|
77 | notice_no_issue_selected: "Nenhum ticket selecionado! Por favor, marque os tickets que vocΓͺ deseja editar." | |
78 | notice_account_pending: "Sua conta foi criada e estΓ‘ aguardando aprovaΓ§Γ£o do administrador." |
|
78 | notice_account_pending: "Sua conta foi criada e estΓ‘ aguardando aprovaΓ§Γ£o do administrador." | |
79 | notice_default_data_loaded: ConfiguraΓ§Γ£o padrΓ£o carregada com sucesso. |
|
79 | notice_default_data_loaded: ConfiguraΓ§Γ£o padrΓ£o carregada com sucesso. | |
80 |
|
80 | |||
81 | error_can_t_load_default_data: "ConfiguraΓ§Γ£o padrΓ£o nΓ£o pΓ΄de ser carregada: %s" |
|
81 | error_can_t_load_default_data: "ConfiguraΓ§Γ£o padrΓ£o nΓ£o pΓ΄de ser carregada: %s" | |
82 | error_scm_not_found: "A entrada e/ou a revisΓ£o nΓ£o existe no repositΓ³rio." |
|
82 | error_scm_not_found: "A entrada e/ou a revisΓ£o nΓ£o existe no repositΓ³rio." | |
83 | error_scm_command_failed: "Ocorreu um erro ao tentar acessar o repositΓ³rio: %s" |
|
83 | error_scm_command_failed: "Ocorreu um erro ao tentar acessar o repositΓ³rio: %s" | |
84 | error_scm_annotate: "Esta entrada nΓ£o existe ou nΓ£o pode ser anotada." |
|
84 | error_scm_annotate: "Esta entrada nΓ£o existe ou nΓ£o pode ser anotada." | |
85 | error_issue_not_found_in_project: 'O ticket nΓ£o foi encontrado ou nΓ£o pertence a este projeto' |
|
85 | error_issue_not_found_in_project: 'O ticket nΓ£o foi encontrado ou nΓ£o pertence a este projeto' | |
86 |
|
86 | |||
87 | mail_subject_lost_password: Sua senha do %s. |
|
87 | mail_subject_lost_password: Sua senha do %s. | |
88 | mail_body_lost_password: 'Para mudar sua senha, clique no link abaixo:' |
|
88 | mail_body_lost_password: 'Para mudar sua senha, clique no link abaixo:' | |
89 | mail_subject_register: AtivaΓ§Γ£o de conta do %s. |
|
89 | mail_subject_register: AtivaΓ§Γ£o de conta do %s. | |
90 | mail_body_register: 'Para ativar sua conta, clique no link abaixo:' |
|
90 | mail_body_register: 'Para ativar sua conta, clique no link abaixo:' | |
91 | mail_body_account_information_external: VocΓͺ pode usar sua conta do "%s" para entrar. |
|
91 | mail_body_account_information_external: VocΓͺ pode usar sua conta do "%s" para entrar. | |
92 | mail_body_account_information: InformaΓ§Γ΅es sobre sua conta |
|
92 | mail_body_account_information: InformaΓ§Γ΅es sobre sua conta | |
93 | mail_subject_account_activation_request: %s - RequisiΓ§Γ£o de ativaΓ§Γ£o de conta |
|
93 | mail_subject_account_activation_request: %s - RequisiΓ§Γ£o de ativaΓ§Γ£o de conta | |
94 | mail_body_account_activation_request: 'Um novo usuΓ‘rio (%s) se registrou. A conta estΓ‘ aguardando sua aprovaΓ§Γ£o:' |
|
94 | mail_body_account_activation_request: 'Um novo usuΓ‘rio (%s) se registrou. A conta estΓ‘ aguardando sua aprovaΓ§Γ£o:' | |
95 | mail_subject_reminder: "%d ticket(s) com data prevista para os prΓ³ximos dias" |
|
95 | mail_subject_reminder: "%d ticket(s) com data prevista para os prΓ³ximos dias" | |
96 | mail_body_reminder: "%d tickets(s) para vocΓͺ com data prevista para os prΓ³ximos %d dias:" |
|
96 | mail_body_reminder: "%d tickets(s) para vocΓͺ com data prevista para os prΓ³ximos %d dias:" | |
97 |
|
97 | |||
98 | gui_validation_error: 1 erro |
|
98 | gui_validation_error: 1 erro | |
99 | gui_validation_error_plural: %d erros |
|
99 | gui_validation_error_plural: %d erros | |
100 |
|
100 | |||
101 | field_name: Nome |
|
101 | field_name: Nome | |
102 | field_description: DescriΓ§Γ£o |
|
102 | field_description: DescriΓ§Γ£o | |
103 | field_summary: Resumo |
|
103 | field_summary: Resumo | |
104 | field_is_required: ObrigatΓ³rio |
|
104 | field_is_required: ObrigatΓ³rio | |
105 | field_firstname: Nome |
|
105 | field_firstname: Nome | |
106 | field_lastname: Sobrenome |
|
106 | field_lastname: Sobrenome | |
107 | field_mail: Email |
|
107 | field_mail: Email | |
108 | field_filename: Arquivo |
|
108 | field_filename: Arquivo | |
109 | field_filesize: Tamanho |
|
109 | field_filesize: Tamanho | |
110 | field_downloads: Downloads |
|
110 | field_downloads: Downloads | |
111 | field_author: Autor |
|
111 | field_author: Autor | |
112 | field_created_on: Criado em |
|
112 | field_created_on: Criado em | |
113 | field_updated_on: Alterado em |
|
113 | field_updated_on: Alterado em | |
114 | field_field_format: Formato |
|
114 | field_field_format: Formato | |
115 | field_is_for_all: Para todos os projetos |
|
115 | field_is_for_all: Para todos os projetos | |
116 | field_possible_values: PossΓveis valores |
|
116 | field_possible_values: PossΓveis valores | |
117 | field_regexp: ExpressΓ£o regular |
|
117 | field_regexp: ExpressΓ£o regular | |
118 | field_min_length: Tamanho mΓnimo |
|
118 | field_min_length: Tamanho mΓnimo | |
119 | field_max_length: Tamanho mΓ‘ximo |
|
119 | field_max_length: Tamanho mΓ‘ximo | |
120 | field_value: Valor |
|
120 | field_value: Valor | |
121 | field_category: Categoria |
|
121 | field_category: Categoria | |
122 | field_title: TΓtulo |
|
122 | field_title: TΓtulo | |
123 | field_project: Projeto |
|
123 | field_project: Projeto | |
124 | field_issue: Ticket |
|
124 | field_issue: Ticket | |
125 | field_status: Status |
|
125 | field_status: Status | |
126 | field_notes: Notas |
|
126 | field_notes: Notas | |
127 | field_is_closed: Ticket fechado |
|
127 | field_is_closed: Ticket fechado | |
128 | field_is_default: Status padrΓ£o |
|
128 | field_is_default: Status padrΓ£o | |
129 | field_tracker: Tipo |
|
129 | field_tracker: Tipo | |
130 | field_subject: TΓtulo |
|
130 | field_subject: TΓtulo | |
131 | field_due_date: Data prevista |
|
131 | field_due_date: Data prevista | |
132 | field_assigned_to: AtribuΓdo para |
|
132 | field_assigned_to: AtribuΓdo para | |
133 | field_priority: Prioridade |
|
133 | field_priority: Prioridade | |
134 | field_fixed_version: VersΓ£o |
|
134 | field_fixed_version: VersΓ£o | |
135 | field_user: UsuΓ‘rio |
|
135 | field_user: UsuΓ‘rio | |
136 | field_role: Papel |
|
136 | field_role: Papel | |
137 | field_homepage: PΓ‘gina inicial |
|
137 | field_homepage: PΓ‘gina inicial | |
138 | field_is_public: PΓΊblico |
|
138 | field_is_public: PΓΊblico | |
139 | field_parent: Sub-projeto de |
|
139 | field_parent: Sub-projeto de | |
140 | field_is_in_chlog: Exibir na lista de alteraΓ§Γ΅es |
|
140 | field_is_in_chlog: Exibir na lista de alteraΓ§Γ΅es | |
141 | field_is_in_roadmap: Exibir no planejamento |
|
141 | field_is_in_roadmap: Exibir no planejamento | |
142 | field_login: UsuΓ‘rio |
|
142 | field_login: UsuΓ‘rio | |
143 | field_mail_notification: NotificaΓ§Γ΅es por email |
|
143 | field_mail_notification: NotificaΓ§Γ΅es por email | |
144 | field_admin: Administrador |
|
144 | field_admin: Administrador | |
145 | field_last_login_on: Γltima conexΓ£o |
|
145 | field_last_login_on: Γltima conexΓ£o | |
146 | field_language: Idioma |
|
146 | field_language: Idioma | |
147 | field_effective_date: Data |
|
147 | field_effective_date: Data | |
148 | field_password: Senha |
|
148 | field_password: Senha | |
149 | field_new_password: Nova senha |
|
149 | field_new_password: Nova senha | |
150 | field_password_confirmation: ConfirmaΓ§Γ£o |
|
150 | field_password_confirmation: ConfirmaΓ§Γ£o | |
151 | field_version: VersΓ£o |
|
151 | field_version: VersΓ£o | |
152 | field_type: Tipo |
|
152 | field_type: Tipo | |
153 | field_host: Servidor |
|
153 | field_host: Servidor | |
154 | field_port: Porta |
|
154 | field_port: Porta | |
155 | field_account: Conta |
|
155 | field_account: Conta | |
156 | field_base_dn: DN Base |
|
156 | field_base_dn: DN Base | |
157 | field_attr_login: Atributo para nome de usuΓ‘rio |
|
157 | field_attr_login: Atributo para nome de usuΓ‘rio | |
158 | field_attr_firstname: Atributo para nome |
|
158 | field_attr_firstname: Atributo para nome | |
159 | field_attr_lastname: Atributo para sobrenome |
|
159 | field_attr_lastname: Atributo para sobrenome | |
160 | field_attr_mail: Atributo para email |
|
160 | field_attr_mail: Atributo para email | |
161 | field_onthefly: Criar usuΓ‘rios dinamicamente ("on-the-fly") |
|
161 | field_onthefly: Criar usuΓ‘rios dinamicamente ("on-the-fly") | |
162 | field_start_date: InΓcio |
|
162 | field_start_date: InΓcio | |
163 | field_done_ratio: %% Terminado |
|
163 | field_done_ratio: %% Terminado | |
164 | field_auth_source: Modo de autenticaΓ§Γ£o |
|
164 | field_auth_source: Modo de autenticaΓ§Γ£o | |
165 | field_hide_mail: Ocultar meu email |
|
165 | field_hide_mail: Ocultar meu email | |
166 | field_comments: ComentΓ‘rio |
|
166 | field_comments: ComentΓ‘rio | |
167 | field_url: URL |
|
167 | field_url: URL | |
168 | field_start_page: PΓ‘gina inicial |
|
168 | field_start_page: PΓ‘gina inicial | |
169 | field_subproject: Sub-projeto |
|
169 | field_subproject: Sub-projeto | |
170 | field_hours: Horas |
|
170 | field_hours: Horas | |
171 | field_activity: Atividade |
|
171 | field_activity: Atividade | |
172 | field_spent_on: Data |
|
172 | field_spent_on: Data | |
173 | field_identifier: Identificador |
|
173 | field_identifier: Identificador | |
174 | field_is_filter: Γ um filtro |
|
174 | field_is_filter: Γ um filtro | |
175 | field_issue_to_id: Ticket relacionado |
|
175 | field_issue_to_id: Ticket relacionado | |
176 | field_delay: Atraso |
|
176 | field_delay: Atraso | |
177 | field_assignable: Tickets podem ser atribuΓdos para este papel |
|
177 | field_assignable: Tickets podem ser atribuΓdos para este papel | |
178 | field_redirect_existing_links: Redirecionar links existentes |
|
178 | field_redirect_existing_links: Redirecionar links existentes | |
179 | field_estimated_hours: Tempo estimado |
|
179 | field_estimated_hours: Tempo estimado | |
180 | field_column_names: Colunas |
|
180 | field_column_names: Colunas | |
181 | field_time_zone: Fuso-horΓ‘rio |
|
181 | field_time_zone: Fuso-horΓ‘rio | |
182 | field_searchable: PesquisΓ‘vel |
|
182 | field_searchable: PesquisΓ‘vel | |
183 | field_default_value: PadrΓ£o |
|
183 | field_default_value: PadrΓ£o | |
184 | field_comments_sorting: Visualizar comentΓ‘rios |
|
184 | field_comments_sorting: Visualizar comentΓ‘rios | |
185 | field_parent_title: PΓ‘gina pai |
|
185 | field_parent_title: PΓ‘gina pai | |
186 |
|
186 | |||
187 | setting_app_title: TΓtulo da aplicaΓ§Γ£o |
|
187 | setting_app_title: TΓtulo da aplicaΓ§Γ£o | |
188 | setting_app_subtitle: Sub-tΓtulo da aplicaΓ§Γ£o |
|
188 | setting_app_subtitle: Sub-tΓtulo da aplicaΓ§Γ£o | |
189 | setting_welcome_text: Texto de boas-vindas |
|
189 | setting_welcome_text: Texto de boas-vindas | |
190 | setting_default_language: Idioma padrΓ£o |
|
190 | setting_default_language: Idioma padrΓ£o | |
191 | setting_login_required: Exigir autenticaΓ§Γ£o |
|
191 | setting_login_required: Exigir autenticaΓ§Γ£o | |
192 | setting_self_registration: Permitido Auto-registro |
|
192 | setting_self_registration: Permitido Auto-registro | |
193 | setting_attachment_max_size: Tamanho mΓ‘ximo do anexo |
|
193 | setting_attachment_max_size: Tamanho mΓ‘ximo do anexo | |
194 | setting_issues_export_limit: Limite de exportaΓ§Γ£o das tarefas |
|
194 | setting_issues_export_limit: Limite de exportaΓ§Γ£o das tarefas | |
195 | setting_mail_from: Email enviado de |
|
195 | setting_mail_from: Email enviado de | |
196 | setting_bcc_recipients: DestinatΓ‘rios com cΓ³pia oculta (cco) |
|
196 | setting_bcc_recipients: DestinatΓ‘rios com cΓ³pia oculta (cco) | |
197 | setting_host_name: Servidor |
|
197 | setting_host_name: Servidor | |
198 | setting_text_formatting: Formato do texto |
|
198 | setting_text_formatting: Formato do texto | |
199 | setting_wiki_compression: CompactaΓ§Γ£o de histΓ³rico do Wiki |
|
199 | setting_wiki_compression: CompactaΓ§Γ£o de histΓ³rico do Wiki | |
200 | setting_feeds_limit: Limite do Feed |
|
200 | setting_feeds_limit: Limite do Feed | |
201 | setting_default_projects_public: Novos projetos sΓ£o pΓΊblicos por padrΓ£o |
|
201 | setting_default_projects_public: Novos projetos sΓ£o pΓΊblicos por padrΓ£o | |
202 | setting_autofetch_changesets: Auto-obter commits |
|
202 | setting_autofetch_changesets: Auto-obter commits | |
203 | setting_sys_api_enabled: Ativa WS para gerenciamento do repositΓ³rio |
|
203 | setting_sys_api_enabled: Ativa WS para gerenciamento do repositΓ³rio | |
204 | setting_commit_ref_keywords: Palavras de referΓͺncia |
|
204 | setting_commit_ref_keywords: Palavras de referΓͺncia | |
205 | setting_commit_fix_keywords: Palavras de fechamento |
|
205 | setting_commit_fix_keywords: Palavras de fechamento | |
206 | setting_autologin: Auto-login |
|
206 | setting_autologin: Auto-login | |
207 | setting_date_format: Formato da data |
|
207 | setting_date_format: Formato da data | |
208 | setting_time_format: Formato de data |
|
208 | setting_time_format: Formato de data | |
209 | setting_cross_project_issue_relations: Permitir relacionar tickets entre projetos |
|
209 | setting_cross_project_issue_relations: Permitir relacionar tickets entre projetos | |
210 | setting_issue_list_default_columns: Colunas padrΓ£o visΓveis na lista de tickets |
|
210 | setting_issue_list_default_columns: Colunas padrΓ£o visΓveis na lista de tickets | |
211 | setting_repositories_encodings: CodificaΓ§Γ£o dos repositΓ³rios |
|
211 | setting_repositories_encodings: CodificaΓ§Γ£o dos repositΓ³rios | |
212 | setting_commit_logs_encoding: CodificaΓ§Γ£o das mensagens de commit |
|
212 | setting_commit_logs_encoding: CodificaΓ§Γ£o das mensagens de commit | |
213 | setting_emails_footer: RodapΓ© dos emails |
|
213 | setting_emails_footer: RodapΓ© dos emails | |
214 | setting_protocol: Protocolo |
|
214 | setting_protocol: Protocolo | |
215 | setting_per_page_options: OpΓ§Γ΅es de itens por pΓ‘gina |
|
215 | setting_per_page_options: OpΓ§Γ΅es de itens por pΓ‘gina | |
216 | setting_user_format: Formato de visualizaΓ§Γ£o dos usuΓ‘rios |
|
216 | setting_user_format: Formato de visualizaΓ§Γ£o dos usuΓ‘rios | |
217 | setting_activity_days_default: Dias visualizados na atividade do projeto |
|
217 | setting_activity_days_default: Dias visualizados na atividade do projeto | |
218 | setting_display_subprojects_issues: Visualizar tickets dos subprojetos nos projetos principais por padrΓ£o |
|
218 | setting_display_subprojects_issues: Visualizar tickets dos subprojetos nos projetos principais por padrΓ£o | |
219 | setting_enabled_scm: Habilitar SCM |
|
219 | setting_enabled_scm: Habilitar SCM | |
220 | setting_mail_handler_api_enabled: Habilitar WS para emails de entrada |
|
220 | setting_mail_handler_api_enabled: Habilitar WS para emails de entrada | |
221 | setting_mail_handler_api_key: Chave de API |
|
221 | setting_mail_handler_api_key: Chave de API | |
222 | setting_sequential_project_identifiers: Gerar identificadores de projeto sequenciais |
|
222 | setting_sequential_project_identifiers: Gerar identificadores de projeto sequenciais | |
223 |
|
223 | |||
224 | project_module_issue_tracking: Gerenciamento de Tickets |
|
224 | project_module_issue_tracking: Gerenciamento de Tickets | |
225 | project_module_time_tracking: Gerenciamento de tempo |
|
225 | project_module_time_tracking: Gerenciamento de tempo | |
226 | project_module_news: NotΓcias |
|
226 | project_module_news: NotΓcias | |
227 | project_module_documents: Documentos |
|
227 | project_module_documents: Documentos | |
228 | project_module_files: Arquivos |
|
228 | project_module_files: Arquivos | |
229 | project_module_wiki: Wiki |
|
229 | project_module_wiki: Wiki | |
230 | project_module_repository: RepositΓ³rio |
|
230 | project_module_repository: RepositΓ³rio | |
231 | project_module_boards: FΓ³runs |
|
231 | project_module_boards: FΓ³runs | |
232 |
|
232 | |||
233 | label_user: UsuΓ‘rio |
|
233 | label_user: UsuΓ‘rio | |
234 | label_user_plural: UsuΓ‘rios |
|
234 | label_user_plural: UsuΓ‘rios | |
235 | label_user_new: Novo usuΓ‘rio |
|
235 | label_user_new: Novo usuΓ‘rio | |
236 | label_project: Projeto |
|
236 | label_project: Projeto | |
237 | label_project_new: Novo projeto |
|
237 | label_project_new: Novo projeto | |
238 | label_project_plural: Projetos |
|
238 | label_project_plural: Projetos | |
239 | label_project_all: Todos os projetos |
|
239 | label_project_all: Todos os projetos | |
240 | label_project_latest: Γltimos projetos |
|
240 | label_project_latest: Γltimos projetos | |
241 | label_issue: Ticket |
|
241 | label_issue: Ticket | |
242 | label_issue_new: Novo ticket |
|
242 | label_issue_new: Novo ticket | |
243 | label_issue_plural: Tickets |
|
243 | label_issue_plural: Tickets | |
244 | label_issue_view_all: Ver todos os tickets |
|
244 | label_issue_view_all: Ver todos os tickets | |
245 | label_issues_by: Tickets por %s |
|
245 | label_issues_by: Tickets por %s | |
246 | label_issue_added: Ticket adicionado |
|
246 | label_issue_added: Ticket adicionado | |
247 | label_issue_updated: Ticket atualizado |
|
247 | label_issue_updated: Ticket atualizado | |
248 | label_document: Documento |
|
248 | label_document: Documento | |
249 | label_document_new: Novo documento |
|
249 | label_document_new: Novo documento | |
250 | label_document_plural: Documentos |
|
250 | label_document_plural: Documentos | |
251 | label_document_added: Documento adicionado |
|
251 | label_document_added: Documento adicionado | |
252 | label_role: Papel |
|
252 | label_role: Papel | |
253 | label_role_plural: PapΓ©is |
|
253 | label_role_plural: PapΓ©is | |
254 | label_role_new: Novo papel |
|
254 | label_role_new: Novo papel | |
255 | label_role_and_permissions: PapΓ©is e permissΓ΅es |
|
255 | label_role_and_permissions: PapΓ©is e permissΓ΅es | |
256 | label_member: Membro |
|
256 | label_member: Membro | |
257 | label_member_new: Novo membro |
|
257 | label_member_new: Novo membro | |
258 | label_member_plural: Membros |
|
258 | label_member_plural: Membros | |
259 | label_tracker: Tipo de ticket |
|
259 | label_tracker: Tipo de ticket | |
260 | label_tracker_plural: Tipos de ticket |
|
260 | label_tracker_plural: Tipos de ticket | |
261 | label_tracker_new: Novo tipo |
|
261 | label_tracker_new: Novo tipo | |
262 | label_workflow: Workflow |
|
262 | label_workflow: Workflow | |
263 | label_issue_status: Status do ticket |
|
263 | label_issue_status: Status do ticket | |
264 | label_issue_status_plural: Status dos tickets |
|
264 | label_issue_status_plural: Status dos tickets | |
265 | label_issue_status_new: Novo status |
|
265 | label_issue_status_new: Novo status | |
266 | label_issue_category: Categoria de ticket |
|
266 | label_issue_category: Categoria de ticket | |
267 | label_issue_category_plural: Categorias de tickets |
|
267 | label_issue_category_plural: Categorias de tickets | |
268 | label_issue_category_new: Nova categoria |
|
268 | label_issue_category_new: Nova categoria | |
269 | label_custom_field: Campo personalizado |
|
269 | label_custom_field: Campo personalizado | |
270 | label_custom_field_plural: Campos personalizados |
|
270 | label_custom_field_plural: Campos personalizados | |
271 | label_custom_field_new: Novo campo personalizado |
|
271 | label_custom_field_new: Novo campo personalizado | |
272 | label_enumerations: 'Tipos & Categorias' |
|
272 | label_enumerations: 'Tipos & Categorias' | |
273 | label_enumeration_new: Novo |
|
273 | label_enumeration_new: Novo | |
274 | label_information: InformaΓ§Γ£o |
|
274 | label_information: InformaΓ§Γ£o | |
275 | label_information_plural: InformaΓ§Γ΅es |
|
275 | label_information_plural: InformaΓ§Γ΅es | |
276 | label_please_login: Efetue o login |
|
276 | label_please_login: Efetue o login | |
277 | label_register: Cadastre-se |
|
277 | label_register: Cadastre-se | |
278 | label_password_lost: Perdi minha senha |
|
278 | label_password_lost: Perdi minha senha | |
279 | label_home: PΓ‘gina inicial |
|
279 | label_home: PΓ‘gina inicial | |
280 | label_my_page: Minha pΓ‘gina |
|
280 | label_my_page: Minha pΓ‘gina | |
281 | label_my_account: Minha conta |
|
281 | label_my_account: Minha conta | |
282 | label_my_projects: Meus projetos |
|
282 | label_my_projects: Meus projetos | |
283 | label_administration: AdministraΓ§Γ£o |
|
283 | label_administration: AdministraΓ§Γ£o | |
284 | label_login: Entrar |
|
284 | label_login: Entrar | |
285 | label_logout: Sair |
|
285 | label_logout: Sair | |
286 | label_help: Ajuda |
|
286 | label_help: Ajuda | |
287 | label_reported_issues: Tickets reportados |
|
287 | label_reported_issues: Tickets reportados | |
288 | label_assigned_to_me_issues: Meus tickets |
|
288 | label_assigned_to_me_issues: Meus tickets | |
289 | label_last_login: Γltima conexΓ£o |
|
289 | label_last_login: Γltima conexΓ£o | |
290 | label_last_updates: Γltima alteraΓ§Γ£o |
|
290 | label_last_updates: Γltima alteraΓ§Γ£o | |
291 | label_last_updates_plural: %d Γltimas alteraΓ§Γ΅es |
|
291 | label_last_updates_plural: %d Γltimas alteraΓ§Γ΅es | |
292 | label_registered_on: Registrado em |
|
292 | label_registered_on: Registrado em | |
293 | label_activity: Atividade |
|
293 | label_activity: Atividade | |
294 | label_overall_activity: Atividades gerais |
|
294 | label_overall_activity: Atividades gerais | |
295 | label_new: Novo |
|
295 | label_new: Novo | |
296 | label_logged_as: "Acessando como:" |
|
296 | label_logged_as: "Acessando como:" | |
297 | label_environment: Ambiente |
|
297 | label_environment: Ambiente | |
298 | label_authentication: AutenticaΓ§Γ£o |
|
298 | label_authentication: AutenticaΓ§Γ£o | |
299 | label_auth_source: Modo de autenticaΓ§Γ£o |
|
299 | label_auth_source: Modo de autenticaΓ§Γ£o | |
300 | label_auth_source_new: Novo modo de autenticaΓ§Γ£o |
|
300 | label_auth_source_new: Novo modo de autenticaΓ§Γ£o | |
301 | label_auth_source_plural: Modos de autenticaΓ§Γ£o |
|
301 | label_auth_source_plural: Modos de autenticaΓ§Γ£o | |
302 | label_subproject_plural: Sub-projetos |
|
302 | label_subproject_plural: Sub-projetos | |
303 | label_and_its_subprojects: %s e seus sub-projetos |
|
303 | label_and_its_subprojects: %s e seus sub-projetos | |
304 | label_min_max_length: Tamanho mΓn-mΓ‘x |
|
304 | label_min_max_length: Tamanho mΓn-mΓ‘x | |
305 | label_list: Lista |
|
305 | label_list: Lista | |
306 | label_date: Data |
|
306 | label_date: Data | |
307 | label_integer: Inteiro |
|
307 | label_integer: Inteiro | |
308 | label_float: Decimal |
|
308 | label_float: Decimal | |
309 | label_boolean: Boleano |
|
309 | label_boolean: Boleano | |
310 | label_string: Texto |
|
310 | label_string: Texto | |
311 | label_text: Texto longo |
|
311 | label_text: Texto longo | |
312 | label_attribute: Atributo |
|
312 | label_attribute: Atributo | |
313 | label_attribute_plural: Atributos |
|
313 | label_attribute_plural: Atributos | |
314 | label_download: %d Download |
|
314 | label_download: %d Download | |
315 | label_download_plural: %d Downloads |
|
315 | label_download_plural: %d Downloads | |
316 | label_no_data: Nenhuma informaΓ§Γ£o disponΓvel |
|
316 | label_no_data: Nenhuma informaΓ§Γ£o disponΓvel | |
317 | label_change_status: Alterar status |
|
317 | label_change_status: Alterar status | |
318 | label_history: HistΓ³rico |
|
318 | label_history: HistΓ³rico | |
319 | label_attachment: Arquivo |
|
319 | label_attachment: Arquivo | |
320 | label_attachment_new: Novo arquivo |
|
320 | label_attachment_new: Novo arquivo | |
321 | label_attachment_delete: Excluir arquivo |
|
321 | label_attachment_delete: Excluir arquivo | |
322 | label_attachment_plural: Arquivos |
|
322 | label_attachment_plural: Arquivos | |
323 | label_file_added: Arquivo adicionado |
|
323 | label_file_added: Arquivo adicionado | |
324 | label_report: RelatΓ³rio |
|
324 | label_report: RelatΓ³rio | |
325 | label_report_plural: RelatΓ³rio |
|
325 | label_report_plural: RelatΓ³rio | |
326 | label_news: NotΓcia |
|
326 | label_news: NotΓcia | |
327 | label_news_new: Adicionar notΓcia |
|
327 | label_news_new: Adicionar notΓcia | |
328 | label_news_plural: NotΓcias |
|
328 | label_news_plural: NotΓcias | |
329 | label_news_latest: Γltimas notΓcias |
|
329 | label_news_latest: Γltimas notΓcias | |
330 | label_news_view_all: Ver todas as notΓcias |
|
330 | label_news_view_all: Ver todas as notΓcias | |
331 | label_news_added: NotΓcia adicionada |
|
331 | label_news_added: NotΓcia adicionada | |
332 | label_change_log: Registro de alteraΓ§Γ΅es |
|
332 | label_change_log: Registro de alteraΓ§Γ΅es | |
333 | label_settings: ConfiguraΓ§Γ΅es |
|
333 | label_settings: ConfiguraΓ§Γ΅es | |
334 | label_overview: VisΓ£o geral |
|
334 | label_overview: VisΓ£o geral | |
335 | label_version: VersΓ£o |
|
335 | label_version: VersΓ£o | |
336 | label_version_new: Nova versΓ£o |
|
336 | label_version_new: Nova versΓ£o | |
337 | label_version_plural: VersΓ΅es |
|
337 | label_version_plural: VersΓ΅es | |
338 | label_confirmation: ConfirmaΓ§Γ£o |
|
338 | label_confirmation: ConfirmaΓ§Γ£o | |
339 | label_export_to: Exportar para |
|
339 | label_export_to: Exportar para | |
340 | label_read: Ler... |
|
340 | label_read: Ler... | |
341 | label_public_projects: Projetos pΓΊblicos |
|
341 | label_public_projects: Projetos pΓΊblicos | |
342 | label_open_issues: Aberto |
|
342 | label_open_issues: Aberto | |
343 | label_open_issues_plural: Abertos |
|
343 | label_open_issues_plural: Abertos | |
344 | label_closed_issues: Fechado |
|
344 | label_closed_issues: Fechado | |
345 | label_closed_issues_plural: Fechados |
|
345 | label_closed_issues_plural: Fechados | |
346 | label_total: Total |
|
346 | label_total: Total | |
347 | label_permissions: PermissΓ΅es |
|
347 | label_permissions: PermissΓ΅es | |
348 | label_current_status: Status atual |
|
348 | label_current_status: Status atual | |
349 | label_new_statuses_allowed: Novo status permitido |
|
349 | label_new_statuses_allowed: Novo status permitido | |
350 | label_all: todos |
|
350 | label_all: todos | |
351 | label_none: nenhum |
|
351 | label_none: nenhum | |
352 | label_nobody: ninguΓ©m |
|
352 | label_nobody: ninguΓ©m | |
353 | label_next: PrΓ³ximo |
|
353 | label_next: PrΓ³ximo | |
354 | label_previous: Anterior |
|
354 | label_previous: Anterior | |
355 | label_used_by: Usado por |
|
355 | label_used_by: Usado por | |
356 | label_details: Detalhes |
|
356 | label_details: Detalhes | |
357 | label_add_note: Adicionar nota |
|
357 | label_add_note: Adicionar nota | |
358 | label_per_page: Por pΓ‘gina |
|
358 | label_per_page: Por pΓ‘gina | |
359 | label_calendar: CalendΓ‘rio |
|
359 | label_calendar: CalendΓ‘rio | |
360 | label_months_from: meses a partir de |
|
360 | label_months_from: meses a partir de | |
361 | label_gantt: Gantt |
|
361 | label_gantt: Gantt | |
362 | label_internal: Interno |
|
362 | label_internal: Interno | |
363 | label_last_changes: ΓΊltimas %d alteraΓ§Γ΅es |
|
363 | label_last_changes: ΓΊltimas %d alteraΓ§Γ΅es | |
364 | label_change_view_all: Mostrar todas as alteraΓ§Γ΅es |
|
364 | label_change_view_all: Mostrar todas as alteraΓ§Γ΅es | |
365 | label_personalize_page: Personalizar esta pΓ‘gina |
|
365 | label_personalize_page: Personalizar esta pΓ‘gina | |
366 | label_comment: ComentΓ‘rio |
|
366 | label_comment: ComentΓ‘rio | |
367 | label_comment_plural: ComentΓ‘rios |
|
367 | label_comment_plural: ComentΓ‘rios | |
368 | label_comment_add: Adicionar comentΓ‘rio |
|
368 | label_comment_add: Adicionar comentΓ‘rio | |
369 | label_comment_added: ComentΓ‘rio adicionado |
|
369 | label_comment_added: ComentΓ‘rio adicionado | |
370 | label_comment_delete: Excluir comentΓ‘rio |
|
370 | label_comment_delete: Excluir comentΓ‘rio | |
371 | label_query: Consulta personalizada |
|
371 | label_query: Consulta personalizada | |
372 | label_query_plural: Consultas personalizadas |
|
372 | label_query_plural: Consultas personalizadas | |
373 | label_query_new: Nova consulta |
|
373 | label_query_new: Nova consulta | |
374 | label_filter_add: Adicionar filtro |
|
374 | label_filter_add: Adicionar filtro | |
375 | label_filter_plural: Filtros |
|
375 | label_filter_plural: Filtros | |
376 | label_equals: igual a |
|
376 | label_equals: igual a | |
377 | label_not_equals: diferente de |
|
377 | label_not_equals: diferente de | |
378 | label_in_less_than: maior que |
|
378 | label_in_less_than: maior que | |
379 | label_in_more_than: menor que |
|
379 | label_in_more_than: menor que | |
380 | label_in: em |
|
380 | label_in: em | |
381 | label_today: hoje |
|
381 | label_today: hoje | |
382 | label_all_time: tudo |
|
382 | label_all_time: tudo | |
383 | label_yesterday: ontem |
|
383 | label_yesterday: ontem | |
384 | label_this_week: esta semana |
|
384 | label_this_week: esta semana | |
385 | label_last_week: ΓΊltima semana |
|
385 | label_last_week: ΓΊltima semana | |
386 | label_last_n_days: ΓΊltimos %d dias |
|
386 | label_last_n_days: ΓΊltimos %d dias | |
387 | label_this_month: este mΓͺs |
|
387 | label_this_month: este mΓͺs | |
388 | label_last_month: ΓΊltimo mΓͺs |
|
388 | label_last_month: ΓΊltimo mΓͺs | |
389 | label_this_year: este ano |
|
389 | label_this_year: este ano | |
390 | label_date_range: PerΓodo |
|
390 | label_date_range: PerΓodo | |
391 | label_less_than_ago: menos de |
|
391 | label_less_than_ago: menos de | |
392 | label_more_than_ago: mais de |
|
392 | label_more_than_ago: mais de | |
393 | label_ago: dias atrΓ‘s |
|
393 | label_ago: dias atrΓ‘s | |
394 | label_contains: contΓ©m |
|
394 | label_contains: contΓ©m | |
395 | label_not_contains: nΓ£o contΓ©m |
|
395 | label_not_contains: nΓ£o contΓ©m | |
396 | label_day_plural: dias |
|
396 | label_day_plural: dias | |
397 | label_repository: RepositΓ³rio |
|
397 | label_repository: RepositΓ³rio | |
398 | label_repository_plural: RepositΓ³rios |
|
398 | label_repository_plural: RepositΓ³rios | |
399 | label_browse: Procurar |
|
399 | label_browse: Procurar | |
400 | label_modification: %d alteraΓ§Γ£o |
|
400 | label_modification: %d alteraΓ§Γ£o | |
401 | label_modification_plural: %d alteraΓ§Γ΅es |
|
401 | label_modification_plural: %d alteraΓ§Γ΅es | |
402 | label_revision: RevisΓ£o |
|
402 | label_revision: RevisΓ£o | |
403 | label_revision_plural: RevisΓ΅es |
|
403 | label_revision_plural: RevisΓ΅es | |
404 | label_associated_revisions: RevisΓ΅es associadas |
|
404 | label_associated_revisions: RevisΓ΅es associadas | |
405 | label_added: adicionada |
|
405 | label_added: adicionada | |
406 | label_modified: alterada |
|
406 | label_modified: alterada | |
407 | label_deleted: excluΓda |
|
407 | label_deleted: excluΓda | |
408 | label_latest_revision: Γltima revisΓ£o |
|
408 | label_latest_revision: Γltima revisΓ£o | |
409 | label_latest_revision_plural: Γltimas revisΓ΅es |
|
409 | label_latest_revision_plural: Γltimas revisΓ΅es | |
410 | label_view_revisions: Ver revisΓ΅es |
|
410 | label_view_revisions: Ver revisΓ΅es | |
411 | label_max_size: Tamanho mΓ‘ximo |
|
411 | label_max_size: Tamanho mΓ‘ximo | |
412 | label_on: 'de' |
|
412 | label_on: 'de' | |
413 | label_sort_highest: Mover para o inΓcio |
|
413 | label_sort_highest: Mover para o inΓcio | |
414 | label_sort_higher: Mover para cima |
|
414 | label_sort_higher: Mover para cima | |
415 | label_sort_lower: Mover para baixo |
|
415 | label_sort_lower: Mover para baixo | |
416 | label_sort_lowest: Mover para o fim |
|
416 | label_sort_lowest: Mover para o fim | |
417 | label_roadmap: Planejamento |
|
417 | label_roadmap: Planejamento | |
418 | label_roadmap_due_in: Previsto para %s |
|
418 | label_roadmap_due_in: Previsto para %s | |
419 | label_roadmap_overdue: %s atrasado |
|
419 | label_roadmap_overdue: %s atrasado | |
420 | label_roadmap_no_issues: Sem tickets para esta versΓ£o |
|
420 | label_roadmap_no_issues: Sem tickets para esta versΓ£o | |
421 | label_search: Busca |
|
421 | label_search: Busca | |
422 | label_result_plural: Resultados |
|
422 | label_result_plural: Resultados | |
423 | label_all_words: Todas as palavras |
|
423 | label_all_words: Todas as palavras | |
424 | label_wiki: Wiki |
|
424 | label_wiki: Wiki | |
425 | label_wiki_edit: Editar Wiki |
|
425 | label_wiki_edit: Editar Wiki | |
426 | label_wiki_edit_plural: EdiΓ§Γ΅es Wiki |
|
426 | label_wiki_edit_plural: EdiΓ§Γ΅es Wiki | |
427 | label_wiki_page: PΓ‘gina Wiki |
|
427 | label_wiki_page: PΓ‘gina Wiki | |
428 | label_wiki_page_plural: pΓ‘ginas Wiki |
|
428 | label_wiki_page_plural: pΓ‘ginas Wiki | |
429 | label_index_by_title: Γndice por tΓtulo |
|
429 | label_index_by_title: Γndice por tΓtulo | |
430 | label_index_by_date: Γndice por data |
|
430 | label_index_by_date: Γndice por data | |
431 | label_current_version: VersΓ£o atual |
|
431 | label_current_version: VersΓ£o atual | |
432 | label_preview: PrΓ©-visualizar |
|
432 | label_preview: PrΓ©-visualizar | |
433 | label_feed_plural: Feeds |
|
433 | label_feed_plural: Feeds | |
434 | label_changes_details: Detalhes de todas as alteraΓ§Γ΅es |
|
434 | label_changes_details: Detalhes de todas as alteraΓ§Γ΅es | |
435 | label_issue_tracking: Tickets |
|
435 | label_issue_tracking: Tickets | |
436 | label_spent_time: Tempo gasto |
|
436 | label_spent_time: Tempo gasto | |
437 | label_f_hour: %.2f hora |
|
437 | label_f_hour: %.2f hora | |
438 | label_f_hour_plural: %.2f horas |
|
438 | label_f_hour_plural: %.2f horas | |
439 | label_time_tracking: Controle de horas |
|
439 | label_time_tracking: Controle de horas | |
440 | label_change_plural: AlteraΓ§Γ΅es |
|
440 | label_change_plural: AlteraΓ§Γ΅es | |
441 | label_statistics: EstatΓsticas |
|
441 | label_statistics: EstatΓsticas | |
442 | label_commits_per_month: Commits por mΓͺs |
|
442 | label_commits_per_month: Commits por mΓͺs | |
443 | label_commits_per_author: Commits por autor |
|
443 | label_commits_per_author: Commits por autor | |
444 | label_view_diff: Ver diferenΓ§as |
|
444 | label_view_diff: Ver diferenΓ§as | |
445 | label_diff_inline: inline |
|
445 | label_diff_inline: inline | |
446 | label_diff_side_by_side: lado a lado |
|
446 | label_diff_side_by_side: lado a lado | |
447 | label_options: OpΓ§Γ΅es |
|
447 | label_options: OpΓ§Γ΅es | |
448 | label_copy_workflow_from: Copiar workflow de |
|
448 | label_copy_workflow_from: Copiar workflow de | |
449 | label_permissions_report: RelatΓ³rio de permissΓ΅es |
|
449 | label_permissions_report: RelatΓ³rio de permissΓ΅es | |
450 | label_watched_issues: Tickes monitorados |
|
450 | label_watched_issues: Tickes monitorados | |
451 | label_related_issues: Tickets relacionados |
|
451 | label_related_issues: Tickets relacionados | |
452 | label_applied_status: Status aplicado |
|
452 | label_applied_status: Status aplicado | |
453 | label_loading: Carregando... |
|
453 | label_loading: Carregando... | |
454 | label_relation_new: Nova relaΓ§Γ£o |
|
454 | label_relation_new: Nova relaΓ§Γ£o | |
455 | label_relation_delete: Excluir relaΓ§Γ£o |
|
455 | label_relation_delete: Excluir relaΓ§Γ£o | |
456 | label_relates_to: relacionado a |
|
456 | label_relates_to: relacionado a | |
457 | label_duplicates: duplica |
|
457 | label_duplicates: duplica | |
458 | label_duplicated_by: duplicado por |
|
458 | label_duplicated_by: duplicado por | |
459 | label_blocks: bloqueia |
|
459 | label_blocks: bloqueia | |
460 | label_blocked_by: bloqueado por |
|
460 | label_blocked_by: bloqueado por | |
461 | label_precedes: precede |
|
461 | label_precedes: precede | |
462 | label_follows: segue |
|
462 | label_follows: segue | |
463 | label_end_to_start: fim para o inΓcio |
|
463 | label_end_to_start: fim para o inΓcio | |
464 | label_end_to_end: fim para fim |
|
464 | label_end_to_end: fim para fim | |
465 | label_start_to_start: inΓcio para inΓcio |
|
465 | label_start_to_start: inΓcio para inΓcio | |
466 | label_start_to_end: inΓcio para fim |
|
466 | label_start_to_end: inΓcio para fim | |
467 | label_stay_logged_in: Permanecer logado |
|
467 | label_stay_logged_in: Permanecer logado | |
468 | label_disabled: desabilitado |
|
468 | label_disabled: desabilitado | |
469 | label_show_completed_versions: Exibir versΓ΅es completas |
|
469 | label_show_completed_versions: Exibir versΓ΅es completas | |
470 | label_me: mim |
|
470 | label_me: mim | |
471 | label_board: FΓ³rum |
|
471 | label_board: FΓ³rum | |
472 | label_board_new: Novo fΓ³rum |
|
472 | label_board_new: Novo fΓ³rum | |
473 | label_board_plural: FΓ³runs |
|
473 | label_board_plural: FΓ³runs | |
474 | label_topic_plural: TΓ³picos |
|
474 | label_topic_plural: TΓ³picos | |
475 | label_message_plural: Mensagens |
|
475 | label_message_plural: Mensagens | |
476 | label_message_last: Γltima mensagem |
|
476 | label_message_last: Γltima mensagem | |
477 | label_message_new: Nova mensagem |
|
477 | label_message_new: Nova mensagem | |
478 | label_message_posted: Mensagem enviada |
|
478 | label_message_posted: Mensagem enviada | |
479 | label_reply_plural: Respostas |
|
479 | label_reply_plural: Respostas | |
480 | label_send_information: Enviar informaΓ§Γ£o da nova conta para o usuΓ‘rio |
|
480 | label_send_information: Enviar informaΓ§Γ£o da nova conta para o usuΓ‘rio | |
481 | label_year: Ano |
|
481 | label_year: Ano | |
482 | label_month: MΓͺs |
|
482 | label_month: MΓͺs | |
483 | label_week: Semana |
|
483 | label_week: Semana | |
484 | label_date_from: De |
|
484 | label_date_from: De | |
485 | label_date_to: Para |
|
485 | label_date_to: Para | |
486 | label_language_based: Com base no idioma do usuΓ‘rio |
|
486 | label_language_based: Com base no idioma do usuΓ‘rio | |
487 | label_sort_by: Ordenar por %s |
|
487 | label_sort_by: Ordenar por %s | |
488 | label_send_test_email: Enviar um email de teste |
|
488 | label_send_test_email: Enviar um email de teste | |
489 | label_feeds_access_key_created_on: chave de acesso RSS criada %s atrΓ‘s |
|
489 | label_feeds_access_key_created_on: chave de acesso RSS criada %s atrΓ‘s | |
490 | label_module_plural: MΓ³dulos |
|
490 | label_module_plural: MΓ³dulos | |
491 | label_added_time_by: Adicionado por %s %s atrΓ‘s |
|
491 | label_added_time_by: Adicionado por %s %s atrΓ‘s | |
492 | label_updated_time: Atualizado %s atrΓ‘s |
|
492 | label_updated_time: Atualizado %s atrΓ‘s | |
493 | label_jump_to_a_project: Ir para o projeto... |
|
493 | label_jump_to_a_project: Ir para o projeto... | |
494 | label_file_plural: Arquivos |
|
494 | label_file_plural: Arquivos | |
495 | label_changeset_plural: Changesets |
|
495 | label_changeset_plural: Changesets | |
496 | label_default_columns: Colunas padrΓ£o |
|
496 | label_default_columns: Colunas padrΓ£o | |
497 | label_no_change_option: (Sem alteraΓ§Γ£o) |
|
497 | label_no_change_option: (Sem alteraΓ§Γ£o) | |
498 | label_bulk_edit_selected_issues: EdiΓ§Γ£o em massa dos tickets selecionados. |
|
498 | label_bulk_edit_selected_issues: EdiΓ§Γ£o em massa dos tickets selecionados. | |
499 | label_theme: Tema |
|
499 | label_theme: Tema | |
500 | label_default: PadrΓ£o |
|
500 | label_default: PadrΓ£o | |
501 | label_search_titles_only: Pesquisar somente tΓtulos |
|
501 | label_search_titles_only: Pesquisar somente tΓtulos | |
502 | label_user_mail_option_all: "Para qualquer evento em todos os meus projetos" |
|
502 | label_user_mail_option_all: "Para qualquer evento em todos os meus projetos" | |
503 | label_user_mail_option_selected: "Para qualquer evento somente no(s) projeto(s) selecionado(s)..." |
|
503 | label_user_mail_option_selected: "Para qualquer evento somente no(s) projeto(s) selecionado(s)..." | |
504 | label_user_mail_option_none: "Somente tickets que eu acompanho ou estou envolvido" |
|
504 | label_user_mail_option_none: "Somente tickets que eu acompanho ou estou envolvido" | |
505 | label_user_mail_no_self_notified: "Eu nΓ£o quero ser notificado de minhas prΓ³prias modificaΓ§Γ΅es" |
|
505 | label_user_mail_no_self_notified: "Eu nΓ£o quero ser notificado de minhas prΓ³prias modificaΓ§Γ΅es" | |
506 | label_registration_activation_by_email: ativaΓ§Γ£o de conta por e-mail |
|
506 | label_registration_activation_by_email: ativaΓ§Γ£o de conta por e-mail | |
507 | label_registration_manual_activation: ativaΓ§Γ£o manual de conta |
|
507 | label_registration_manual_activation: ativaΓ§Γ£o manual de conta | |
508 | label_registration_automatic_activation: ativaΓ§Γ£o automΓ‘tica de conta |
|
508 | label_registration_automatic_activation: ativaΓ§Γ£o automΓ‘tica de conta | |
509 | label_display_per_page: 'Por pΓ‘gina: %s' |
|
509 | label_display_per_page: 'Por pΓ‘gina: %s' | |
510 | label_age: Idade |
|
510 | label_age: Idade | |
511 | label_change_properties: Alterar propriedades |
|
511 | label_change_properties: Alterar propriedades | |
512 | label_general: Geral |
|
512 | label_general: Geral | |
513 | label_more: Mais |
|
513 | label_more: Mais | |
514 | label_scm: 'Controle de versΓ£o:' |
|
514 | label_scm: 'Controle de versΓ£o:' | |
515 | label_plugins: Plugins |
|
515 | label_plugins: Plugins | |
516 | label_ldap_authentication: AutenticaΓ§Γ£o LDAP |
|
516 | label_ldap_authentication: AutenticaΓ§Γ£o LDAP | |
517 | label_downloads_abbr: D/L |
|
517 | label_downloads_abbr: D/L | |
518 | label_optional_description: DescriΓ§Γ£o opcional |
|
518 | label_optional_description: DescriΓ§Γ£o opcional | |
519 | label_add_another_file: Adicionar outro arquivo |
|
519 | label_add_another_file: Adicionar outro arquivo | |
520 | label_preferences: PreferΓͺncias |
|
520 | label_preferences: PreferΓͺncias | |
521 | label_chronological_order: Em ordem cronolΓ³gica |
|
521 | label_chronological_order: Em ordem cronolΓ³gica | |
522 | label_reverse_chronological_order: Em ordem cronolΓ³gica inversa |
|
522 | label_reverse_chronological_order: Em ordem cronolΓ³gica inversa | |
523 | label_planning: Planejamento |
|
523 | label_planning: Planejamento | |
524 | label_incoming_emails: Emails de entrada |
|
524 | label_incoming_emails: Emails de entrada | |
525 | label_generate_key: Gerar uma chave |
|
525 | label_generate_key: Gerar uma chave | |
526 | label_issue_watchers: Monitorando |
|
526 | label_issue_watchers: Monitorando | |
527 |
|
527 | |||
528 | button_login: Entrar |
|
528 | button_login: Entrar | |
529 | button_submit: Enviar |
|
529 | button_submit: Enviar | |
530 | button_save: Salvar |
|
530 | button_save: Salvar | |
531 | button_check_all: Marcar todos |
|
531 | button_check_all: Marcar todos | |
532 | button_uncheck_all: Desmarcar todos |
|
532 | button_uncheck_all: Desmarcar todos | |
533 | button_delete: Excluir |
|
533 | button_delete: Excluir | |
534 | button_create: Criar |
|
534 | button_create: Criar | |
535 | button_test: Testar |
|
535 | button_test: Testar | |
536 | button_edit: Editar |
|
536 | button_edit: Editar | |
537 | button_add: Adicionar |
|
537 | button_add: Adicionar | |
538 | button_change: Alterar |
|
538 | button_change: Alterar | |
539 | button_apply: Aplicar |
|
539 | button_apply: Aplicar | |
540 | button_clear: Limpar |
|
540 | button_clear: Limpar | |
541 | button_lock: Bloquear |
|
541 | button_lock: Bloquear | |
542 | button_unlock: Desbloquear |
|
542 | button_unlock: Desbloquear | |
543 | button_download: Download |
|
543 | button_download: Download | |
544 | button_list: Listar |
|
544 | button_list: Listar | |
545 | button_view: Ver |
|
545 | button_view: Ver | |
546 | button_move: Mover |
|
546 | button_move: Mover | |
547 | button_back: Voltar |
|
547 | button_back: Voltar | |
548 | button_cancel: Cancelar |
|
548 | button_cancel: Cancelar | |
549 | button_activate: Ativar |
|
549 | button_activate: Ativar | |
550 | button_sort: Ordenar |
|
550 | button_sort: Ordenar | |
551 | button_log_time: Tempo de trabalho |
|
551 | button_log_time: Tempo de trabalho | |
552 | button_rollback: Voltar para esta versΓ£o |
|
552 | button_rollback: Voltar para esta versΓ£o | |
553 | button_watch: Monitorar |
|
553 | button_watch: Monitorar | |
554 | button_unwatch: Parar de Monitorar |
|
554 | button_unwatch: Parar de Monitorar | |
555 | button_reply: Responder |
|
555 | button_reply: Responder | |
556 | button_archive: Arquivar |
|
556 | button_archive: Arquivar | |
557 | button_unarchive: Desarquivar |
|
557 | button_unarchive: Desarquivar | |
558 | button_reset: Redefinir |
|
558 | button_reset: Redefinir | |
559 | button_rename: Renomear |
|
559 | button_rename: Renomear | |
560 | button_change_password: Alterar senha |
|
560 | button_change_password: Alterar senha | |
561 | button_copy: Copiar |
|
561 | button_copy: Copiar | |
562 | button_annotate: Anotar |
|
562 | button_annotate: Anotar | |
563 | button_update: Atualizar |
|
563 | button_update: Atualizar | |
564 | button_configure: Configurar |
|
564 | button_configure: Configurar | |
565 | button_quote: Responder |
|
565 | button_quote: Responder | |
566 |
|
566 | |||
567 | status_active: ativo |
|
567 | status_active: ativo | |
568 | status_registered: registrado |
|
568 | status_registered: registrado | |
569 | status_locked: bloqueado |
|
569 | status_locked: bloqueado | |
570 |
|
570 | |||
571 | text_select_mail_notifications: Selecionar aΓ§Γ΅es para ser enviado uma notificaΓ§Γ£o por email |
|
571 | text_select_mail_notifications: Selecionar aΓ§Γ΅es para ser enviado uma notificaΓ§Γ£o por email | |
572 | text_regexp_info: ex. ^[A-Z0-9]+$ |
|
572 | text_regexp_info: ex. ^[A-Z0-9]+$ | |
573 | text_min_max_length_info: 0 = sem restriΓ§Γ£o |
|
573 | text_min_max_length_info: 0 = sem restriΓ§Γ£o | |
574 | text_project_destroy_confirmation: VocΓͺ tem certeza que deseja excluir este projeto e todos os dados relacionados? |
|
574 | text_project_destroy_confirmation: VocΓͺ tem certeza que deseja excluir este projeto e todos os dados relacionados? | |
575 | text_subprojects_destroy_warning: 'Seu(s) subprojeto(s): %s tambΓ©m serΓ£o excluΓdos.' |
|
575 | text_subprojects_destroy_warning: 'Seu(s) subprojeto(s): %s tambΓ©m serΓ£o excluΓdos.' | |
576 | text_workflow_edit: Selecione um papel e um tipo de tarefa para editar o workflow |
|
576 | text_workflow_edit: Selecione um papel e um tipo de tarefa para editar o workflow | |
577 | text_are_you_sure: VocΓͺ tem certeza? |
|
577 | text_are_you_sure: VocΓͺ tem certeza? | |
578 | text_journal_changed: alterado(a) de %s para %s |
|
578 | text_journal_changed: alterado(a) de %s para %s | |
579 | text_journal_set_to: alterado(a) para %s |
|
579 | text_journal_set_to: alterado(a) para %s | |
580 | text_journal_deleted: excluΓdo |
|
580 | text_journal_deleted: excluΓdo | |
581 | text_tip_task_begin_day: tarefa inicia neste dia |
|
581 | text_tip_task_begin_day: tarefa inicia neste dia | |
582 | text_tip_task_end_day: tarefa termina neste dia |
|
582 | text_tip_task_end_day: tarefa termina neste dia | |
583 | text_tip_task_begin_end_day: tarefa inicia e termina neste dia |
|
583 | text_tip_task_begin_end_day: tarefa inicia e termina neste dia | |
584 | text_project_identifier_info: 'Letras minΓΊsculas (a-z), nΓΊmeros e hΓfens permitidos.<br />Uma vez salvo, o identificador nΓ£o poderΓ‘ ser alterado.' |
|
584 | text_project_identifier_info: 'Letras minΓΊsculas (a-z), nΓΊmeros e hΓfens permitidos.<br />Uma vez salvo, o identificador nΓ£o poderΓ‘ ser alterado.' | |
585 | text_caracters_maximum: mΓ‘ximo %d caracteres |
|
585 | text_caracters_maximum: mΓ‘ximo %d caracteres | |
586 | text_caracters_minimum: deve ter ao menos %d caracteres. |
|
586 | text_caracters_minimum: deve ter ao menos %d caracteres. | |
587 | text_length_between: deve ter entre %d e %d caracteres. |
|
587 | text_length_between: deve ter entre %d e %d caracteres. | |
588 | text_tracker_no_workflow: Sem workflow definido para este tipo. |
|
588 | text_tracker_no_workflow: Sem workflow definido para este tipo. | |
589 | text_unallowed_characters: Caracteres nΓ£o permitidos |
|
589 | text_unallowed_characters: Caracteres nΓ£o permitidos | |
590 | text_comma_separated: MΓΊltiplos valores sΓ£o permitidos (separados por vΓrgula). |
|
590 | text_comma_separated: MΓΊltiplos valores sΓ£o permitidos (separados por vΓrgula). | |
591 | text_issues_ref_in_commit_messages: Referenciando tickets nas mensagens de commit |
|
591 | text_issues_ref_in_commit_messages: Referenciando tickets nas mensagens de commit | |
592 | text_issue_added: Ticket %s incluΓdo (por %s). |
|
592 | text_issue_added: Ticket %s incluΓdo (por %s). | |
593 | text_issue_updated: Ticket %s alterado (por %s). |
|
593 | text_issue_updated: Ticket %s alterado (por %s). | |
594 | text_wiki_destroy_confirmation: VocΓͺ tem certeza que deseja excluir este wiki e TODO o seu conteΓΊdo? |
|
594 | text_wiki_destroy_confirmation: VocΓͺ tem certeza que deseja excluir este wiki e TODO o seu conteΓΊdo? | |
595 | text_issue_category_destroy_question: Alguns tickets (%d) estΓ£o atribuΓdos a esta categoria. O que vocΓͺ deseja fazer? |
|
595 | text_issue_category_destroy_question: Alguns tickets (%d) estΓ£o atribuΓdos a esta categoria. O que vocΓͺ deseja fazer? | |
596 | text_issue_category_destroy_assignments: Remover atribuiΓ§Γ΅es da categoria |
|
596 | text_issue_category_destroy_assignments: Remover atribuiΓ§Γ΅es da categoria | |
597 | text_issue_category_reassign_to: Redefinir tickets para esta categoria |
|
597 | text_issue_category_reassign_to: Redefinir tickets para esta categoria | |
598 | text_user_mail_option: "Para projetos (nΓ£o selecionados), vocΓͺ somente receberΓ‘ notificaΓ§Γ΅es sobre o que vocΓͺ monitora ou estΓ‘ envolvido (ex. tickets nos quais vocΓͺ Γ© o autor ou estΓ£o atribuΓdos a vocΓͺ)" |
|
598 | text_user_mail_option: "Para projetos (nΓ£o selecionados), vocΓͺ somente receberΓ‘ notificaΓ§Γ΅es sobre o que vocΓͺ monitora ou estΓ‘ envolvido (ex. tickets nos quais vocΓͺ Γ© o autor ou estΓ£o atribuΓdos a vocΓͺ)" | |
599 | text_no_configuration_data: "Os PapΓ©is, tipos de tickets, status de tickets e workflows nΓ£o foram configurados ainda.\nΓ altamente recomendado carregar as configuraΓ§Γ΅es padrΓ£o. VocΓͺ poderΓ‘ modificar estas configuraΓ§Γ΅es assim que carregadas." |
|
599 | text_no_configuration_data: "Os PapΓ©is, tipos de tickets, status de tickets e workflows nΓ£o foram configurados ainda.\nΓ altamente recomendado carregar as configuraΓ§Γ΅es padrΓ£o. VocΓͺ poderΓ‘ modificar estas configuraΓ§Γ΅es assim que carregadas." | |
600 | text_load_default_configuration: Carregar a configuraΓ§Γ£o padrΓ£o |
|
600 | text_load_default_configuration: Carregar a configuraΓ§Γ£o padrΓ£o | |
601 | text_status_changed_by_changeset: Aplicado no changeset %s. |
|
601 | text_status_changed_by_changeset: Aplicado no changeset %s. | |
602 | text_issues_destroy_confirmation: 'VocΓͺ tem certeza que deseja excluir o(s) ticket(s) selecionado(s)?' |
|
602 | text_issues_destroy_confirmation: 'VocΓͺ tem certeza que deseja excluir o(s) ticket(s) selecionado(s)?' | |
603 | text_select_project_modules: 'Selecione mΓ³dulos para habilitar para este projeto:' |
|
603 | text_select_project_modules: 'Selecione mΓ³dulos para habilitar para este projeto:' | |
604 | text_default_administrator_account_changed: Conta padrΓ£o do administrador alterada |
|
604 | text_default_administrator_account_changed: Conta padrΓ£o do administrador alterada | |
605 | text_file_repository_writable: RepositΓ³rio com permissΓ£o de escrita |
|
605 | text_file_repository_writable: RepositΓ³rio com permissΓ£o de escrita | |
606 | text_rmagick_available: RMagick disponΓvel (opcional) |
|
606 | text_rmagick_available: RMagick disponΓvel (opcional) | |
607 | text_destroy_time_entries_question: %.02f horas de trabalho foram registradas nos tickets que vocΓͺ estΓ‘ excluindo. O que vocΓͺ deseja fazer? |
|
607 | text_destroy_time_entries_question: %.02f horas de trabalho foram registradas nos tickets que vocΓͺ estΓ‘ excluindo. O que vocΓͺ deseja fazer? | |
608 | text_destroy_time_entries: Excluir horas de trabalho |
|
608 | text_destroy_time_entries: Excluir horas de trabalho | |
609 | text_assign_time_entries_to_project: Atribuir estas horas de trabalho para outro projeto |
|
609 | text_assign_time_entries_to_project: Atribuir estas horas de trabalho para outro projeto | |
610 | text_reassign_time_entries: 'Atribuir horas reportadas para este ticket:' |
|
610 | text_reassign_time_entries: 'Atribuir horas reportadas para este ticket:' | |
611 | text_user_wrote: '%s escreveu:' |
|
611 | text_user_wrote: '%s escreveu:' | |
612 | text_enumeration_destroy_question: '%d objetos estΓ£o atribuΓdos a este valor.' |
|
612 | text_enumeration_destroy_question: '%d objetos estΓ£o atribuΓdos a este valor.' | |
613 | text_enumeration_category_reassign_to: 'ReatribuΓ-los ao valor:' |
|
613 | text_enumeration_category_reassign_to: 'ReatribuΓ-los ao valor:' | |
614 | text_email_delivery_not_configured: "O envio de email nΓ£o estΓ‘ configurado, e as notificaΓ§Γ΅es estΓ£o inativas.\nConfigure seu servidor SMTP no arquivo config/email.yml e reinicie a aplicaΓ§Γ£o para ativΓ‘-las." |
|
614 | text_email_delivery_not_configured: "O envio de email nΓ£o estΓ‘ configurado, e as notificaΓ§Γ΅es estΓ£o inativas.\nConfigure seu servidor SMTP no arquivo config/email.yml e reinicie a aplicaΓ§Γ£o para ativΓ‘-las." | |
615 |
|
615 | |||
616 | default_role_manager: Gerente |
|
616 | default_role_manager: Gerente | |
617 | default_role_developper: Desenvolvedor |
|
617 | default_role_developper: Desenvolvedor | |
618 | default_role_reporter: Informante |
|
618 | default_role_reporter: Informante | |
619 | default_tracker_bug: Problema |
|
619 | default_tracker_bug: Problema | |
620 | default_tracker_feature: Funcionalidade |
|
620 | default_tracker_feature: Funcionalidade | |
621 | default_tracker_support: Suporte |
|
621 | default_tracker_support: Suporte | |
622 | default_issue_status_new: Novo |
|
622 | default_issue_status_new: Novo | |
623 | default_issue_status_assigned: AtribuΓdo |
|
623 | default_issue_status_assigned: AtribuΓdo | |
624 | default_issue_status_resolved: Resolvido |
|
624 | default_issue_status_resolved: Resolvido | |
625 | default_issue_status_feedback: Feedback |
|
625 | default_issue_status_feedback: Feedback | |
626 | default_issue_status_closed: Fechado |
|
626 | default_issue_status_closed: Fechado | |
627 | default_issue_status_rejected: Rejeitado |
|
627 | default_issue_status_rejected: Rejeitado | |
628 | default_doc_category_user: DocumentaΓ§Γ£o do usuΓ‘rio |
|
628 | default_doc_category_user: DocumentaΓ§Γ£o do usuΓ‘rio | |
629 | default_doc_category_tech: DocumentaΓ§Γ£o tΓ©cnica |
|
629 | default_doc_category_tech: DocumentaΓ§Γ£o tΓ©cnica | |
630 | default_priority_low: Baixo |
|
630 | default_priority_low: Baixo | |
631 | default_priority_normal: Normal |
|
631 | default_priority_normal: Normal | |
632 | default_priority_high: Alto |
|
632 | default_priority_high: Alto | |
633 | default_priority_urgent: Urgente |
|
633 | default_priority_urgent: Urgente | |
634 | default_priority_immediate: Imediato |
|
634 | default_priority_immediate: Imediato | |
635 | default_activity_design: Design |
|
635 | default_activity_design: Design | |
636 | default_activity_development: Desenvolvimento |
|
636 | default_activity_development: Desenvolvimento | |
637 |
|
637 | |||
638 | enumeration_issue_priorities: Prioridade das tarefas |
|
638 | enumeration_issue_priorities: Prioridade das tarefas | |
639 | enumeration_doc_categories: Categorias de documento |
|
639 | enumeration_doc_categories: Categorias de documento | |
640 | enumeration_activities: Atividades (time tracking) |
|
640 | enumeration_activities: Atividades (time tracking) | |
641 | notice_unable_delete_version: NΓ£o foi possΓvel excluir a versΓ£o |
|
641 | notice_unable_delete_version: NΓ£o foi possΓvel excluir a versΓ£o | |
642 | label_renamed: renomeado |
|
642 | label_renamed: renomeado | |
643 | label_copied: copiado |
|
643 | label_copied: copiado | |
644 | setting_plain_text_mail: texto plano apenas (sem HTML) |
|
644 | setting_plain_text_mail: texto plano apenas (sem HTML) | |
645 | permission_view_files: Ver Arquivos |
|
645 | permission_view_files: Ver Arquivos | |
646 | permission_edit_issues: Editar tickets |
|
646 | permission_edit_issues: Editar tickets | |
647 | permission_edit_own_time_entries: Editar o prΓ³prio tempo de trabalho |
|
647 | permission_edit_own_time_entries: Editar o prΓ³prio tempo de trabalho | |
648 | permission_manage_public_queries: Gerenciar consultas publicas |
|
648 | permission_manage_public_queries: Gerenciar consultas publicas | |
649 | permission_add_issues: Adicionar Tickets |
|
649 | permission_add_issues: Adicionar Tickets | |
650 | permission_log_time: Adicionar tempo gasto |
|
650 | permission_log_time: Adicionar tempo gasto | |
651 | permission_view_changesets: Ver changesets |
|
651 | permission_view_changesets: Ver changesets | |
652 | permission_view_time_entries: Ver tempo gasto |
|
652 | permission_view_time_entries: Ver tempo gasto | |
653 | permission_manage_versions: Gerenciar versΓ΅es |
|
653 | permission_manage_versions: Gerenciar versΓ΅es | |
654 | permission_manage_wiki: Gerenciar wiki |
|
654 | permission_manage_wiki: Gerenciar wiki | |
655 | permission_manage_categories: Gerenciar categorias de tickets |
|
655 | permission_manage_categories: Gerenciar categorias de tickets | |
656 | permission_protect_wiki_pages: Proteger pΓ‘ginas wiki |
|
656 | permission_protect_wiki_pages: Proteger pΓ‘ginas wiki | |
657 | permission_comment_news: Comentar notΓcias |
|
657 | permission_comment_news: Comentar notΓcias | |
658 | permission_delete_messages: Excluir mensagens |
|
658 | permission_delete_messages: Excluir mensagens | |
659 | permission_select_project_modules: Selecionar mΓ³dulos de projeto |
|
659 | permission_select_project_modules: Selecionar mΓ³dulos de projeto | |
660 | permission_manage_documents: Gerenciar documentos |
|
660 | permission_manage_documents: Gerenciar documentos | |
661 | permission_edit_wiki_pages: Editar pΓ‘ginas wiki |
|
661 | permission_edit_wiki_pages: Editar pΓ‘ginas wiki | |
662 | permission_add_issue_watchers: Adicionar monitores |
|
662 | permission_add_issue_watchers: Adicionar monitores | |
663 | permission_view_gantt: Ver grΓ‘fico gantt |
|
663 | permission_view_gantt: Ver grΓ‘fico gantt | |
664 | permission_move_issues: Mover tickets |
|
664 | permission_move_issues: Mover tickets | |
665 | permission_manage_issue_relations: Gerenciar relacionamentos de tickets |
|
665 | permission_manage_issue_relations: Gerenciar relacionamentos de tickets | |
666 | permission_delete_wiki_pages: Excluir pΓ‘ginas wiki |
|
666 | permission_delete_wiki_pages: Excluir pΓ‘ginas wiki | |
667 | permission_manage_boards: Gerenciar fΓ³runs |
|
667 | permission_manage_boards: Gerenciar fΓ³runs | |
668 | permission_delete_wiki_pages_attachments: Excluir anexos |
|
668 | permission_delete_wiki_pages_attachments: Excluir anexos | |
669 | permission_view_wiki_edits: Ver histΓ³rico do wiki |
|
669 | permission_view_wiki_edits: Ver histΓ³rico do wiki | |
670 | permission_add_messages: Postar mensagens |
|
670 | permission_add_messages: Postar mensagens | |
671 | permission_view_messages: Ver mensagens |
|
671 | permission_view_messages: Ver mensagens | |
672 | permission_manage_files: Gerenciar arquivos |
|
672 | permission_manage_files: Gerenciar arquivos | |
673 | permission_edit_issue_notes: Editar notas |
|
673 | permission_edit_issue_notes: Editar notas | |
674 | permission_manage_news: Gerenciar notΓcias |
|
674 | permission_manage_news: Gerenciar notΓcias | |
675 | permission_view_calendar: Ver caneldΓ‘rio |
|
675 | permission_view_calendar: Ver caneldΓ‘rio | |
676 | permission_manage_members: Gerenciar membros |
|
676 | permission_manage_members: Gerenciar membros | |
677 | permission_edit_messages: Editar mensagens |
|
677 | permission_edit_messages: Editar mensagens | |
678 | permission_delete_issues: Excluir tickets |
|
678 | permission_delete_issues: Excluir tickets | |
679 | permission_view_issue_watchers: Ver lista de monitores |
|
679 | permission_view_issue_watchers: Ver lista de monitores | |
680 | permission_manage_repository: Gerenciar repositΓ³rio |
|
680 | permission_manage_repository: Gerenciar repositΓ³rio | |
681 | permission_commit_access: Acesso de commit |
|
681 | permission_commit_access: Acesso de commit | |
682 | permission_browse_repository: Pesquisar repositorio |
|
682 | permission_browse_repository: Pesquisar repositorio | |
683 | permission_view_documents: Ver documentos |
|
683 | permission_view_documents: Ver documentos | |
684 | permission_edit_project: Editar projeto |
|
684 | permission_edit_project: Editar projeto | |
685 | permission_add_issue_notes: Adicionar notas |
|
685 | permission_add_issue_notes: Adicionar notas | |
686 | permission_save_queries: Salvar consultas |
|
686 | permission_save_queries: Salvar consultas | |
687 | permission_view_wiki_pages: Ver wiki |
|
687 | permission_view_wiki_pages: Ver wiki | |
688 | permission_rename_wiki_pages: Renomear pΓ‘ginas wiki |
|
688 | permission_rename_wiki_pages: Renomear pΓ‘ginas wiki | |
689 | permission_edit_time_entries: Editar tempo gasto |
|
689 | permission_edit_time_entries: Editar tempo gasto | |
690 | permission_edit_own_issue_notes: Editar prΓ³prias notas |
|
690 | permission_edit_own_issue_notes: Editar prΓ³prias notas | |
691 | setting_gravatar_enabled: Usar Γcones do Gravatar |
|
691 | setting_gravatar_enabled: Usar Γcones do Gravatar | |
692 | label_example: Exemplo |
|
692 | label_example: Exemplo | |
693 | text_repository_usernames_mapping: "Seleciona ou atualiza os usuΓ‘rios do Redmine mapeando para cada usuΓ‘rio encontrado no log do repositΓ³rio.\nUsuΓ‘rios com o mesmo login ou email no Redmine e no repositΓ³rio serΓ£o mapeados automaticamente." |
|
693 | text_repository_usernames_mapping: "Seleciona ou atualiza os usuΓ‘rios do Redmine mapeando para cada usuΓ‘rio encontrado no log do repositΓ³rio.\nUsuΓ‘rios com o mesmo login ou email no Redmine e no repositΓ³rio serΓ£o mapeados automaticamente." | |
694 | permission_edit_own_messages: Editar prΓ³prias mensagens |
|
694 | permission_edit_own_messages: Editar prΓ³prias mensagens | |
695 | permission_delete_own_messages: Excluir prΓ³prias mensagens |
|
695 | permission_delete_own_messages: Excluir prΓ³prias mensagens | |
696 | label_user_activity: "Atividade de %s" |
|
696 | label_user_activity: "Atividade de %s" | |
697 | label_updated_time_by: Updated by %s %s ago |
|
697 | label_updated_time_by: Updated by %s %s ago | |
698 | text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.' |
|
698 | text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.' | |
699 | setting_diff_max_lines_displayed: Max number of diff lines displayed |
|
699 | setting_diff_max_lines_displayed: Max number of diff lines displayed |
@@ -1,1174 +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 <b>bold</b> man</h1>" |
|
252 | # #=>"<h1>A <b>bold</b> 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%/, '&' ) |
|
312 | text.gsub!( /x%x%/, '&' ) | |
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’\2' ], # single closing |
|
400 | # [ /([^\s\[{(>])?\'([dmst]\b|ll\b|ve\b|\s|:|$)/, '\1’\2' ], # single closing | |
401 | # [ /([^\s\[{(>#{PUNCT_Q}][#{PUNCT_Q}]*)\'/, '\1’' ], # single closing |
|
401 | # [ /([^\s\[{(>#{PUNCT_Q}][#{PUNCT_Q}]*)\'/, '\1’' ], # single closing | |
402 | # [ /\'(?=[#{PUNCT_Q}]*(s\b|[\s#{PUNCT_NOQ}]))/, '’' ], # single closing |
|
402 | # [ /\'(?=[#{PUNCT_Q}]*(s\b|[\s#{PUNCT_NOQ}]))/, '’' ], # single closing | |
403 | # [ /\'/, '‘' ], # single opening |
|
403 | # [ /\'/, '‘' ], # single opening | |
404 | # [ /</, '<' ], # less-than |
|
404 | # [ /</, '<' ], # less-than | |
405 | # [ />/, '>' ], # greater-than |
|
405 | # [ />/, '>' ], # greater-than | |
406 | # [ /([^\s\[{(])?"(\s|:|$)/, '\1”\2' ], # double closing |
|
406 | # [ /([^\s\[{(])?"(\s|:|$)/, '\1”\2' ], # double closing | |
407 | # [ /([^\s\[{(>#{PUNCT_Q}][#{PUNCT_Q}]*)"/, '\1”' ], # double closing |
|
407 | # [ /([^\s\[{(>#{PUNCT_Q}][#{PUNCT_Q}]*)"/, '\1”' ], # double closing | |
408 | # [ /"(?=[#{PUNCT_Q}]*[\s#{PUNCT_NOQ}])/, '”' ], # double closing |
|
408 | # [ /"(?=[#{PUNCT_Q}]*[\s#{PUNCT_NOQ}])/, '”' ], # double closing | |
409 | # [ /"/, '“' ], # double opening |
|
409 | # [ /"/, '“' ], # double opening | |
410 | # [ /\b( )?\.{3}/, '\1…' ], # ellipsis |
|
410 | # [ /\b( )?\.{3}/, '\1…' ], # 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—' ], # em dash |
|
413 | # [ /(\.\s)?\s?--\s?/, '\1—' ], # em dash | |
414 | # [ /\s->\s/, ' → ' ], # right arrow |
|
414 | # [ /\s->\s/, ' → ' ], # right arrow | |
415 | # [ /\s-\s/, ' – ' ], # en dash |
|
415 | # [ /\s-\s/, ' – ' ], # en dash | |
416 | # [ /(\d+) ?x ?(\d+)/, '\1×\2' ], # dimension sign |
|
416 | # [ /(\d+) ?x ?(\d+)/, '\1×\2' ], # dimension sign | |
417 | # [ /\b ?[(\[]TM[\])]/i, '™' ], # trademark |
|
417 | # [ /\b ?[(\[]TM[\])]/i, '™' ], # trademark | |
418 | # [ /\b ?[(\[]R[\])]/i, '®' ], # registered |
|
418 | # [ /\b ?[(\[]R[\])]/i, '®' ], # registered | |
419 | # [ /\b ?[(\[]C[\])]/i, '©' ] # copyright |
|
419 | # [ /\b ?[(\[]C[\])]/i, '©' ] # 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!( '&', '&' ) |
|
440 | str.gsub!( '&', '&' ) | |
441 | str.gsub!( '"', '"' ) if mode != :NoQuotes |
|
441 | str.gsub!( '"', '"' ) if mode != :NoQuotes | |
442 | str.gsub!( "'", ''' ) if mode == :Quotes |
|
442 | str.gsub!( "'", ''' ) if mode == :Quotes | |
443 | str.gsub!( '<', '<') |
|
443 | str.gsub!( '<', '<') | |
444 | str.gsub!( '>', '>') |
|
444 | str.gsub!( '>', '>') | |
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 |
( |
|
794 | ( # $url | |
|
795 | (\/|https?:\/\/|s?ftps?:\/\/|www\.) | |||
|
796 | [\w\/]\S+? | |||
|
797 | ) | |||
795 | (\/)? # $slash |
|
798 | (\/)? # $slash | |
796 | ([^\w\=\/;\(\)]*?) # $post |
|
799 | ([^\w\=\/;\(\)]*?) # $post | |
797 | (?=<|\s|$) |
|
800 | (?=<|\s|$) | |
798 | /x |
|
801 | /x | |
799 | #" |
|
802 | #" | |
800 | def inline_textile_link( text ) |
|
803 | def inline_textile_link( text ) | |
801 | text.gsub!( LINK_RE ) do |m| |
|
804 | text.gsub!( LINK_RE ) do |m| | |
802 |
pre,atts,text,title,url,slash,post = $~[1.. |
|
805 | pre,atts,text,title,url,proto,slash,post = $~[1..8] | |
803 |
|
806 | |||
804 | url, url_title = check_refs( url ) |
|
807 | url, url_title = check_refs( url ) | |
805 | title ||= url_title |
|
808 | title ||= url_title | |
806 |
|
809 | |||
807 | # Idea below : an URL with unbalanced parethesis and |
|
810 | # Idea below : an URL with unbalanced parethesis and | |
808 | # ending by ')' is put into external parenthesis |
|
811 | # ending by ')' is put into external parenthesis | |
809 | if ( url[-1]==?) and ((url.count("(") - url.count(")")) < 0 ) ) |
|
812 | if ( url[-1]==?) and ((url.count("(") - url.count(")")) < 0 ) ) | |
810 | url=url[0..-2] # discard closing parenth from url |
|
813 | url=url[0..-2] # discard closing parenth from url | |
811 | post = ")"+post # add closing parenth to post |
|
814 | post = ")"+post # add closing parenth to post | |
812 | end |
|
815 | end | |
813 | atts = pba( atts ) |
|
816 | atts = pba( atts ) | |
814 | atts = " href=\"#{ url }#{ slash }\"#{ atts }" |
|
817 | atts = " href=\"#{ url }#{ slash }\"#{ atts }" | |
815 | atts << " title=\"#{ htmlesc title }\"" if title |
|
818 | atts << " title=\"#{ htmlesc title }\"" if title | |
816 | atts = shelve( atts ) if atts |
|
819 | atts = shelve( atts ) if atts | |
817 |
|
820 | |||
818 | external = (url =~ /^https?:\/\//) ? ' class="external"' : '' |
|
821 | external = (url =~ /^https?:\/\//) ? ' class="external"' : '' | |
819 |
|
822 | |||
820 | "#{ pre }<a#{ atts }#{ external }>#{ text }</a>#{ post }" |
|
823 | "#{ pre }<a#{ atts }#{ external }>#{ text }</a>#{ post }" | |
821 | end |
|
824 | end | |
822 | end |
|
825 | end | |
823 |
|
826 | |||
824 | MARKDOWN_REFLINK_RE = / |
|
827 | MARKDOWN_REFLINK_RE = / | |
825 | \[([^\[\]]+)\] # $text |
|
828 | \[([^\[\]]+)\] # $text | |
826 | [ ]? # opt. space |
|
829 | [ ]? # opt. space | |
827 | (?:\n[ ]*)? # one optional newline followed by spaces |
|
830 | (?:\n[ ]*)? # one optional newline followed by spaces | |
828 | \[(.*?)\] # $id |
|
831 | \[(.*?)\] # $id | |
829 | /x |
|
832 | /x | |
830 |
|
833 | |||
831 | def inline_markdown_reflink( text ) |
|
834 | def inline_markdown_reflink( text ) | |
832 | text.gsub!( MARKDOWN_REFLINK_RE ) do |m| |
|
835 | text.gsub!( MARKDOWN_REFLINK_RE ) do |m| | |
833 | text, id = $~[1..2] |
|
836 | text, id = $~[1..2] | |
834 |
|
837 | |||
835 | if id.empty? |
|
838 | if id.empty? | |
836 | url, title = check_refs( text ) |
|
839 | url, title = check_refs( text ) | |
837 | else |
|
840 | else | |
838 | url, title = check_refs( id ) |
|
841 | url, title = check_refs( id ) | |
839 | end |
|
842 | end | |
840 |
|
843 | |||
841 | atts = " href=\"#{ url }\"" |
|
844 | atts = " href=\"#{ url }\"" | |
842 | atts << " title=\"#{ title }\"" if title |
|
845 | atts << " title=\"#{ title }\"" if title | |
843 | atts = shelve( atts ) |
|
846 | atts = shelve( atts ) | |
844 |
|
847 | |||
845 | "<a#{ atts }>#{ text }</a>" |
|
848 | "<a#{ atts }>#{ text }</a>" | |
846 | end |
|
849 | end | |
847 | end |
|
850 | end | |
848 |
|
851 | |||
849 | MARKDOWN_LINK_RE = / |
|
852 | MARKDOWN_LINK_RE = / | |
850 | \[([^\[\]]+)\] # $text |
|
853 | \[([^\[\]]+)\] # $text | |
851 | \( # open paren |
|
854 | \( # open paren | |
852 | [ \t]* # opt space |
|
855 | [ \t]* # opt space | |
853 | <?(.+?)>? # $href |
|
856 | <?(.+?)>? # $href | |
854 | [ \t]* # opt space |
|
857 | [ \t]* # opt space | |
855 | (?: # whole title |
|
858 | (?: # whole title | |
856 | (['"]) # $quote |
|
859 | (['"]) # $quote | |
857 | (.*?) # $title |
|
860 | (.*?) # $title | |
858 | \3 # matching quote |
|
861 | \3 # matching quote | |
859 | )? # title is optional |
|
862 | )? # title is optional | |
860 | \) |
|
863 | \) | |
861 | /x |
|
864 | /x | |
862 |
|
865 | |||
863 | def inline_markdown_link( text ) |
|
866 | def inline_markdown_link( text ) | |
864 | text.gsub!( MARKDOWN_LINK_RE ) do |m| |
|
867 | text.gsub!( MARKDOWN_LINK_RE ) do |m| | |
865 | text, url, quote, title = $~[1..4] |
|
868 | text, url, quote, title = $~[1..4] | |
866 |
|
869 | |||
867 | atts = " href=\"#{ url }\"" |
|
870 | atts = " href=\"#{ url }\"" | |
868 | atts << " title=\"#{ title }\"" if title |
|
871 | atts << " title=\"#{ title }\"" if title | |
869 | atts = shelve( atts ) |
|
872 | atts = shelve( atts ) | |
870 |
|
873 | |||
871 | "<a#{ atts }>#{ text }</a>" |
|
874 | "<a#{ atts }>#{ text }</a>" | |
872 | end |
|
875 | end | |
873 | end |
|
876 | end | |
874 |
|
877 | |||
875 | TEXTILE_REFS_RE = /(^ *)\[([^\[\n]+?)\](#{HYPERLINK})(?=\s|$)/ |
|
878 | TEXTILE_REFS_RE = /(^ *)\[([^\[\n]+?)\](#{HYPERLINK})(?=\s|$)/ | |
876 | MARKDOWN_REFS_RE = /(^ *)\[([^\n]+?)\]:\s+<?(#{HYPERLINK})>?(?:\s+"((?:[^"]|\\")+)")?(?=\s|$)/m |
|
879 | MARKDOWN_REFS_RE = /(^ *)\[([^\n]+?)\]:\s+<?(#{HYPERLINK})>?(?:\s+"((?:[^"]|\\")+)")?(?=\s|$)/m | |
877 |
|
880 | |||
878 | def refs( text ) |
|
881 | def refs( text ) | |
879 | @rules.each do |rule_name| |
|
882 | @rules.each do |rule_name| | |
880 | 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_/ | |
881 | end |
|
884 | end | |
882 | end |
|
885 | end | |
883 |
|
886 | |||
884 | def refs_textile( text ) |
|
887 | def refs_textile( text ) | |
885 | text.gsub!( TEXTILE_REFS_RE ) do |m| |
|
888 | text.gsub!( TEXTILE_REFS_RE ) do |m| | |
886 | flag, url = $~[2..3] |
|
889 | flag, url = $~[2..3] | |
887 | @urlrefs[flag.downcase] = [url, nil] |
|
890 | @urlrefs[flag.downcase] = [url, nil] | |
888 | nil |
|
891 | nil | |
889 | end |
|
892 | end | |
890 | end |
|
893 | end | |
891 |
|
894 | |||
892 | def refs_markdown( text ) |
|
895 | def refs_markdown( text ) | |
893 | text.gsub!( MARKDOWN_REFS_RE ) do |m| |
|
896 | text.gsub!( MARKDOWN_REFS_RE ) do |m| | |
894 | flag, url = $~[2..3] |
|
897 | flag, url = $~[2..3] | |
895 | title = $~[6] |
|
898 | title = $~[6] | |
896 | @urlrefs[flag.downcase] = [url, title] |
|
899 | @urlrefs[flag.downcase] = [url, title] | |
897 | nil |
|
900 | nil | |
898 | end |
|
901 | end | |
899 | end |
|
902 | end | |
900 |
|
903 | |||
901 | def check_refs( text ) |
|
904 | def check_refs( text ) | |
902 | ret = @urlrefs[text.downcase] if text |
|
905 | ret = @urlrefs[text.downcase] if text | |
903 | ret || [text, nil] |
|
906 | ret || [text, nil] | |
904 | end |
|
907 | end | |
905 |
|
908 | |||
906 | IMAGE_RE = / |
|
909 | IMAGE_RE = / | |
907 | (<p>|.|^) # start of line? |
|
910 | (<p>|.|^) # start of line? | |
908 | \! # opening |
|
911 | \! # opening | |
909 | (\<|\=|\>)? # optional alignment atts |
|
912 | (\<|\=|\>)? # optional alignment atts | |
910 | (#{C}) # optional style,class atts |
|
913 | (#{C}) # optional style,class atts | |
911 | (?:\. )? # optional dot-space |
|
914 | (?:\. )? # optional dot-space | |
912 | ([^\s(!]+?) # presume this is the src |
|
915 | ([^\s(!]+?) # presume this is the src | |
913 | \s? # optional space |
|
916 | \s? # optional space | |
914 | (?:\(((?:[^\(\)]|\([^\)]+\))+?)\))? # optional title |
|
917 | (?:\(((?:[^\(\)]|\([^\)]+\))+?)\))? # optional title | |
915 | \! # closing |
|
918 | \! # closing | |
916 | (?::#{ HYPERLINK })? # optional href |
|
919 | (?::#{ HYPERLINK })? # optional href | |
917 | /x |
|
920 | /x | |
918 |
|
921 | |||
919 | def inline_textile_image( text ) |
|
922 | def inline_textile_image( text ) | |
920 | text.gsub!( IMAGE_RE ) do |m| |
|
923 | text.gsub!( IMAGE_RE ) do |m| | |
921 | 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] | |
922 | htmlesc title |
|
925 | htmlesc title | |
923 | atts = pba( atts ) |
|
926 | atts = pba( atts ) | |
924 | atts = " src=\"#{ url }\"#{ atts }" |
|
927 | atts = " src=\"#{ url }\"#{ atts }" | |
925 | atts << " title=\"#{ title }\"" if title |
|
928 | atts << " title=\"#{ title }\"" if title | |
926 | atts << " alt=\"#{ title }\"" |
|
929 | atts << " alt=\"#{ title }\"" | |
927 | # size = @getimagesize($url); |
|
930 | # size = @getimagesize($url); | |
928 | # if($size) $atts.= " $size[3]"; |
|
931 | # if($size) $atts.= " $size[3]"; | |
929 |
|
932 | |||
930 | href, alt_title = check_refs( href ) if href |
|
933 | href, alt_title = check_refs( href ) if href | |
931 | url, url_title = check_refs( url ) |
|
934 | url, url_title = check_refs( url ) | |
932 |
|
935 | |||
933 | out = '' |
|
936 | out = '' | |
934 | out << "<a#{ shelve( " href=\"#{ href }\"" ) }>" if href |
|
937 | out << "<a#{ shelve( " href=\"#{ href }\"" ) }>" if href | |
935 | out << "<img#{ shelve( atts ) } />" |
|
938 | out << "<img#{ shelve( atts ) } />" | |
936 | out << "</a>#{ href_a1 }#{ href_a2 }" if href |
|
939 | out << "</a>#{ href_a1 }#{ href_a2 }" if href | |
937 |
|
940 | |||
938 | if algn |
|
941 | if algn | |
939 | algn = h_align( algn ) |
|
942 | algn = h_align( algn ) | |
940 | if stln == "<p>" |
|
943 | if stln == "<p>" | |
941 | out = "<p style=\"float:#{ algn }\">#{ out }" |
|
944 | out = "<p style=\"float:#{ algn }\">#{ out }" | |
942 | else |
|
945 | else | |
943 | out = "#{ stln }<div style=\"float:#{ algn }\">#{ out }</div>" |
|
946 | out = "#{ stln }<div style=\"float:#{ algn }\">#{ out }</div>" | |
944 | end |
|
947 | end | |
945 | else |
|
948 | else | |
946 | out = stln + out |
|
949 | out = stln + out | |
947 | end |
|
950 | end | |
948 |
|
951 | |||
949 | out |
|
952 | out | |
950 | end |
|
953 | end | |
951 | end |
|
954 | end | |
952 |
|
955 | |||
953 | def shelve( val ) |
|
956 | def shelve( val ) | |
954 | @shelf << val |
|
957 | @shelf << val | |
955 | " :redsh##{ @shelf.length }:" |
|
958 | " :redsh##{ @shelf.length }:" | |
956 | end |
|
959 | end | |
957 |
|
960 | |||
958 | def retrieve( text ) |
|
961 | def retrieve( text ) | |
959 | @shelf.each_with_index do |r, i| |
|
962 | @shelf.each_with_index do |r, i| | |
960 | text.gsub!( " :redsh##{ i + 1 }:", r ) |
|
963 | text.gsub!( " :redsh##{ i + 1 }:", r ) | |
961 | end |
|
964 | end | |
962 | end |
|
965 | end | |
963 |
|
966 | |||
964 | def incoming_entities( text ) |
|
967 | def incoming_entities( text ) | |
965 | ## turn any incoming ampersands into a dummy character for now. |
|
968 | ## turn any incoming ampersands into a dummy character for now. | |
966 | ## This uses a negative lookahead for alphanumerics followed by a semicolon, |
|
969 | ## This uses a negative lookahead for alphanumerics followed by a semicolon, | |
967 | ## implying an incoming html entity, to be skipped |
|
970 | ## implying an incoming html entity, to be skipped | |
968 |
|
971 | |||
969 | text.gsub!( /&(?![#a-z0-9]+;)/i, "x%x%" ) |
|
972 | text.gsub!( /&(?![#a-z0-9]+;)/i, "x%x%" ) | |
970 | end |
|
973 | end | |
971 |
|
974 | |||
972 | def no_textile( text ) |
|
975 | def no_textile( text ) | |
973 | text.gsub!( /(^|\s)==([^=]+.*?)==(\s|$)?/, |
|
976 | text.gsub!( /(^|\s)==([^=]+.*?)==(\s|$)?/, | |
974 | '\1<notextile>\2</notextile>\3' ) |
|
977 | '\1<notextile>\2</notextile>\3' ) | |
975 | text.gsub!( /^ *==([^=]+.*?)==/m, |
|
978 | text.gsub!( /^ *==([^=]+.*?)==/m, | |
976 | '\1<notextile>\2</notextile>\3' ) |
|
979 | '\1<notextile>\2</notextile>\3' ) | |
977 | end |
|
980 | end | |
978 |
|
981 | |||
979 | def clean_white_space( text ) |
|
982 | def clean_white_space( text ) | |
980 | # normalize line breaks |
|
983 | # normalize line breaks | |
981 | text.gsub!( /\r\n/, "\n" ) |
|
984 | text.gsub!( /\r\n/, "\n" ) | |
982 | text.gsub!( /\r/, "\n" ) |
|
985 | text.gsub!( /\r/, "\n" ) | |
983 | text.gsub!( /\t/, ' ' ) |
|
986 | text.gsub!( /\t/, ' ' ) | |
984 | text.gsub!( /^ +$/, '' ) |
|
987 | text.gsub!( /^ +$/, '' ) | |
985 | text.gsub!( /\n{3,}/, "\n\n" ) |
|
988 | text.gsub!( /\n{3,}/, "\n\n" ) | |
986 | text.gsub!( /"$/, "\" " ) |
|
989 | text.gsub!( /"$/, "\" " ) | |
987 |
|
990 | |||
988 | # if entire document is indented, flush |
|
991 | # if entire document is indented, flush | |
989 | # to the left side |
|
992 | # to the left side | |
990 | flush_left text |
|
993 | flush_left text | |
991 | end |
|
994 | end | |
992 |
|
995 | |||
993 | def flush_left( text ) |
|
996 | def flush_left( text ) | |
994 | indt = 0 |
|
997 | indt = 0 | |
995 | if text =~ /^ / |
|
998 | if text =~ /^ / | |
996 | while text !~ /^ {#{indt}}\S/ |
|
999 | while text !~ /^ {#{indt}}\S/ | |
997 | indt += 1 |
|
1000 | indt += 1 | |
998 | end unless text.empty? |
|
1001 | end unless text.empty? | |
999 | if indt.nonzero? |
|
1002 | if indt.nonzero? | |
1000 | text.gsub!( /^ {#{indt}}/, '' ) |
|
1003 | text.gsub!( /^ {#{indt}}/, '' ) | |
1001 | end |
|
1004 | end | |
1002 | end |
|
1005 | end | |
1003 | end |
|
1006 | end | |
1004 |
|
1007 | |||
1005 | def footnote_ref( text ) |
|
1008 | def footnote_ref( text ) | |
1006 | text.gsub!( /\b\[([0-9]+?)\](\s)?/, |
|
1009 | text.gsub!( /\b\[([0-9]+?)\](\s)?/, | |
1007 | '<sup><a href="#fn\1">\1</a></sup>\2' ) |
|
1010 | '<sup><a href="#fn\1">\1</a></sup>\2' ) | |
1008 | end |
|
1011 | end | |
1009 |
|
1012 | |||
1010 | OFFTAGS = /(code|pre|kbd|notextile)/ |
|
1013 | OFFTAGS = /(code|pre|kbd|notextile)/ | |
1011 | OFFTAG_MATCH = /(?:(<\/#{ OFFTAGS }>)|(<#{ OFFTAGS }[^>]*>))(.*?)(?=<\/?#{ OFFTAGS }|\Z)/mi |
|
1014 | OFFTAG_MATCH = /(?:(<\/#{ OFFTAGS }>)|(<#{ OFFTAGS }[^>]*>))(.*?)(?=<\/?#{ OFFTAGS }|\Z)/mi | |
1012 | OFFTAG_OPEN = /<#{ OFFTAGS }/ |
|
1015 | OFFTAG_OPEN = /<#{ OFFTAGS }/ | |
1013 | OFFTAG_CLOSE = /<\/?#{ OFFTAGS }/ |
|
1016 | OFFTAG_CLOSE = /<\/?#{ OFFTAGS }/ | |
1014 | HASTAG_MATCH = /(<\/?\w[^\n]*?>)/m |
|
1017 | HASTAG_MATCH = /(<\/?\w[^\n]*?>)/m | |
1015 | ALLTAG_MATCH = /(<\/?\w[^\n]*?>)|.*?(?=<\/?\w[^\n]*?>|$)/m |
|
1018 | ALLTAG_MATCH = /(<\/?\w[^\n]*?>)|.*?(?=<\/?\w[^\n]*?>|$)/m | |
1016 |
|
1019 | |||
1017 | def glyphs_textile( text, level = 0 ) |
|
1020 | def glyphs_textile( text, level = 0 ) | |
1018 | if text !~ HASTAG_MATCH |
|
1021 | if text !~ HASTAG_MATCH | |
1019 | pgl text |
|
1022 | pgl text | |
1020 | footnote_ref text |
|
1023 | footnote_ref text | |
1021 | else |
|
1024 | else | |
1022 | codepre = 0 |
|
1025 | codepre = 0 | |
1023 | text.gsub!( ALLTAG_MATCH ) do |line| |
|
1026 | text.gsub!( ALLTAG_MATCH ) do |line| | |
1024 | ## matches are off if we're between <code>, <pre> etc. |
|
1027 | ## matches are off if we're between <code>, <pre> etc. | |
1025 | if $1 |
|
1028 | if $1 | |
1026 | if line =~ OFFTAG_OPEN |
|
1029 | if line =~ OFFTAG_OPEN | |
1027 | codepre += 1 |
|
1030 | codepre += 1 | |
1028 | elsif line =~ OFFTAG_CLOSE |
|
1031 | elsif line =~ OFFTAG_CLOSE | |
1029 | codepre -= 1 |
|
1032 | codepre -= 1 | |
1030 | codepre = 0 if codepre < 0 |
|
1033 | codepre = 0 if codepre < 0 | |
1031 | end |
|
1034 | end | |
1032 | elsif codepre.zero? |
|
1035 | elsif codepre.zero? | |
1033 | glyphs_textile( line, level + 1 ) |
|
1036 | glyphs_textile( line, level + 1 ) | |
1034 | else |
|
1037 | else | |
1035 | htmlesc( line, :NoQuotes ) |
|
1038 | htmlesc( line, :NoQuotes ) | |
1036 | end |
|
1039 | end | |
1037 | # p [level, codepre, line] |
|
1040 | # p [level, codepre, line] | |
1038 |
|
1041 | |||
1039 | line |
|
1042 | line | |
1040 | end |
|
1043 | end | |
1041 | end |
|
1044 | end | |
1042 | end |
|
1045 | end | |
1043 |
|
1046 | |||
1044 | def rip_offtags( text ) |
|
1047 | def rip_offtags( text ) | |
1045 | if text =~ /<.*>/ |
|
1048 | if text =~ /<.*>/ | |
1046 | ## strip and encode <pre> content |
|
1049 | ## strip and encode <pre> content | |
1047 | codepre, used_offtags = 0, {} |
|
1050 | codepre, used_offtags = 0, {} | |
1048 | text.gsub!( OFFTAG_MATCH ) do |line| |
|
1051 | text.gsub!( OFFTAG_MATCH ) do |line| | |
1049 | if $3 |
|
1052 | if $3 | |
1050 | offtag, aftertag = $4, $5 |
|
1053 | offtag, aftertag = $4, $5 | |
1051 | codepre += 1 |
|
1054 | codepre += 1 | |
1052 | used_offtags[offtag] = true |
|
1055 | used_offtags[offtag] = true | |
1053 | if codepre - used_offtags.length > 0 |
|
1056 | if codepre - used_offtags.length > 0 | |
1054 | htmlesc( line, :NoQuotes ) |
|
1057 | htmlesc( line, :NoQuotes ) | |
1055 | @pre_list.last << line |
|
1058 | @pre_list.last << line | |
1056 | line = "" |
|
1059 | line = "" | |
1057 | else |
|
1060 | else | |
1058 | htmlesc( aftertag, :NoQuotes ) if aftertag |
|
1061 | htmlesc( aftertag, :NoQuotes ) if aftertag | |
1059 | line = "<redpre##{ @pre_list.length }>" |
|
1062 | line = "<redpre##{ @pre_list.length }>" | |
1060 | $3.match(/<#{ OFFTAGS }([^>]*)>/) |
|
1063 | $3.match(/<#{ OFFTAGS }([^>]*)>/) | |
1061 | tag = $1 |
|
1064 | tag = $1 | |
1062 | $2.to_s.match(/(class\=\S+)/i) |
|
1065 | $2.to_s.match(/(class\=\S+)/i) | |
1063 | tag << " #{$1}" if $1 |
|
1066 | tag << " #{$1}" if $1 | |
1064 | @pre_list << "<#{ tag }>#{ aftertag }" |
|
1067 | @pre_list << "<#{ tag }>#{ aftertag }" | |
1065 | end |
|
1068 | end | |
1066 | elsif $1 and codepre > 0 |
|
1069 | elsif $1 and codepre > 0 | |
1067 | if codepre - used_offtags.length > 0 |
|
1070 | if codepre - used_offtags.length > 0 | |
1068 | htmlesc( line, :NoQuotes ) |
|
1071 | htmlesc( line, :NoQuotes ) | |
1069 | @pre_list.last << line |
|
1072 | @pre_list.last << line | |
1070 | line = "" |
|
1073 | line = "" | |
1071 | end |
|
1074 | end | |
1072 | codepre -= 1 unless codepre.zero? |
|
1075 | codepre -= 1 unless codepre.zero? | |
1073 | used_offtags = {} if codepre.zero? |
|
1076 | used_offtags = {} if codepre.zero? | |
1074 | end |
|
1077 | end | |
1075 | line |
|
1078 | line | |
1076 | end |
|
1079 | end | |
1077 | end |
|
1080 | end | |
1078 | text |
|
1081 | text | |
1079 | end |
|
1082 | end | |
1080 |
|
1083 | |||
1081 | def smooth_offtags( text ) |
|
1084 | def smooth_offtags( text ) | |
1082 | unless @pre_list.empty? |
|
1085 | unless @pre_list.empty? | |
1083 | ## replace <pre> content |
|
1086 | ## replace <pre> content | |
1084 | text.gsub!( /<redpre#(\d+)>/ ) { @pre_list[$1.to_i] } |
|
1087 | text.gsub!( /<redpre#(\d+)>/ ) { @pre_list[$1.to_i] } | |
1085 | end |
|
1088 | end | |
1086 | end |
|
1089 | end | |
1087 |
|
1090 | |||
1088 | def inline( text ) |
|
1091 | def inline( text ) | |
1089 | [/^inline_/, /^glyphs_/].each do |meth_re| |
|
1092 | [/^inline_/, /^glyphs_/].each do |meth_re| | |
1090 | @rules.each do |rule_name| |
|
1093 | @rules.each do |rule_name| | |
1091 | 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 ) | |
1092 | end |
|
1095 | end | |
1093 | end |
|
1096 | end | |
1094 | end |
|
1097 | end | |
1095 |
|
1098 | |||
1096 | def h_align( text ) |
|
1099 | def h_align( text ) | |
1097 | H_ALGN_VALS[text] |
|
1100 | H_ALGN_VALS[text] | |
1098 | end |
|
1101 | end | |
1099 |
|
1102 | |||
1100 | def v_align( text ) |
|
1103 | def v_align( text ) | |
1101 | V_ALGN_VALS[text] |
|
1104 | V_ALGN_VALS[text] | |
1102 | end |
|
1105 | end | |
1103 |
|
1106 | |||
1104 | def textile_popup_help( name, windowW, windowH ) |
|
1107 | def textile_popup_help( name, windowW, windowH ) | |
1105 | ' <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 />' | |
1106 | end |
|
1109 | end | |
1107 |
|
1110 | |||
1108 | # HTML cleansing stuff |
|
1111 | # HTML cleansing stuff | |
1109 | BASIC_TAGS = { |
|
1112 | BASIC_TAGS = { | |
1110 | 'a' => ['href', 'title'], |
|
1113 | 'a' => ['href', 'title'], | |
1111 | 'img' => ['src', 'alt', 'title'], |
|
1114 | 'img' => ['src', 'alt', 'title'], | |
1112 | 'br' => [], |
|
1115 | 'br' => [], | |
1113 | 'i' => nil, |
|
1116 | 'i' => nil, | |
1114 | 'u' => nil, |
|
1117 | 'u' => nil, | |
1115 | 'b' => nil, |
|
1118 | 'b' => nil, | |
1116 | 'pre' => nil, |
|
1119 | 'pre' => nil, | |
1117 | 'kbd' => nil, |
|
1120 | 'kbd' => nil, | |
1118 | 'code' => ['lang'], |
|
1121 | 'code' => ['lang'], | |
1119 | 'cite' => nil, |
|
1122 | 'cite' => nil, | |
1120 | 'strong' => nil, |
|
1123 | 'strong' => nil, | |
1121 | 'em' => nil, |
|
1124 | 'em' => nil, | |
1122 | 'ins' => nil, |
|
1125 | 'ins' => nil, | |
1123 | 'sup' => nil, |
|
1126 | 'sup' => nil, | |
1124 | 'sub' => nil, |
|
1127 | 'sub' => nil, | |
1125 | 'del' => nil, |
|
1128 | 'del' => nil, | |
1126 | 'table' => nil, |
|
1129 | 'table' => nil, | |
1127 | 'tr' => nil, |
|
1130 | 'tr' => nil, | |
1128 | 'td' => ['colspan', 'rowspan'], |
|
1131 | 'td' => ['colspan', 'rowspan'], | |
1129 | 'th' => nil, |
|
1132 | 'th' => nil, | |
1130 | 'ol' => nil, |
|
1133 | 'ol' => nil, | |
1131 | 'ul' => nil, |
|
1134 | 'ul' => nil, | |
1132 | 'li' => nil, |
|
1135 | 'li' => nil, | |
1133 | 'p' => nil, |
|
1136 | 'p' => nil, | |
1134 | 'h1' => nil, |
|
1137 | 'h1' => nil, | |
1135 | 'h2' => nil, |
|
1138 | 'h2' => nil, | |
1136 | 'h3' => nil, |
|
1139 | 'h3' => nil, | |
1137 | 'h4' => nil, |
|
1140 | 'h4' => nil, | |
1138 | 'h5' => nil, |
|
1141 | 'h5' => nil, | |
1139 | 'h6' => nil, |
|
1142 | 'h6' => nil, | |
1140 | 'blockquote' => ['cite'] |
|
1143 | 'blockquote' => ['cite'] | |
1141 | } |
|
1144 | } | |
1142 |
|
1145 | |||
1143 | def clean_html( text, tags = BASIC_TAGS ) |
|
1146 | def clean_html( text, tags = BASIC_TAGS ) | |
1144 | text.gsub!( /<!\[CDATA\[/, '' ) |
|
1147 | text.gsub!( /<!\[CDATA\[/, '' ) | |
1145 | text.gsub!( /<(\/*)(\w+)([^>]*)>/ ) do |
|
1148 | text.gsub!( /<(\/*)(\w+)([^>]*)>/ ) do | |
1146 | raw = $~ |
|
1149 | raw = $~ | |
1147 | tag = raw[2].downcase |
|
1150 | tag = raw[2].downcase | |
1148 | if tags.has_key? tag |
|
1151 | if tags.has_key? tag | |
1149 | pcs = [tag] |
|
1152 | pcs = [tag] | |
1150 | tags[tag].each do |prop| |
|
1153 | tags[tag].each do |prop| | |
1151 | ['"', "'", ''].each do |q| |
|
1154 | ['"', "'", ''].each do |q| | |
1152 | q2 = ( q != '' ? q : '\s' ) |
|
1155 | q2 = ( q != '' ? q : '\s' ) | |
1153 | if raw[3] =~ /#{prop}\s*=\s*#{q}([^#{q2}]+)#{q}/i |
|
1156 | if raw[3] =~ /#{prop}\s*=\s*#{q}([^#{q2}]+)#{q}/i | |
1154 | attrv = $1 |
|
1157 | attrv = $1 | |
1155 | next if prop == 'src' and attrv =~ %r{^(?!http)\w+:} |
|
1158 | next if prop == 'src' and attrv =~ %r{^(?!http)\w+:} | |
1156 | pcs << "#{prop}=\"#{$1.gsub('"', '\\"')}\"" |
|
1159 | pcs << "#{prop}=\"#{$1.gsub('"', '\\"')}\"" | |
1157 | break |
|
1160 | break | |
1158 | end |
|
1161 | end | |
1159 | end |
|
1162 | end | |
1160 | end if tags[tag] |
|
1163 | end if tags[tag] | |
1161 | "<#{raw[1]}#{pcs.join " "}>" |
|
1164 | "<#{raw[1]}#{pcs.join " "}>" | |
1162 | else |
|
1165 | else | |
1163 | " " |
|
1166 | " " | |
1164 | end |
|
1167 | end | |
1165 | end |
|
1168 | end | |
1166 | end |
|
1169 | end | |
1167 |
|
1170 | |||
1168 | ALLOWED_TAGS = %w(redpre pre code notextile) |
|
1171 | ALLOWED_TAGS = %w(redpre pre code notextile) | |
1169 |
|
1172 | |||
1170 | def escape_html_tags(text) |
|
1173 | def escape_html_tags(text) | |
1171 | text.gsub!(%r{<(\/?([!\w]+)[^<>\n]*)(>?)}) {|m| ALLOWED_TAGS.include?($2) ? "<#{$1}#{$3}" : "<#{$1}#{'>' unless $3.blank?}" } |
|
1174 | text.gsub!(%r{<(\/?([!\w]+)[^<>\n]*)(>?)}) {|m| ALLOWED_TAGS.include?($2) ? "<#{$1}#{$3}" : "<#{$1}#{'>' unless $3.blank?}" } | |
1172 | end |
|
1175 | end | |
1173 | end |
|
1176 | end | |
1174 |
|
1177 |
General Comments 0
You need to be logged in to leave comments.
Login now