Project

General

Profile

Actions

Feature #20511

closed

Comments for Textile text formatting

Added by Julius Friedrich over 8 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Text formatting
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed

Description

Developing and maintaining a wiki page I often would like to add some hidden commentary which does not show in formatted view.

I think there is no way to do this at the moment. Code for Textile Comments is filtered and does not work.
 

Disfunctional Textile examples:

comment block

multi-line comment block

commented out block

 

I know there is a plugin for this. I hope it will be made a core functionality soon. Cheers!


Files

20511.patch (2.75 KB) 20511.patch Go MAEDA, 2022-03-11 06:05

Related issues

Related to Redmine - Feature #6269: RedCloth 4 supportNew

Actions
Related to Redmine - Feature #3564: Invisible commentsClosed2009-06-30

Actions
Related to Redmine - Defect #1160: HMTL-TagsClosed2008-05-01

Actions
Actions #1

Updated by Serg Astra over 7 years ago

+1

Actions #2

Updated by Joel SCHAAL about 7 years ago

I stumbled across the same issue today, and wondered what I was doing wrong.
This marks Textile as not fully supported by Redmine for me (contrarily to what is written here: Wiki formatting > Text formatting).

Is Textile going to be abandoned in favor of Markdown ? I guess this issue would then be obsolete...

Actions #3

Updated by David Lukas Müller about 3 years ago

+1

Actions #4

Updated by Go MAEDA about 3 years ago

Actions #5

Updated by Go MAEDA about 3 years ago

Actions #6

Updated by Go MAEDA about 2 years ago

+1
CommonMark Markdown (#32424) that is going to be introduced in Redmine 5.0.0 supports HTML comments. I think it would be nice if Textile supports HTML comments as well.

The following code adds HTML comments support to the Textile formatter.

diff --git a/lib/redmine/wiki_formatting/textile/redcloth3.rb b/lib/redmine/wiki_formatting/textile/redcloth3.rb
index 2816e1c90..274f9cef8 100644
--- a/lib/redmine/wiki_formatting/textile/redcloth3.rb
+++ b/lib/redmine/wiki_formatting/textile/redcloth3.rb
@@ -298,6 +298,7 @@ class RedCloth3 < String
         @pre_list = []
         rip_offtags text
         no_textile text
+        clean_html_comment text
         escape_html_tags text
         # need to do this before #hard_break and #blocks
         block_textile_quotes text unless @lite_mode
@@ -1217,4 +1218,8 @@ class RedCloth3 < String
             end
         end
     end
+
+    def clean_html_comment(text)
+        text.gsub!(/^<!--[\s\S]*?-->$/, '')
+    end
 end
Actions #7

Updated by Go MAEDA almost 2 years ago

Actions #8

Updated by Go MAEDA almost 2 years ago

Here is a patch.

HTML comments in Textile are escaped since r1403. This patch may appear to roll back that change, but I think it is not a problem. This is because the purpose of the change is to prevent mistakenly entered unclosed comments from affecting page rendering (see #1160) and unclosed comments are still escaped even after applying the patch. It is ensured by the test source:trunk/test/helpers/application_helper_test.rb@21440#L1304.

Actions #9

Updated by Go MAEDA almost 2 years ago

  • Target version changed from Candidate for next major release to 5.0.0

Setting the target version to 5.0.0.

Actions #10

Updated by Go MAEDA almost 2 years ago

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

Committed the patch.

Actions

Also available in: Atom PDF