Project

General

Profile

Actions

Defect #33432

open

Rendering of Macros with (empty) text parameter different in preview and non preview mode

Added by Holger Mößinger almost 4 years ago. Updated almost 4 years ago.

Status:
Confirmed
Priority:
Normal
Assignee:
-
Category:
Text formatting
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

Macros with empty text parameter are rendered differently in preview mode vs. non preview mode.

The preview mode seems to parse the the closing double curly brackets as text parameter and does not stop until the next macros double curly brackets, while the non preview mode parses an empty text parameter.

The sample code below shows demonstrates this with the collapse macro, but it happens for any macro which allows a text parameter and the two attached images.

This might be an issue with a greedy regular expression.

Test code for the bug in Redmine 4.x

{{collapse(Collapse 1)}}

Above is a empty collapse macro which renders correctly in preview and in wiki view.

{{collapse(Collapse 2)
}}

Above is a empty collapse macro which renders correctly in wiki view but this text (and the following macro up to its closing curly brackets) will not be visible in preview mode.

{{collapse(Collapse 3)
This is a block of text that is collapsed by default.
It can be expanded by clicking a link.
}}

Above is a non empty collapse macro which renders correctly in preview and in wiki view.

Test code for the bug in Redmine 4.x

Collapse 1

Above is a empty collapse macro which renders correctly in preview and in wiki view.

Collapse 2

Above is a empty collapse macro which renders correctly in wiki view but this text (and the following macro up to its closing curly brackets) will not be visible in preview mode.

Collapse 3

Above is a non empty collapse macro witch renders correctly in preview and in wiki view.


Environment:
Redmine version 4.1.1.stable
Ruby version 2.6.6-p146 (2020-03-31) [x86_64-linux]
Rails version 5.2.4.2
Environment production
Database adapter PostgreSQL
Mailer queue ActiveJob::QueueAdapters::AsyncAdapter
Mailer delivery smtp
SCM:
Subversion 1.10.4
Git 2.20.1
Filesystem
Xitolite 2.20.1
Redmine plugins:
additionals 2.0.24-master
redmine_advancedimage 0.0.4
redmine_agile 1.5.3
redmine_checklists 3.1.16
redmine_filelinks 0.0.0
redmine_git_hosting 4.0.2
redmine_latex_mathjax 0.4.0
redmine_lightbox2 0.5.1
redmine_local_avatars 1.0.0
redmine_mentions 1.0.0
redmine_postgresql_search 1.0.6
redmine_recurring_tasks 0.3.4
redmine_reporting 2.0.6
redmine_wiki_lists 0.0.9
redmine_wikiapproval 0.0.0
redmine_wikiforms 0.0.0
redmineup_tags 2.0.8
sidebar_hide 0.0.8-fix


Files

Redmine 4.x preview render.PNG (26.4 KB) Redmine 4.x preview render.PNG Holger Mößinger, 2020-05-11 13:50
Redmine 4.x wiki render.PNG (27.6 KB) Redmine 4.x wiki render.PNG Holger Mößinger, 2020-05-11 13:50
33432.patch (785 Bytes) 33432.patch Yuichi HARADA, 2020-05-21 04:58
33432-v2.patch (700 Bytes) 33432-v2.patch Yuichi HARADA, 2020-05-26 02:36
33432-test.patch (735 Bytes) 33432-test.patch Go MAEDA, 2020-06-06 08:31
Actions

Also available in: Atom PDF