Redmine 3.4.4

This commit is contained in:
Manuel Cillero 2018-02-02 22:19:29 +01:00
commit 64924a6376
2112 changed files with 259028 additions and 0 deletions

View file

@ -0,0 +1,62 @@
# Redmine - project management software
# Copyright (C) 2006-2017 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require 'loofah/helpers'
module Redmine
module WikiFormatting
class HtmlParser
class_attribute :tags
self.tags = {
'br' => {:post => "\n"},
'style' => ''
}
def self.to_text(html)
html = html.gsub(/[\n\r]/, '').squeeze(' ')
doc = Loofah.document(html)
doc.scrub!(WikiTags.new(tags))
doc.scrub!(:newline_block_elements)
Loofah::Helpers.remove_extraneous_whitespace(doc.text).strip
end
class WikiTags < ::Loofah::Scrubber
def initialize(tags_to_text)
@direction = :bottom_up
@tags_to_text = tags_to_text || {}
end
def scrub(node)
formatting = @tags_to_text[node.name]
case formatting
when Hash
node.add_next_sibling Nokogiri::XML::Text.new("#{formatting[:pre]}#{node.content}#{formatting[:post]}", node.document)
node.remove
when String
node.add_next_sibling Nokogiri::XML::Text.new(formatting, node.document)
node.remove
else
CONTINUE
end
end
end
end
end
end

View file

@ -0,0 +1,256 @@
# Redmine - project management software
# Copyright (C) 2006-2017 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module Redmine
module WikiFormatting
module Macros
module Definitions
# Returns true if +name+ is the name of an existing macro
def macro_exists?(name)
Redmine::WikiFormatting::Macros.available_macros.key?(name.to_sym)
end
def exec_macro(name, obj, args, text)
macro_options = Redmine::WikiFormatting::Macros.available_macros[name.to_sym]
return unless macro_options
method_name = "macro_#{name}"
unless macro_options[:parse_args] == false
args = args.split(',').map(&:strip)
end
begin
if self.class.instance_method(method_name).arity == 3
send(method_name, obj, args, text)
elsif text
raise "This macro does not accept a block of text"
else
send(method_name, obj, args)
end
rescue => e
"<div class=\"flash error\">Error executing the <strong>#{h name}</strong> macro (#{h e.to_s})</div>".html_safe
end
end
def extract_macro_options(args, *keys)
options = {}
while args.last.to_s.strip =~ %r{^(.+?)\=(.+)$} && keys.include?($1.downcase.to_sym)
options[$1.downcase.to_sym] = $2
args.pop
end
return [args, options]
end
end
@@available_macros = {}
mattr_accessor :available_macros
class << self
# Plugins can use this method to define new macros:
#
# Redmine::WikiFormatting::Macros.register do
# desc "This is my macro"
# macro :my_macro do |obj, args|
# "My macro output"
# end
#
# desc "This is my macro that accepts a block of text"
# macro :my_macro do |obj, args, text|
# "My macro output"
# end
# end
def register(&block)
class_eval(&block) if block_given?
end
# Defines a new macro with the given name, options and block.
#
# Options:
# * :desc - A description of the macro
# * :parse_args => false - Disables arguments parsing (the whole arguments
# string is passed to the macro)
#
# Macro blocks accept 2 or 3 arguments:
# * obj: the object that is rendered (eg. an Issue, a WikiContent...)
# * args: macro arguments
# * text: the block of text given to the macro (should be present only if the
# macro accepts a block of text). text is a String or nil if the macro is
# invoked without a block of text.
#
# Examples:
# By default, when the macro is invoked, the comma separated list of arguments
# is split and passed to the macro block as an array. If no argument is given
# the macro will be invoked with an empty array:
#
# macro :my_macro do |obj, args|
# # args is an array
# # and this macro do not accept a block of text
# end
#
# You can disable arguments spliting with the :parse_args => false option. In
# this case, the full string of arguments is passed to the macro:
#
# macro :my_macro, :parse_args => false do |obj, args|
# # args is a string
# end
#
# Macro can optionally accept a block of text:
#
# macro :my_macro do |obj, args, text|
# # this macro accepts a block of text
# end
#
# Macros are invoked in formatted text using double curly brackets. Arguments
# must be enclosed in parenthesis if any. A new line after the macro name or the
# arguments starts the block of text that will be passe to the macro (invoking
# a macro that do not accept a block of text with some text will fail).
# Examples:
#
# No arguments:
# {{my_macro}}
#
# With arguments:
# {{my_macro(arg1, arg2)}}
#
# With a block of text:
# {{my_macro
# multiple lines
# of text
# }}
#
# With arguments and a block of text
# {{my_macro(arg1, arg2)
# multiple lines
# of text
# }}
#
# If a block of text is given, the closing tag }} must be at the start of a new line.
def macro(name, options={}, &block)
options.assert_valid_keys(:desc, :parse_args)
unless name.to_s.match(/\A\w+\z/)
raise "Invalid macro name: #{name} (only 0-9, A-Z, a-z and _ characters are accepted)"
end
unless block_given?
raise "Can not create a macro without a block!"
end
name = name.to_s.downcase.to_sym
available_macros[name] = {:desc => @@desc || ''}.merge(options)
@@desc = nil
Definitions.send :define_method, "macro_#{name}", &block
end
# Sets description for the next macro to be defined
def desc(txt)
@@desc = txt
end
end
# Builtin macros
desc "Sample macro."
macro :hello_world do |obj, args, text|
h("Hello world! Object: #{obj.class.name}, " +
(args.empty? ? "Called with no argument" : "Arguments: #{args.join(', ')}") +
" and " + (text.present? ? "a #{text.size} bytes long block of text." : "no block of text.")
)
end
desc "Displays a list of all available macros, including description if available."
macro :macro_list do |obj, args|
out = ''.html_safe
@@available_macros.each do |macro, options|
out << content_tag('dt', content_tag('code', macro.to_s))
out << content_tag('dd', content_tag('pre', options[:desc]))
end
content_tag('dl', out)
end
desc "Displays a list of child pages. With no argument, it displays the child pages of the current wiki page. Examples:\n\n" +
"{{child_pages}} -- can be used from a wiki page only\n" +
"{{child_pages(depth=2)}} -- display 2 levels nesting only\n" +
"{{child_pages(Foo)}} -- lists all children of page Foo\n" +
"{{child_pages(Foo, parent=1)}} -- same as above with a link to page Foo"
macro :child_pages do |obj, args|
args, options = extract_macro_options(args, :parent, :depth)
options[:depth] = options[:depth].to_i if options[:depth].present?
page = nil
if args.size > 0
page = Wiki.find_page(args.first.to_s, :project => @project)
elsif obj.is_a?(WikiContent) || obj.is_a?(WikiContent::Version)
page = obj.page
else
raise 'With no argument, this macro can be called from wiki pages only.'
end
raise 'Page not found' if page.nil? || !User.current.allowed_to?(:view_wiki_pages, page.wiki.project)
pages = page.self_and_descendants(options[:depth]).group_by(&:parent_id)
render_page_hierarchy(pages, options[:parent] ? page.parent_id : page.id)
end
desc "Includes a wiki page. Examples:\n\n" +
"{{include(Foo)}}\n" +
"{{include(projectname:Foo)}} -- to include a page of a specific project wiki"
macro :include do |obj, args|
page = Wiki.find_page(args.first.to_s, :project => @project)
raise 'Page not found' if page.nil? || !User.current.allowed_to?(:view_wiki_pages, page.wiki.project)
@included_wiki_pages ||= []
raise 'Circular inclusion detected' if @included_wiki_pages.include?(page.id)
@included_wiki_pages << page.id
out = textilizable(page.content, :text, :attachments => page.attachments, :headings => false)
@included_wiki_pages.pop
out
end
desc "Inserts of collapsed block of text. Examples:\n\n" +
"{{collapse\nThis is a block of text that is collapsed by default.\nIt can be expanded by clicking a link.\n}}\n\n" +
"{{collapse(View details...)\nWith custom link text.\n}}"
macro :collapse do |obj, args, text|
html_id = "collapse-#{Redmine::Utils.random_hex(4)}"
show_label = args[0] || l(:button_show)
hide_label = args[1] || args[0] || l(:button_hide)
js = "$('##{html_id}-show, ##{html_id}-hide').toggle(); $('##{html_id}').fadeToggle(150);"
out = ''.html_safe
out << link_to_function(show_label, js, :id => "#{html_id}-show", :class => 'collapsible collapsed')
out << link_to_function(hide_label, js, :id => "#{html_id}-hide", :class => 'collapsible', :style => 'display:none;')
out << content_tag('div', textilizable(text, :object => obj, :headings => false), :id => html_id, :class => 'collapsed-text', :style => 'display:none;')
out
end
desc "Displays a clickable thumbnail of an attached image. Examples:\n\n" +
"{{thumbnail(image.png)}}\n" +
"{{thumbnail(image.png, size=300, title=Thumbnail)}} -- with custom title and size"
macro :thumbnail do |obj, args|
args, options = extract_macro_options(args, :size, :title)
filename = args.first
raise 'Filename required' unless filename.present?
size = options[:size]
raise 'Invalid size parameter' unless size.nil? || size.match(/^\d+$/)
size = size.to_i
size = nil unless size > 0
if obj && obj.respond_to?(:attachments) && attachment = Attachment.latest_attach(obj.attachments, filename)
title = options[:title] || attachment.title
thumbnail_url = url_for(:controller => 'attachments', :action => 'thumbnail', :id => attachment, :size => size, :only_path => @only_path)
image_url = url_for(:controller => 'attachments', :action => 'show', :id => attachment, :only_path => @only_path)
img = image_tag(thumbnail_url, :alt => attachment.filename)
link_to(img, image_url, :class => 'thumbnail', :title => title)
else
raise "Attachment #{filename} not found"
end
end
end
end
end

View file

@ -0,0 +1,151 @@
# Redmine - project management software
# Copyright (C) 2006-2017 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require 'cgi'
module Redmine
module WikiFormatting
module Markdown
class HTML < Redcarpet::Render::HTML
include ActionView::Helpers::TagHelper
include Redmine::Helpers::URL
def link(link, title, content)
return nil unless uri_with_safe_scheme?(link)
css = nil
unless link && link.starts_with?('/')
css = 'external'
end
content_tag('a', content.to_s.html_safe, :href => link, :title => title, :class => css)
end
def block_code(code, language)
if language.present? && Redmine::SyntaxHighlighting.language_supported?(language)
"<pre><code class=\"#{CGI.escapeHTML language} syntaxhl\">" +
Redmine::SyntaxHighlighting.highlight_by_language(code, language) +
"</code></pre>"
else
"<pre>" + CGI.escapeHTML(code) + "</pre>"
end
end
def image(link, title, alt_text)
return unless uri_with_safe_scheme?(link)
tag('img', :src => link, :alt => alt_text || "", :title => title)
end
end
class Formatter
def initialize(text)
@text = text
end
def to_html(*args)
html = formatter.render(@text)
# restore wiki links eg. [[Foo]]
html.gsub!(%r{\[<a href="(.*?)">(.*?)</a>\]}) do
"[[#{$2}]]"
end
# restore Redmine links with double-quotes, eg. version:"1.0"
html.gsub!(/(\w):&quot;(.+?)&quot;/) do
"#{$1}:\"#{$2}\""
end
# restore user links with @ in login name eg. [@jsmith@somenet.foo]
html.gsub!(%r{[@\A]<a href="mailto:(.*?)">(.*?)</a>}) do
"@#{$2}"
end
html
end
def get_section(index)
section = extract_sections(index)[1]
hash = Digest::MD5.hexdigest(section)
return section, hash
end
def update_section(index, update, hash=nil)
t = extract_sections(index)
if hash.present? && hash != Digest::MD5.hexdigest(t[1])
raise Redmine::WikiFormatting::StaleSectionError
end
t[1] = update unless t[1].blank?
t.reject(&:blank?).join "\n\n"
end
def extract_sections(index)
sections = ['', '', '']
offset = 0
i = 0
l = 1
inside_pre = false
@text.split(/(^(?:.+\r?\n\r?(?:\=+|\-+)|#+.+|~~~.*)\s*$)/).each do |part|
level = nil
if part =~ /\A~{3,}(\S+)?\s*$/
if $1
if !inside_pre
inside_pre = true
end
else
inside_pre = !inside_pre
end
elsif inside_pre
# nop
elsif part =~ /\A(#+).+/
level = $1.size
elsif part =~ /\A.+\r?\n\r?(\=+|\-+)\s*$/
level = $1.include?('=') ? 1 : 2
end
if level
i += 1
if offset == 0 && i == index
# entering the requested section
offset = 1
l = level
elsif offset == 1 && i > index && level <= l
# leaving the requested section
offset = 2
end
end
sections[offset] << part
end
sections.map(&:strip)
end
private
def formatter
@@formatter ||= Redcarpet::Markdown.new(
Redmine::WikiFormatting::Markdown::HTML.new(
:filter_html => true,
:hard_wrap => true
),
:autolink => true,
:fenced_code_blocks => true,
:space_after_headers => true,
:tables => true,
:strikethrough => true,
:superscript => true,
:no_intra_emphasis => true,
:footnotes => true
)
end
end
end
end
end

View file

@ -0,0 +1,47 @@
# Redmine - project management software
# Copyright (C) 2006-2017 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module Redmine
module WikiFormatting
module Markdown
module Helper
def wikitoolbar_for(field_id)
heads_for_wiki_formatter
url = "#{Redmine::Utils.relative_url_root}/help/#{current_language.to_s.downcase}/wiki_syntax_markdown.html"
javascript_tag("var wikiToolbar = new jsToolBar(document.getElementById('#{field_id}')); wikiToolbar.setHelpLink('#{escape_javascript url}'); wikiToolbar.draw();")
end
def initial_page_content(page)
"# #{@page.pretty_title}"
end
def heads_for_wiki_formatter
unless @heads_for_wiki_formatter_included
content_for :header_tags do
javascript_include_tag('jstoolbar/jstoolbar') +
javascript_include_tag('jstoolbar/markdown') +
javascript_include_tag("jstoolbar/lang/jstoolbar-#{current_language.to_s.downcase}") +
javascript_tag("var wikiImageMimeTypes = #{Redmine::MimeType.by_type('image').to_json};") +
stylesheet_link_tag('jstoolbar')
end
@heads_for_wiki_formatter_included = true
end
end
end
end
end
end

View file

@ -0,0 +1,39 @@
# Redmine - project management software
# Copyright (C) 2006-2017 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module Redmine
module WikiFormatting
module Markdown
class HtmlParser < Redmine::WikiFormatting::HtmlParser
self.tags = tags.merge(
'b' => {:pre => '**', :post => '**'},
'strong' => {:pre => '**', :post => '**'},
'i' => {:pre => '_', :post => '_'},
'em' => {:pre => '_', :post => '_'},
'strike' => {:pre => '~~', :post => '~~'},
'h1' => {:pre => "\n\n# ", :post => "\n\n"},
'h2' => {:pre => "\n\n## ", :post => "\n\n"},
'h3' => {:pre => "\n\n### ", :post => "\n\n"},
'h4' => {:pre => "\n\n#### ", :post => "\n\n"},
'h5' => {:pre => "\n\n##### ", :post => "\n\n"},
'h6' => {:pre => "\n\n###### ", :post => "\n\n"}
)
end
end
end
end

View file

@ -0,0 +1,140 @@
# Redmine - project management software
# Copyright (C) 2006-2017 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require File.expand_path('../redcloth3', __FILE__)
require 'digest/md5'
module Redmine
module WikiFormatting
module Textile
class Formatter < RedCloth3
include ActionView::Helpers::TagHelper
include Redmine::WikiFormatting::LinksHelper
alias :inline_auto_link :auto_link!
alias :inline_auto_mailto :auto_mailto!
# auto_link rule after textile rules so that it doesn't break !image_url! tags
RULES = [:textile, :block_markdown_rule, :inline_auto_link, :inline_auto_mailto]
def initialize(*args)
super
self.hard_breaks=true
self.no_span_caps=true
self.filter_styles=false
end
def to_html(*rules)
@toc = []
super(*RULES).to_s
end
def get_section(index)
section = extract_sections(index)[1]
hash = Digest::MD5.hexdigest(section)
return section, hash
end
def update_section(index, update, hash=nil)
t = extract_sections(index)
if hash.present? && hash != Digest::MD5.hexdigest(t[1])
raise Redmine::WikiFormatting::StaleSectionError
end
t[1] = update unless t[1].blank?
t.reject(&:blank?).join "\n\n"
end
def extract_sections(index)
@pre_list = []
text = self.dup
rip_offtags text, false, false
before = ''
s = ''
after = ''
i = 0
l = 1
started = false
ended = false
text.scan(/(((?:.*?)(\A|\r?\n\s*\r?\n))(h(\d+)(#{A}#{C})\.(?::(\S+))?[ \t](.*?)$)|.*)/m).each do |all, content, lf, heading, level|
if heading.nil?
if ended
after << all
elsif started
s << all
else
before << all
end
break
end
i += 1
if ended
after << all
elsif i == index
l = level.to_i
before << content
s << heading
started = true
elsif i > index
s << content
if level.to_i > l
s << heading
else
after << heading
ended = true
end
else
before << all
end
end
sections = [before.strip, s.strip, after.strip]
sections.each {|section| smooth_offtags_without_code_highlighting section}
sections
end
private
# Patch for RedCloth. Fixed in RedCloth r128 but _why hasn't released it yet.
# <a href="http://code.whytheluckystiff.net/redcloth/changeset/128">http://code.whytheluckystiff.net/redcloth/changeset/128</a>
def hard_break( text )
text.gsub!( /(.)\n(?!\n|\Z| *([#*=]+(\s|$)|[{|]))/, "\\1<br />" ) if hard_breaks
end
alias :smooth_offtags_without_code_highlighting :smooth_offtags
# Patch to add code highlighting support to RedCloth
def smooth_offtags( text )
unless @pre_list.empty?
## replace <pre> content
text.gsub!(/<redpre#(\d+)>/) do
content = @pre_list[$1.to_i]
if content.match(/<code\s+class="(\w+)">\s?(.+)/m)
language = $1
text = $2
if Redmine::SyntaxHighlighting.language_supported?(language)
content = "<code class=\"#{language} syntaxhl\">" +
Redmine::SyntaxHighlighting.highlight_by_language(text, language)
else
content = "<code>#{ERB::Util.h(text)}"
end
end
content
end
end
end
end
end
end
end

View file

@ -0,0 +1,47 @@
# Redmine - project management software
# Copyright (C) 2006-2017 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module Redmine
module WikiFormatting
module Textile
module Helper
def wikitoolbar_for(field_id)
heads_for_wiki_formatter
# Is there a simple way to link to a public resource?
url = "#{Redmine::Utils.relative_url_root}/help/#{current_language.to_s.downcase}/wiki_syntax_textile.html"
javascript_tag("var wikiToolbar = new jsToolBar(document.getElementById('#{field_id}')); wikiToolbar.setHelpLink('#{escape_javascript url}'); wikiToolbar.draw();")
end
def initial_page_content(page)
"h1. #{@page.pretty_title}"
end
def heads_for_wiki_formatter
unless @heads_for_wiki_formatter_included
content_for :header_tags do
javascript_include_tag('jstoolbar/jstoolbar-textile.min') +
javascript_include_tag("jstoolbar/lang/jstoolbar-#{current_language.to_s.downcase}") +
javascript_tag("var wikiImageMimeTypes = #{Redmine::MimeType.by_type('image').to_json};") +
stylesheet_link_tag('jstoolbar')
end
@heads_for_wiki_formatter_included = true
end
end
end
end
end
end

View file

@ -0,0 +1,40 @@
# Redmine - project management software
# Copyright (C) 2006-2017 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module Redmine
module WikiFormatting
module Textile
class HtmlParser < Redmine::WikiFormatting::HtmlParser
self.tags = tags.merge(
'b' => {:pre => '*', :post => '*'},
'strong' => {:pre => '*', :post => '*'},
'i' => {:pre => '_', :post => '_'},
'em' => {:pre => '_', :post => '_'},
'u' => {:pre => '+', :post => '+'},
'strike' => {:pre => '-', :post => '-'},
'h1' => {:pre => "\n\nh1. ", :post => "\n\n"},
'h2' => {:pre => "\n\nh2. ", :post => "\n\n"},
'h3' => {:pre => "\n\nh3. ", :post => "\n\n"},
'h4' => {:pre => "\n\nh4. ", :post => "\n\n"},
'h5' => {:pre => "\n\nh5. ", :post => "\n\n"},
'h6' => {:pre => "\n\nh6. ", :post => "\n\n"}
)
end
end
end
end

File diff suppressed because it is too large Load diff