Project

General

Profile

Actions

Patch #40014

closed

Add support for quoted arguments containing commas in wiki macros

Added by Yasu Saku 11 months ago. Updated 3 months ago.

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

0%

Estimated time:

Description

Please consider supporting comma in Wiki macro.

I have considered using double quotes and I'm attaching a patch.
This patch supports the following two additional features.
1. Double quotes can be escaped by placing two consecutive double quotes.
2. Support for enclosing values in double quotes in key/value pair arguments.

For example:

args = 'a,    "b, bbb,  b", cc c, """d, ""d""", "e" , hh,  , "", """", jj=jj, kk="kk, k", "ll=l,ll"'
args = args.split(/\s*,\s*(?=(?:[^"]*"[^"]*")*[^"]*$)/).map{|i| i.gsub(/^"(.*)"$/, '\1').gsub('""', '"')}

# args:
["a", "b, bbb,  b", "cc c", "\"d, \"d\"", "e", "hh", "", "", "\"", "jj=jj", "kk=\"kk, k\"", "ll=l,ll"]


Files

support-comma-with-double-quotes.patch (934 Bytes) support-comma-with-double-quotes.patch Yasu Saku, 2024-01-08 05:51
40014-test.patch (845 Bytes) 40014-test.patch Go MAEDA, 2024-08-17 06:26

Related issues

Related to Redmine - Defect #41153: {{collapse(custom text)}} macro cuts off at first commaClosed

Actions
Actions #1

Updated by Go MAEDA 3 months ago

  • Related to Defect #41153: {{collapse(custom text)}} macro cuts off at first comma added
Actions #2

Updated by Go MAEDA 3 months ago

Thank you for posting the patch.
I wrote a test for this change.

Actions #3

Updated by Go MAEDA 3 months ago

  • Category changed from Wiki to Text formatting
  • Target version changed from Candidate for next major release to 6.0.0

Setting the target version to 6.0.0.

Actions #4

Updated by Go MAEDA 3 months ago

  • Subject changed from Comma support in Wiki macro with double quotes to Add support for quoted arguments containing commas in wiki macros
  • Status changed from New to Closed
  • Assignee set to Go MAEDA

Committed the patch with a test in r22959. Thank you for your contribution.

Actions #5

Updated by Marius BÄ‚LTEANU 3 months ago

What do you think if we merge this fix small improvement to stable branches?

Actions

Also available in: Atom PDF