From e92079cfe9c2ad89cf4c9f7d2ce146f4393cb9f4 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Thu, 25 Nov 2010 21:28:14 +0100 Subject: Add new option weechat.look.highlight_regex and function string_has_highlight_regex in plugin API (task #10321) --- doc/de/autogen/user/weechat_options.txt | 5 ++++ doc/en/autogen/user/weechat_options.txt | 5 ++++ doc/en/weechat_plugin_api.en.txt | 43 ++++++++++++++++++++++++++++++++ doc/fr/autogen/user/weechat_options.txt | 5 ++++ doc/fr/weechat_plugin_api.fr.txt | 44 +++++++++++++++++++++++++++++++++ doc/it/autogen/user/weechat_options.txt | 5 ++++ doc/it/weechat_plugin_api.it.txt | 44 +++++++++++++++++++++++++++++++++ 7 files changed, 151 insertions(+) (limited to 'doc') diff --git a/doc/de/autogen/user/weechat_options.txt b/doc/de/autogen/user/weechat_options.txt index 4a3b2dae5..3c0e6ebae 100644 --- a/doc/de/autogen/user/weechat_options.txt +++ b/doc/de/autogen/user/weechat_options.txt @@ -388,6 +388,11 @@ ** Typ: Zeichenkette ** Werte: beliebige Zeichenkette (Standardwert: `""`) +* *weechat.look.highlight_regex* +** Beschreibung: `regular expression used to check if a message has highlight or not, at least one match in string must be surrounded by word chars (alphanumeric, "-", "_" or "|"), regular expression is case sensitive, example: "FlashCode|flashy"` +** Typ: Zeichenkette +** Werte: beliebige Zeichenkette (Standardwert: `""`) + * *weechat.look.hline_char* ** Beschreibung: `Das angegebene Zeichen wird genutzt um damit die horizontalen Linien zu zeichnen. Hinweis: Ein leerer Wert bewirkt das ncurses eine durchgezogene Linie zeichnet. Dies kann aber bei einigen Terminals, in URL Sektionen, zu Fehlern führen.` ** Typ: Zeichenkette diff --git a/doc/en/autogen/user/weechat_options.txt b/doc/en/autogen/user/weechat_options.txt index 0586b4e9c..8779f96da 100644 --- a/doc/en/autogen/user/weechat_options.txt +++ b/doc/en/autogen/user/weechat_options.txt @@ -388,6 +388,11 @@ ** type: string ** values: any string (default value: `""`) +* *weechat.look.highlight_regex* +** description: `regular expression used to check if a message has highlight or not, at least one match in string must be surrounded by word chars (alphanumeric, "-", "_" or "|"), regular expression is case sensitive, example: "FlashCode|flashy"` +** type: string +** values: any string (default value: `""`) + * *weechat.look.hline_char* ** description: `char used to draw horizontal lines, note that empty value will draw a real line with ncurses, but may cause bugs with URL selection under some terminals` ** type: string diff --git a/doc/en/weechat_plugin_api.en.txt b/doc/en/weechat_plugin_api.en.txt index e1ccfb010..ce6ac9cdc 100644 --- a/doc/en/weechat_plugin_api.en.txt +++ b/doc/en/weechat_plugin_api.en.txt @@ -933,6 +933,49 @@ highlight = weechat.string_has_highlight(string, highlight_words) highlight = weechat.string_has_highlight("my test string", "test,word2") # 1 ---------------------------------------- +weechat_string_has_highlight_regex +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.4._ + +Check if a string has one or more highlights, using a regular expression. +For at least one match of regular expression on string, it must be surrounded +by word chars (alphanumeric character, "-", "_" or "|"). + +Prototype: + +[source,C] +---------------------------------------- +int weechat_string_has_highlight_regex (const char *string, const char *regex); +---------------------------------------- + +Arguments: + +* 'string': string +* 'regex': regular expression + +Return value: + +* 1 if string has one or more highlights, otherwise 0 + +C example: + +[source,C] +---------------------------------------- +int hl = weechat_string_has_highlight_regex ("my test string", "test|word2"); /* == 1 */ +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototype +highlight = weechat.string_has_highlight_regex(string, regex) + +# example +highlight = weechat.string_has_highlight_regex("my test string", "test|word2") # 1 +---------------------------------------- + weechat_string_mask_to_regex ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/fr/autogen/user/weechat_options.txt b/doc/fr/autogen/user/weechat_options.txt index c59046be5..a8e4053a2 100644 --- a/doc/fr/autogen/user/weechat_options.txt +++ b/doc/fr/autogen/user/weechat_options.txt @@ -388,6 +388,11 @@ ** type: chaîne ** valeurs: toute chaîne (valeur par défaut: `""`) +* *weechat.look.highlight_regex* +** description: `expression régulière utilisée pour vérifier si un message a un "highlight" ou non, au moins une correspondante dans la chaîne doit être entourée de caractères de mot (alpha-numérique, "-", "_" ou "|"), l'expression régulière est sensible à la casse, exemple: "FlashCode|flashy"` +** type: chaîne +** valeurs: toute chaîne (valeur par défaut: `""`) + * *weechat.look.hline_char* ** description: `caractère utilisé pour tracer les lignes horizontales, notez qu'une valeur vide tracera une vraie ligne avec ncurses, mais peut causer des problèmes d'affichage avec la sélection d'URL sous certains terminaux` ** type: chaîne diff --git a/doc/fr/weechat_plugin_api.fr.txt b/doc/fr/weechat_plugin_api.fr.txt index 26a9f4a7c..20fa51391 100644 --- a/doc/fr/weechat_plugin_api.fr.txt +++ b/doc/fr/weechat_plugin_api.fr.txt @@ -943,6 +943,50 @@ highlight = weechat.string_has_highlight(string, highlight_words) highlight = weechat.string_has_highlight("my test string", "test,word2") # 1 ---------------------------------------- +weechat_string_has_highlight_regex +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_Nouveau dans la version 0.3.4._ + +Vérifie si une chaîne a un ou plusieurs "highlights", en utilisant une +expression régulière. +Pour au moins une correspondance dans la chaîne, elle doit être entourée de +caractères de mot (caractère alpha-numérique, "-", "_" ou "|"). + +Prototype : + +[source,C] +---------------------------------------- +int weechat_string_has_highlight_regex (const char *string, const char *regex); +---------------------------------------- + +Paramètres : + +* 'string' : chaîne +* 'regex' : expression régulière + +Valeur de retour : + +* 1 si la chaîne a un ou plusieurs "highlights", sinon 0 + +Exemple en C : + +[source,C] +---------------------------------------- +int hl = weechat_string_has_highlight_regex ("my test string", "test|word2"); /* == 1 */ +---------------------------------------- + +Script (Python) : + +[source,python] +---------------------------------------- +# prototype +highlight = weechat.string_has_highlight_regex(string, regex) + +# exemple +highlight = weechat.string_has_highlight_regex("my test string", "test|word2") # 1 +---------------------------------------- + weechat_string_mask_to_regex ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/it/autogen/user/weechat_options.txt b/doc/it/autogen/user/weechat_options.txt index 23c15a29d..fe24bde36 100644 --- a/doc/it/autogen/user/weechat_options.txt +++ b/doc/it/autogen/user/weechat_options.txt @@ -388,6 +388,11 @@ ** tipo: stringa ** valori: qualsiasi stringa (valore predefinito: `""`) +* *weechat.look.highlight_regex* +** descrizione: `regular expression used to check if a message has highlight or not, at least one match in string must be surrounded by word chars (alphanumeric, "-", "_" or "|"), regular expression is case sensitive, example: "FlashCode|flashy"` +** tipo: stringa +** valori: qualsiasi stringa (valore predefinito: `""`) + * *weechat.look.hline_char* ** descrizione: `carattere utilizzato per disegnare le righe orizzontali; notare che un valore vuoto disegnerà una vera riga con ncurses, ma può causare errori con la selezione dell'URL in alcuni terminali` ** tipo: stringa diff --git a/doc/it/weechat_plugin_api.it.txt b/doc/it/weechat_plugin_api.it.txt index fdee54429..ef00a156f 100644 --- a/doc/it/weechat_plugin_api.it.txt +++ b/doc/it/weechat_plugin_api.it.txt @@ -954,6 +954,50 @@ highlight = weechat.string_has_highlight(string, highlight_words) highlight = weechat.string_has_highlight("my test string", "test,word2") # 1 ---------------------------------------- +// TRANSLATION MISSING +weechat_string_has_highlight_regex +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.4._ + +Check if a string has one or more highlights, using a regular expression. +For at least one match of regular expression on string, it must be surrounded +by word chars (alphanumeric character, "-", "_" or "|"). + +Prototype: + +[source,C] +---------------------------------------- +int weechat_string_has_highlight_regex (const char *string, const char *regex); +---------------------------------------- + +Arguments: + +* 'string': string +* 'regex': regular expression + +Return value: + +* 1 if string has one or more highlights, otherwise 0 + +C example: + +[source,C] +---------------------------------------- +int hl = weechat_string_has_highlight_regex ("my test string", "test|word2"); /* == 1 */ +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototype +highlight = weechat.string_has_highlight_regex(string, regex) + +# example +highlight = weechat.string_has_highlight_regex("my test string", "test|word2") # 1 +---------------------------------------- + weechat_string_mask_to_regex ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- cgit v1.2.3