Redmine 4.1.1
This commit is contained in:
parent
33e7b881a5
commit
3d976f1b3b
1593 changed files with 36180 additions and 19489 deletions
|
@ -1,5 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2019 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
|
||||
|
@ -52,24 +54,16 @@ module Redmine
|
|||
end
|
||||
|
||||
class Formatter
|
||||
include Redmine::WikiFormatting::LinksHelper
|
||||
alias :inline_restore_redmine_links :restore_redmine_links
|
||||
|
||||
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):"(.+?)"/) 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 = inline_restore_redmine_links(html)
|
||||
html
|
||||
end
|
||||
|
||||
|
@ -89,14 +83,14 @@ module Redmine
|
|||
end
|
||||
|
||||
def extract_sections(index)
|
||||
sections = ['', '', '']
|
||||
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,}|`{3,})(\S+)?\s*$/
|
||||
if part =~ /\A(~{3,}|`{3,})(\s*\S+)?\s*$/
|
||||
if !inside_pre
|
||||
inside_pre = true
|
||||
elsif !$2
|
||||
|
@ -141,7 +135,8 @@ module Redmine
|
|||
:superscript => true,
|
||||
:no_intra_emphasis => true,
|
||||
:footnotes => true,
|
||||
:lax_spacing => true
|
||||
:lax_spacing => true,
|
||||
:underline => true
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue