Add utf8 support
Opened this issue · 7 comments
rominf commented
Plugin doesn't replace keyword (consisting of ASCII symbols) to utf-8 parameter (because of \w and \W in RegExps).
thegcat commented
I'm not sure I understand your problem, could you please provide an example?
rominf commented
When I use {{template(TEMPLATE_NAME,PARAM=Йогурт)}} where page with name TEMPLATE_NAME consist only text "PARAM" on result page I see only last character "т".
inpos commented
regex "\w" work only with latin symbols
Replace it with [[:word:]]
inpos commented
or [[:alnum:]]
inpos commented
Here is my diff
--- /root/setup/rm_plugins/redmine_wiki_template/init.rb 2016-02-26 19:51:49.376000000 +0300
+++ init.rb 2016-02-26 21:33:14.292000000 +0300
@@ -39,8 +39,8 @@
# parse key-value arguments
values = args.inject({}) do |values, arg|
- _, key, value = /(\w+)\W*\=\W*(.+)$/.match(arg).to_a
- values[key] = value.strip.gsub("<br />", "") if key && value
+ _, key, value = /([[:alnum:]]+)[^[:alnum:]]*\=(.+)$/.match(arg).to_a
+ values[key] = value.strip.gsub("<br />", "").gsub(",", ",") if key && value
values
end
inpos commented
This patch allow multi-word values.
Also it allow use "," in value to render commas