1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-27 13:26:38 +02:00

trigger: add support of variable in regex option

Examples with new format:
  /regex/text/
  /regex/text/var
  /regex1/text1/ /regex2/text2/
  /regex1/text1/var /regex2/text2/var
This commit is contained in:
Sebastien Helleu
2014-01-26 19:59:55 +01:00
parent bcff9162a7
commit be8e32dd1b
5 changed files with 196 additions and 158 deletions
+10 -4
View File
@@ -102,13 +102,19 @@ trigger_command_trigger (void *data, struct t_gui_buffer *buffer, int argc,
for (i = 0; i < ptr_trigger->regex_count; i++)
{
weechat_printf_tags (NULL, "no_trigger",
" regex %d: %s%s %s-->%s %s",
" regex %d%s%s%s: "
"%s\"%s%s%s\" --> \"%s%s%s\"",
i + 1,
(ptr_trigger->regex[i].variable) ? " (" : "",
(ptr_trigger->regex[i].variable) ? ptr_trigger->regex[i].variable : "",
(ptr_trigger->regex[i].variable) ? ")" : "",
weechat_color ("chat_delimiters"),
weechat_color (weechat_config_string (trigger_config_color_regex)),
ptr_trigger->regex[i].str_regex,
weechat_color ("chat_delimiters"),
weechat_color (weechat_config_string (trigger_config_color_replace)),
ptr_trigger->regex[i].replace);
ptr_trigger->regex[i].replace,
weechat_color ("chat_delimiters"));
}
option = weechat_config_string (ptr_trigger->options[TRIGGER_OPTION_COMMAND]);
if (option && option[0])
@@ -408,8 +414,8 @@ trigger_command_init ()
" add text attributes in *bold*, _underline_ and /italic/:\n"
" /trigger add effects modifier weechat_print\n"
" /trigger set effects regex "
"==\\*(\\S+)\\*==*${color:bold}\\1${color:-bold}*"
"==_(\\S+)_==_${color:underline}\\1${color:-underline}_"
"==\\*(\\S+)\\*==*${color:bold}\\1${color:-bold}*== "
"==_(\\S+)_==_${color:underline}\\1${color:-underline}_== "
"==/(\\S+)/==/${color:italic}\\1${color:-italic}/"),
"list"
" || add %(trigger_names) %(trigger_hooks)"