Defect #29247

Textile phrase modifiers break wiki macros

Added by Stephan Wenzel 3 months ago. Updated 3 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Text formatting
Target version:3.4.7
Resolution:Fixed Affected version:3.4.6

Description

redcloth.rb, Redmine's textile interpreter, has a long standing bug or "glitch". That glitch relates to using modifiers (bold, italic, underline, etc.) together with a macro.

*{{user(1)}}*

will not produce the desired result, namely a link to a user in bold face. Instead, it will produce a "}" in boldface like here: }

I propose the following fix to lib/redmine/wiki_formatting/textile/redcloth3.rb:

346c346,347
<     C_STYL = '(?:\{[^"}]+\})'
---
> #   C_STYL = '(?:\{[^"}]+\})' 
>     C_STYL = '(?:\{[^{][^"}]+\})' 

The proposed fix will catch double curly brackets and still apply styles (boldface, underline, italic, etc.)

29247.patch Magnifier - Added a test to Stephan Wenzel's patch (1.12 KB) Go MAEDA, 2018-07-19 02:48

Associated revisions

Revision 17450
Added by Go MAEDA 3 months ago

Fix: Textile phrase modifiers break wiki macros (#29247).

Patch by Stephan Wenzel.

Revision 17451
Added by Go MAEDA 3 months ago

Merged r17450 from trunk to 3.4-stable (#29247).

History

#1 Updated by Go MAEDA 3 months ago

  • File 29247.patchMagnifier added
  • Subject changed from Long standing bug in redcloth.rb and proposal for solution to Textile phrase modifiers break wiki macros
  • Status changed from New to Confirmed

Confirmed the issue in Textile mode. No problem in Markdown mode.

I added a test which can catch the issue to Stephan Wenzel's patch.

#2 Updated by Gregor Schmidt 3 months ago

Disclaimer: I don't know a lot about the inner workings of redcloth.

I can see, how the proposed change fixes the problem at hand. I assume it does not have negative side effects.

The C_STYLE var seems to be used to match css style expressions, e.g. p{background:red}. Red paragraph. After the change, expressions that start with { are no longer matched. This should not be a problem. As far as I can tell, { will never appear at the beginning of such an expression.

That being said, I don't see a reason, to reject the proposed change.

#3 Updated by Go MAEDA 3 months ago

  • Target version set to 3.4.7

Gregor, thank you for reviewing the patch. I am setting the target version to 3.4.7.

#4 Updated by Go MAEDA 3 months ago

  • Status changed from Confirmed to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed. Thank you for your contribution.

Also available in: Atom PDF