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

Also available in: Atom PDF