Project

General

Profile

Actions

Patch #40014

closed

Add support for quoted arguments containing commas in wiki macros

Patch #40014: Add support for quoted arguments containing commas in wiki macros

Added by Yasu Saku almost 3 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Text formatting
Target version:

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 1 (0 open — 1 closed)

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

Updated by Go MAEDA over 2 years ago Actions #1

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

Updated by Go MAEDA over 2 years ago Actions #2

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

Updated by Go MAEDA over 2 years ago Actions #3

  • 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.

Updated by Go MAEDA over 2 years ago Actions #4

  • 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.

Updated by Marius BĂLTEANU over 2 years ago Actions #5

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

Actions

Also available in: PDF Atom