remove trailing white-spaces from lib/redmine/wiki_formatting.rb.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6948 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
11fdb710d5
commit
a57feec16c
@ -1,16 +1,16 @@
|
|||||||
# Redmine - project management software
|
# Redmine - project management software
|
||||||
# Copyright (C) 2006-2008 Jean-Philippe Lang
|
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or
|
# This program is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU General Public License
|
# modify it under the terms of the GNU General Public License
|
||||||
# as published by the Free Software Foundation; either version 2
|
# as published by the Free Software Foundation; either version 2
|
||||||
# of the License, or (at your option) any later version.
|
# of the License, or (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
@ -23,26 +23,26 @@ module Redmine
|
|||||||
def map
|
def map
|
||||||
yield self
|
yield self
|
||||||
end
|
end
|
||||||
|
|
||||||
def register(name, formatter, helper)
|
def register(name, formatter, helper)
|
||||||
raise ArgumentError, "format name '#{name}' is already taken" if @@formatters[name.to_s]
|
raise ArgumentError, "format name '#{name}' is already taken" if @@formatters[name.to_s]
|
||||||
@@formatters[name.to_s] = {:formatter => formatter, :helper => helper}
|
@@formatters[name.to_s] = {:formatter => formatter, :helper => helper}
|
||||||
end
|
end
|
||||||
|
|
||||||
def formatter_for(name)
|
def formatter_for(name)
|
||||||
entry = @@formatters[name.to_s]
|
entry = @@formatters[name.to_s]
|
||||||
(entry && entry[:formatter]) || Redmine::WikiFormatting::NullFormatter::Formatter
|
(entry && entry[:formatter]) || Redmine::WikiFormatting::NullFormatter::Formatter
|
||||||
end
|
end
|
||||||
|
|
||||||
def helper_for(name)
|
def helper_for(name)
|
||||||
entry = @@formatters[name.to_s]
|
entry = @@formatters[name.to_s]
|
||||||
(entry && entry[:helper]) || Redmine::WikiFormatting::NullFormatter::Helper
|
(entry && entry[:helper]) || Redmine::WikiFormatting::NullFormatter::Helper
|
||||||
end
|
end
|
||||||
|
|
||||||
def format_names
|
def format_names
|
||||||
@@formatters.keys.map
|
@@formatters.keys.map
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_html(format, text, options = {}, &block)
|
def to_html(format, text, options = {}, &block)
|
||||||
text = if Setting.cache_formatted_text? && text.size > 2.kilobyte && cache_store && cache_key = cache_key_for(format, options[:object], options[:attribute])
|
text = if Setting.cache_formatted_text? && text.size > 2.kilobyte && cache_store && cache_key = cache_key_for(format, options[:object], options[:attribute])
|
||||||
# Text retrieved from the cache store may be frozen
|
# Text retrieved from the cache store may be frozen
|
||||||
@ -65,12 +65,12 @@ module Redmine
|
|||||||
"formatted_text/#{format}/#{object.class.model_name.cache_key}/#{object.id}-#{attribute}-#{object.updated_on.to_s(:number)}"
|
"formatted_text/#{format}/#{object.class.model_name.cache_key}/#{object.id}-#{attribute}-#{object.updated_on.to_s(:number)}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns the cache store used to cache HTML output
|
# Returns the cache store used to cache HTML output
|
||||||
def cache_store
|
def cache_store
|
||||||
ActionController::Base.cache_store
|
ActionController::Base.cache_store
|
||||||
end
|
end
|
||||||
|
|
||||||
MACROS_RE = /
|
MACROS_RE = /
|
||||||
(!)? # escaping
|
(!)? # escaping
|
||||||
(
|
(
|
||||||
@ -80,7 +80,7 @@ module Redmine
|
|||||||
\}\} # closing tag
|
\}\} # closing tag
|
||||||
)
|
)
|
||||||
/x unless const_defined?(:MACROS_RE)
|
/x unless const_defined?(:MACROS_RE)
|
||||||
|
|
||||||
# Macros substitution
|
# Macros substitution
|
||||||
def execute_macros(text, macros_runner)
|
def execute_macros(text, macros_runner)
|
||||||
text.gsub!(MACROS_RE) do
|
text.gsub!(MACROS_RE) do
|
||||||
@ -98,30 +98,30 @@ module Redmine
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Default formatter module
|
# Default formatter module
|
||||||
module NullFormatter
|
module NullFormatter
|
||||||
class Formatter
|
class Formatter
|
||||||
include ActionView::Helpers::TagHelper
|
include ActionView::Helpers::TagHelper
|
||||||
include ActionView::Helpers::TextHelper
|
include ActionView::Helpers::TextHelper
|
||||||
include ActionView::Helpers::UrlHelper
|
include ActionView::Helpers::UrlHelper
|
||||||
|
|
||||||
def initialize(text)
|
def initialize(text)
|
||||||
@text = text
|
@text = text
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_html(*args)
|
def to_html(*args)
|
||||||
simple_format(auto_link(CGI::escapeHTML(@text)))
|
simple_format(auto_link(CGI::escapeHTML(@text)))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module Helper
|
module Helper
|
||||||
def wikitoolbar_for(field_id)
|
def wikitoolbar_for(field_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def heads_for_wiki_formatter
|
def heads_for_wiki_formatter
|
||||||
end
|
end
|
||||||
|
|
||||||
def initial_page_content(page)
|
def initial_page_content(page)
|
||||||
page.pretty_title.to_s
|
page.pretty_title.to_s
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user