Project

General

Profile

Actions

Defect #9377

open

<br /> is not inserted before macro in Wiki

Added by Masamitsu Murase over 12 years ago. Updated over 12 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Text formatting
Target version:
-
Start date:
2011-10-05
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

<br /> tag is not inserted before macros in Wiki.

For example,

abc
!{{hello_world}}

should be converted to
<p>abc<br />Hello world! Object: Journal, Called with no argument.</p>

However, it is converted to

<p>abc
Hello world! Object: Journal, Called with no argument.</p>

Detail and cause:
<br /> in Wiki is inserted by hard_break method in "lib/redmine/wiki_formatting/textile/formatter.rb".
This method replaces "\n" with "<br />" as follows:

          text.gsub!( /(.)\n(?!\n|\Z| *([#*=]+(\s|$)|[{|]))/, "\\1<br />" ) if hard_breaks

It seems that "[{|]" prevents insertion of "<br />" before CSS style and in table, because CSS style in Wiki starts with "{" and cells of table are separated by "|".
Macros in Wiki also start with double "{"s, so "<br />" is not inserted before macros.
I think that hard_break method should be

          text.gsub!( /(.)\n(?!\n|\Z| *([#*=]+(\s|$)|\{[^{]|\|))/, "\\1<br />" ) if hard_breaks

to replace "\n" before macros.

Environment:
  • Redmine version 1.2.1
  • Ruby version 1.8.7 (patch 174)
  • Rails version 2.3.5

Files

wiki_br_insertion_patch.diff (808 Bytes) wiki_br_insertion_patch.diff A patch to solve this issue. Masamitsu Murase, 2011-10-06 18:47
Actions #1

Updated by Masamitsu Murase over 12 years ago

I sent pull request in GitHub.
Please refer to https://github.com/edavis10/redmine/pull/44.

Actions #2

Updated by Mischa The Evil over 12 years ago

  • Category set to Text formatting
Actions #3

Updated by Etienne Massip over 12 years ago

Please post the patch here.

Actions #4

Updated by Masamitsu Murase over 12 years ago

I post the patch.

I have already sent a pull request in GitHub.
If it confuses Redmine's contributors, please let me know about what to do.

Actions #5

Updated by Etienne Massip over 12 years ago

Masamitsu Murase wrote:

If it confuses Redmine's contributors, please let me know about what to do.

It does, because GitHub repo is not an official one (check Contribute) and can potentially differ from the original source.

I think that Eric keep it up to date, though, but this may be not true.

Actions #6

Updated by Masamitsu Murase over 12 years ago

Thank you for your reply, Etienne Massip.

I close the pull request in GitHub to avoid confusion.

Actions

Also available in: Atom PDF