summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2024-08-20 02:13:21 +0000
committerGo MAEDA <maeda@farend.jp>2024-08-20 02:13:21 +0000
commit578360fdabcccea3510b6aadb6ed3a0a87d4e2d0 (patch)
tree901ac654a4554825d3ccf8a403a7f6112fa005f1 /lib
parent65597ec1cfca87f3f0667d6e2de21621e16e2cb0 (diff)
downloadredmine-578360fdabcccea3510b6aadb6ed3a0a87d4e2d0.tar.gz
redmine-578360fdabcccea3510b6aadb6ed3a0a87d4e2d0.zip
Add support for quoted arguments containing commas in wiki macros (#40014).
Patch by Yasu Saku (user:skys). git-svn-id: https://svn.redmine.org/redmine/trunk@22959 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/wiki_formatting/macros.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/redmine/wiki_formatting/macros.rb b/lib/redmine/wiki_formatting/macros.rb
index a6238ef1e..f2b8c297f 100644
--- a/lib/redmine/wiki_formatting/macros.rb
+++ b/lib/redmine/wiki_formatting/macros.rb
@@ -38,7 +38,10 @@ module Redmine
method_name = "macro_#{name}"
unless macro_options[:parse_args] == false
- args = args.split(',').map(&:strip)
+ # Split the arguments by commas, but only if the commas
+ # are not within double quotes
+ args = args.split(/\s*,\s*(?=(?:[^"]*"[^"]*")*[^"]*$)/)
+ .map {|i| i.gsub(/^"(.*)"$/, '\1').gsub('""', '"')}
end
begin
@@ -57,7 +60,7 @@ module Redmine
def extract_macro_options(args, *keys)
options = {}
while args.last.to_s.strip =~ %r{^(.+?)\=(.+)$} && keys.include?($1.downcase.to_sym)
- options[$1.downcase.to_sym] = $2
+ options[$1.downcase.to_sym] = $2.gsub(/^"(.*)"$/, '\1')
args.pop
end
return [args, options]