doc: fix styles in scripting guide (issue #722)
parent
048ad82672
commit
c5c7539406
|
@ -50,7 +50,7 @@ Allerdings ist die API für alle Skriptsprachen nahezu identisch.
|
|||
|
||||
* WeeChat muss als Modul eingebunden werden: `import weechat`
|
||||
* Um die WeeChat Funktion `print*` nutzen zu können muss `prnt*` genutzt
|
||||
werden ('print' ist ein reservierter Befehl von Python!)
|
||||
werden (_print_ ist ein reservierter Befehl von Python!)
|
||||
* Funktionen werden im Format `weechat.xxx(arg1, arg2, ...)` ausgeführt
|
||||
|
||||
==== Perl
|
||||
|
@ -59,7 +59,7 @@ Allerdings ist die API für alle Skriptsprachen nahezu identisch.
|
|||
|
||||
==== Ruby
|
||||
|
||||
* Es muss 'weechat_init' definiert und darin die Funktion 'register' ausgeführt werden
|
||||
* Es muss _weechat_init_ definiert und darin die Funktion _register_ ausgeführt werden
|
||||
* Funktionen werden im Format `Weechat.xxx(arg1, arg2, ...)` ausgeführt
|
||||
* Aufgrund einer Limitierung, seitens Ruby (maximal 15 Argumente pro Funktion), empfängt
|
||||
die Funktion `Weechat.config_new_option` den Callback in einem Array von 6 Strings
|
||||
|
@ -108,14 +108,14 @@ weechat.register(Name, Author, Version, Lizenz, Beschreibung, Shutdown_Funktion,
|
|||
|
||||
Argumente:
|
||||
|
||||
* 'name': interner Name des Skripts (String)
|
||||
* 'author': Name des Authors (String)
|
||||
* 'version': Version des Skripts (String)
|
||||
* 'license': Lizenz für das Skripts (String)
|
||||
* 'description': kurze Beschreibung des Skripts (String)
|
||||
* 'shutdown_function': Name der Funktion die beim Beenden des Skripts aufgerufen werden soll
|
||||
* _name_: interner Name des Skripts (String)
|
||||
* _author_: Name des Authors (String)
|
||||
* _version_: Version des Skripts (String)
|
||||
* _license_: Lizenz für das Skripts (String)
|
||||
* _description_: kurze Beschreibung des Skripts (String)
|
||||
* _shutdown_function_: Name der Funktion die beim Beenden des Skripts aufgerufen werden soll
|
||||
(String, kann auch eine leere Zeichenkette sein)
|
||||
* 'charset': Skript Zeichensatz (optional, liegt das Skript im UTF-8 Format vor kann dieser Wert
|
||||
* _charset_: Skript Zeichensatz (optional, liegt das Skript im UTF-8 Format vor kann dieser Wert
|
||||
leer bleiben. UTF-8 ist der Standardzeichensatz) (String)
|
||||
|
||||
Beispielskripten, für jede Sprache:
|
||||
|
@ -211,7 +211,7 @@ Skriptsprache, den entsprechenden Befehl zu nutzen:
|
|||
----
|
||||
|
||||
Um Skripten automatisch beim Start von WeeChat zu laden sollte man einen Link
|
||||
anlegen, der in das Verzeichnis 'Skriptsprache/autoload' zeigt.
|
||||
anlegen, der in das Verzeichnis _Skriptsprache/autoload_ zeigt.
|
||||
|
||||
Ein Beispiel für ein Python-Skript:
|
||||
|
||||
|
@ -222,7 +222,7 @@ $ ln -s ../script.py
|
|||
|
||||
[NOTE]
|
||||
Installiert man mittels `/script install` ein Skript, dann wird automatisch
|
||||
ein Link in das entsprechende 'autoload' Verzeichnis erzeugt.
|
||||
ein Link in das entsprechende _autoload_ Verzeichnis erzeugt.
|
||||
|
||||
[[differences_with_c_api]]
|
||||
== Unterschiede zur C API
|
||||
|
@ -230,13 +230,13 @@ ein Link in das entsprechende 'autoload' Verzeichnis erzeugt.
|
|||
Die Skripten API ist nahezu identisch mit der API der C Erweiterung.
|
||||
Um einen Überblick über alle API Funktionen (Prototyp, Argumente,
|
||||
Rückgabe werte, Beispiele) zu erhalten werfen Sie einen Blick in
|
||||
die 'WeeChat Plugin API Reference'.
|
||||
Es ist wichtig das man zwischen einer 'Erweiterung' und einem 'Skript'
|
||||
unterscheidet: Eine 'Erweiterung' ist eine Binärdatei die kompiliert wurde
|
||||
und mittels `/plugin` geladen wird. Ein 'Skript' ist eine Textdatei welche
|
||||
durch eine Erweiterung z.B. 'python' mittels dem Befehl `/python` geladen
|
||||
die _WeeChat Plugin API Reference_.
|
||||
Es ist wichtig das man zwischen einer _Erweiterung_ und einem _Skript_
|
||||
unterscheidet: Eine _Erweiterung_ ist eine Binärdatei die kompiliert wurde
|
||||
und mittels `/plugin` geladen wird. Ein _Skript_ ist eine Textdatei welche
|
||||
durch eine Erweiterung z.B. _python_ mittels dem Befehl `/python` geladen
|
||||
wird.
|
||||
Falls Ihr Skript 'test.py' eine WeeChat API Funktion aufruft wird der Aufruf
|
||||
Falls Ihr Skript _test.py_ eine WeeChat API Funktion aufruft wird der Aufruf
|
||||
wie folgt abgearbeitet:
|
||||
|
||||
....
|
||||
|
@ -247,7 +247,7 @@ test.py ─────► │ Skript API │ C API │ ─────► ║
|
|||
└────────────┴─────────┘ ╚═════════╧════════╝
|
||||
....
|
||||
|
||||
Gibt WeeChat einen Rückgabewert an Ihr Skript 'test.py' zurück, dann wird der
|
||||
Gibt WeeChat einen Rückgabewert an Ihr Skript _test.py_ zurück, dann wird der
|
||||
Aufruf in umgekehrter Reihenfolge abgearbeitet:
|
||||
|
||||
....
|
||||
|
@ -387,7 +387,7 @@ weechat.hook_timer(1000, 0, 1, "timer_cb", "test");
|
|||
== Skript API
|
||||
|
||||
Um weiterführende Informationen zu den API Funktionen zu erhalten
|
||||
lesen Sie bitte 'WeeChat Plugin API Reference'.
|
||||
lesen Sie bitte _WeeChat Plugin API Reference_.
|
||||
|
||||
[[script_api_functions]]
|
||||
=== Funktionen
|
||||
|
@ -516,7 +516,7 @@ Liste der Konstanten in Skript API:
|
|||
|
||||
Dieses Kapitel beinhaltet einige Aufgaben mit Lösungsbeispielen.
|
||||
Die Skript API wird dabei nur sehr oberflächlich besprochen.Um eine vollständige
|
||||
Übersicht aller Befehle zu erhalten nutzen Sie bitte die 'WeeChat Plugin API Reference'.
|
||||
Übersicht aller Befehle zu erhalten nutzen Sie bitte die _WeeChat Plugin API Reference_.
|
||||
|
||||
[[buffers]]
|
||||
=== Buffer
|
||||
|
@ -717,7 +717,7 @@ Mit der Funktion `hook_process` kann ein Hintergrundprozess gestartet werden.
|
|||
Der Callback wird aufgerufen sobald der Hintergrundprozess abgearbeitet wurde.
|
||||
Dies kann auch mehrfach der Fall sein.
|
||||
|
||||
Für den letzten Aufruf des Callback wird 'rc' auf 0 oder einen positiven Wert
|
||||
Für den letzten Aufruf des Callback wird _rc_ auf 0 oder einen positiven Wert
|
||||
gesetzt. Dies ist der Return Code des Befehls.
|
||||
|
||||
Beispiele:
|
||||
|
@ -770,7 +770,7 @@ weechat.hook_process("url:https://weechat.org/dev/info/stable/",
|
|||
Alle Informationen die WeeChat betreffen findet man auf: https://weechat.org/dev/info
|
||||
|
||||
Beispiel eines URL Transfers, mit zusätzliche Optionen: Es wird das neuste
|
||||
WeeChat Entwicklerpaket in die Datei '/tmp/weechat-devel.tar.gz' gesichert:
|
||||
WeeChat Entwicklerpaket in die Datei _/tmp/weechat-devel.tar.gz_ gesichert:
|
||||
|
||||
[source,python]
|
||||
----
|
||||
|
@ -947,7 +947,7 @@ Das Ergebnis ist eine Hashtabelle mit folgenden Schlüsseln
|
|||
`nick!user@host`
|
||||
|
||||
| command | ≥ 0.3.4 |
|
||||
der Befehl ('PRIVMSG', 'NOTICE', ...) |
|
||||
der Befehl (_PRIVMSG_, _NOTICE_, ...) |
|
||||
`PRIVMSG`
|
||||
|
||||
| channel | ≥ 0.3.4 |
|
||||
|
@ -963,19 +963,19 @@ Das Ergebnis ist eine Hashtabelle mit folgenden Schlüsseln
|
|||
`hello!`
|
||||
|
||||
| pos_command | ≥ 1.3 |
|
||||
Index von 'command' innerhalb einer Nachricht ("-1" falls 'command' nicht gefunden wird) |
|
||||
Index von _command_ innerhalb einer Nachricht ("-1" falls _command_ nicht gefunden wird) |
|
||||
`47`
|
||||
|
||||
| pos_arguments | ≥ 1.3 |
|
||||
Index von'arguments' innerhalb einer Nachricht ("-1" falls 'arguments' nicht gefunden wird) |
|
||||
Index von_arguments_ innerhalb einer Nachricht ("-1" falls _arguments_ nicht gefunden wird) |
|
||||
`55`
|
||||
|
||||
| pos_channel | ≥ 1.3 |
|
||||
Index von 'channel' innerhalb einer Nachricht ("-1" falls 'channel' nicht gefunden wird) |
|
||||
Index von _channel_ innerhalb einer Nachricht ("-1" falls _channel_ nicht gefunden wird) |
|
||||
`55`
|
||||
|
||||
| pos_text | ≥ 1.3 |
|
||||
Index von 'text' innerhalb einer Nachricht ("-1" falls 'text' nicht gefunden wird) |
|
||||
Index von _text_ innerhalb einer Nachricht ("-1" falls _text_ nicht gefunden wird) |
|
||||
`65`
|
||||
|===
|
||||
|
||||
|
@ -1023,7 +1023,7 @@ else:
|
|||
----
|
||||
|
||||
[NOTE]
|
||||
Versionen ≤ 0.3.1.1 geben einen leeren String zurück wenn man 'info_get("version_number")'
|
||||
Versionen ≤ 0.3.1.1 geben einen leeren String zurück wenn man _info_get("version_number")_
|
||||
aufruft. Deshalb müssen Sie prüfen ob der Rückgabewert *nicht* leer ist.
|
||||
|
||||
Um die Version als String zu erhalten:
|
||||
|
|
|
@ -43,7 +43,7 @@ other languages.
|
|||
==== Python
|
||||
|
||||
* You have to `import weechat`
|
||||
* Functions `print*` are called `prnt*` in python (because 'print' is reserved
|
||||
* Functions `print*` are called `prnt*` in python (because _print_ is reserved
|
||||
keyword)
|
||||
* Functions are called with `weechat.xxx(arg1, arg2, ...)`
|
||||
|
||||
|
@ -53,7 +53,7 @@ other languages.
|
|||
|
||||
==== Ruby
|
||||
|
||||
* You have to define 'weechat_init' and call 'register' inside
|
||||
* You have to define _weechat_init_ and call _register_ inside
|
||||
* Functions are called with `Weechat.xxx(arg1, arg2, ...)`
|
||||
* Due to a limitation of Ruby (15 arguments max by function), the function
|
||||
`Weechat.config_new_option` receives the callbacks in an array of 6 strings
|
||||
|
@ -102,14 +102,14 @@ weechat.register(name, author, version, license, description, shutdown_function,
|
|||
|
||||
Arguments:
|
||||
|
||||
* 'name': string, internal name of script
|
||||
* 'author': string, author name
|
||||
* 'version': string, script version
|
||||
* 'license': string, script license
|
||||
* 'description': string, short description of script
|
||||
* 'shutdown_function': string, name of function called when script is unloaded
|
||||
* _name_: string, internal name of script
|
||||
* _author_: string, author name
|
||||
* _version_: string, script version
|
||||
* _license_: string, script license
|
||||
* _description_: string, short description of script
|
||||
* _shutdown_function_: string, name of function called when script is unloaded
|
||||
(can be empty string)
|
||||
* 'charset': string, script charset (if your script is UTF-8, you can use blank
|
||||
* _charset_: string, script charset (if your script is UTF-8, you can use blank
|
||||
value here, because UTF-8 is default charset)
|
||||
|
||||
Example of script, for each language:
|
||||
|
@ -202,7 +202,7 @@ Each language has also its own command:
|
|||
/javascript load script.js
|
||||
----
|
||||
|
||||
You can make link in directory 'language/autoload' to autoload script when
|
||||
You can make link in directory _language/autoload_ to autoload script when
|
||||
WeeChat is starting.
|
||||
|
||||
For example with Python:
|
||||
|
@ -213,22 +213,22 @@ $ ln -s ../script.py
|
|||
----
|
||||
|
||||
[NOTE]
|
||||
When installing a script with command `/script install` the link in 'autoload'
|
||||
When installing a script with command `/script install` the link in _autoload_
|
||||
directory is automatically created.
|
||||
|
||||
[[differences_with_c_api]]
|
||||
== Differences with C API
|
||||
|
||||
Script API is almost the same as C plugin API.
|
||||
You can look at 'WeeChat Plugin API Reference' for detail about each function
|
||||
You can look at _WeeChat Plugin API Reference_ for detail about each function
|
||||
in API: prototype, arguments, return values, examples.
|
||||
|
||||
It's important to make difference between a 'plugin' and a 'script': a
|
||||
'plugin' is a binary file compiled and loaded with command `/plugin`, whereas
|
||||
a 'script' is a text file loaded with a plugin like 'python' with command
|
||||
It's important to make difference between a _plugin_ and a _script_: a
|
||||
_plugin_ is a binary file compiled and loaded with command `/plugin`, whereas
|
||||
a _script_ is a text file loaded with a plugin like _python_ with command
|
||||
`/python`.
|
||||
|
||||
When your script 'test.py' calls a WeeChat API function, path is like that:
|
||||
When your script _test.py_ calls a WeeChat API function, path is like that:
|
||||
|
||||
....
|
||||
┌──────────────────────┐ ╔══════════════════╗
|
||||
|
@ -238,7 +238,7 @@ test.py ─────► │ script API │ C API │ ─────► ║
|
|||
└────────────┴─────────┘ ╚═════════╧════════╝
|
||||
....
|
||||
|
||||
When WeeChat calls a callback in your script 'test.py', it's reverse of
|
||||
When WeeChat calls a callback in your script _test.py_, it's reverse of
|
||||
previous path:
|
||||
|
||||
....
|
||||
|
@ -374,7 +374,7 @@ weechat.hook_timer(1000, 0, 1, "timer_cb", "test");
|
|||
== Script API
|
||||
|
||||
For more information about functions in API, please read
|
||||
'WeeChat Plugin API Reference'.
|
||||
_WeeChat Plugin API Reference_.
|
||||
|
||||
[[script_api_functions]]
|
||||
=== Functions
|
||||
|
@ -503,7 +503,7 @@ List of constants in script API:
|
|||
|
||||
This chapter shows some common tasks, with examples.
|
||||
Only partial things in API are used here, for full reference, see
|
||||
'WeeChat Plugin API Reference'.
|
||||
_WeeChat Plugin API Reference_.
|
||||
|
||||
[[buffers]]
|
||||
=== Buffers
|
||||
|
@ -697,7 +697,7 @@ weechat.hook_timer(60 * 1000, 60, 0, "timer_cb", "")
|
|||
You can run a background process with `hook_process`. Your callback will be
|
||||
called when data is ready. It may be called many times.
|
||||
|
||||
For the last call to your callback, 'rc' is set to 0 or positive value, it's
|
||||
For the last call to your callback, _rc_ is set to 0 or positive value, it's
|
||||
return code of command.
|
||||
|
||||
Example:
|
||||
|
@ -749,7 +749,7 @@ weechat.hook_process("url:https://weechat.org/dev/info/stable/",
|
|||
All infos available about WeeChat are on page https://weechat.org/dev/info
|
||||
|
||||
Example of URL transfer with an option: download latest WeeChat development
|
||||
package in file '/tmp/weechat-devel.tar.gz':
|
||||
package in file _/tmp/weechat-devel.tar.gz_:
|
||||
|
||||
[source,python]
|
||||
----
|
||||
|
@ -764,7 +764,7 @@ weechat.hook_process_hashtable("url:https://weechat.org/files/src/weechat-devel.
|
|||
----
|
||||
|
||||
For more information about URL transfer and available options, see functions
|
||||
`hook_process` and `hook_process_hashtable` in 'WeeChat Plugin API Reference'.
|
||||
`hook_process` and `hook_process_hashtable` in _WeeChat Plugin API Reference_.
|
||||
|
||||
[[config_options]]
|
||||
=== Config / options
|
||||
|
@ -924,7 +924,7 @@ The result is a hashtable with following keys
|
|||
`nick!user@host`
|
||||
|
||||
| command | ≥ 0.3.4 |
|
||||
The command ('PRIVMSG', 'NOTICE', ...) |
|
||||
The command (_PRIVMSG_, _NOTICE_, ...) |
|
||||
`PRIVMSG`
|
||||
|
||||
| channel | ≥ 0.3.4 |
|
||||
|
@ -940,19 +940,19 @@ The result is a hashtable with following keys
|
|||
`hello!`
|
||||
|
||||
| pos_command | ≥ 1.3 |
|
||||
The index of 'command' in message ("-1" if 'command' was not found) |
|
||||
The index of _command_ in message ("-1" if _command_ was not found) |
|
||||
`47`
|
||||
|
||||
| pos_arguments | ≥ 1.3 |
|
||||
The index of 'arguments' in message ("-1" if 'arguments' was not found) |
|
||||
The index of _arguments_ in message ("-1" if _arguments_ was not found) |
|
||||
`55`
|
||||
|
||||
| pos_channel | ≥ 1.3 |
|
||||
The index of 'channel' in message ("-1" if 'channel' was not found) |
|
||||
The index of _channel_ in message ("-1" if _channel_ was not found) |
|
||||
`55`
|
||||
|
||||
| pos_text | ≥ 1.3 |
|
||||
The index of 'text' in message ("-1" if 'text' was not found) |
|
||||
The index of _text_ in message ("-1" if _text_ was not found) |
|
||||
`65`
|
||||
|===
|
||||
|
||||
|
@ -999,7 +999,7 @@ else:
|
|||
----
|
||||
|
||||
[NOTE]
|
||||
Versions ≤ 0.3.1.1 return empty string for 'info_get("version_number")' so you
|
||||
Versions ≤ 0.3.1.1 return empty string for _info_get("version_number")_ so you
|
||||
must check that value returned is *not* empty.
|
||||
|
||||
To get version as string:
|
||||
|
|
|
@ -45,7 +45,7 @@ l'API est la même pour les autres langages.
|
|||
==== Python
|
||||
|
||||
* Vous devez utiliser `import weechat`
|
||||
* Les fonctions `print*` se nomment `prnt*` en python (car 'print' est un mot
|
||||
* Les fonctions `print*` se nomment `prnt*` en python (car _print_ est un mot
|
||||
clé réservé)
|
||||
* Les fonctions sont appelées par `weechat.xxx(arg1, arg2, ...)`
|
||||
|
||||
|
@ -55,7 +55,7 @@ l'API est la même pour les autres langages.
|
|||
|
||||
==== Ruby
|
||||
|
||||
* Vous devez définir 'weechat_init' et appeler 'register' dedans
|
||||
* Vous devez définir _weechat_init_ et appeler _register_ dedans
|
||||
* Les fonctions sont appelées par `Weechat.xxx(arg1, arg2, ...)`
|
||||
* En raison d'une limitation de Ruby (15 paramètres maximum par fonction), la
|
||||
fonction `Weechat.config_new_option` reçoit les "callbacks" dans un tableau de
|
||||
|
@ -105,14 +105,14 @@ weechat.register(name, author, version, license, description, shutdown_function,
|
|||
|
||||
Paramètres :
|
||||
|
||||
* 'name' : chaîne, nom interne du script
|
||||
* 'author' : chaîne, nom de l'auteur
|
||||
* 'version' : chaîne, version du script
|
||||
* 'license' : chaîne, licence du script
|
||||
* 'description' : chaîne, description courte du script
|
||||
* 'shutdown_function' : chaîne, nom de la fonction appelée lorsque le script
|
||||
* _name_ : chaîne, nom interne du script
|
||||
* _author_ : chaîne, nom de l'auteur
|
||||
* _version_ : chaîne, version du script
|
||||
* _license_ : chaîne, licence du script
|
||||
* _description_ : chaîne, description courte du script
|
||||
* _shutdown_function_ : chaîne, nom de la fonction appelée lorsque le script
|
||||
est déchargé (peut être une chaîne vide)
|
||||
* 'charset' : chaîne, jeu de caractères du script (si votre script est UTF-8,
|
||||
* _charset_ : chaîne, jeu de caractères du script (si votre script est UTF-8,
|
||||
vous pouvez utiliser une valeur vide ici, car UTF-8 est le jeu de caractères
|
||||
par défaut)
|
||||
|
||||
|
@ -207,7 +207,7 @@ Chaque langage a également sa propre commande :
|
|||
/javascript load script.js
|
||||
----
|
||||
|
||||
Vous pouvez faire un lien dans le répertoire 'langage/autoload' pour charger
|
||||
Vous pouvez faire un lien dans le répertoire _langage/autoload_ pour charger
|
||||
automatiquement le script quand WeeChat démarre.
|
||||
|
||||
Par exemple en Python :
|
||||
|
@ -219,21 +219,21 @@ $ ln -s ../script.py
|
|||
|
||||
[NOTE]
|
||||
Lors de l'installation d'un script avec la commande `/script install` le lien
|
||||
dans le répertoire 'autoload' est automatiquement créé.
|
||||
dans le répertoire _autoload_ est automatiquement créé.
|
||||
|
||||
[[differences_with_c_api]]
|
||||
== Différences avec l'API C
|
||||
|
||||
L'API script est quasiment identique à l'API C.
|
||||
Vous pouvez consulter la 'Référence API Extension WeeChat' pour le détail de
|
||||
Vous pouvez consulter la _Référence API Extension WeeChat_ pour le détail de
|
||||
chaque fonction de l'API : prototype, paramètres, valeurs de retour, exemples.
|
||||
|
||||
Il est important de bien faire la différence entre une 'extension' et un
|
||||
'script' : une 'extension' est un fichier binaire compilé et chargé avec la
|
||||
commande `/plugin`, tandis qu'un 'script' est un fichier texte chargé par une
|
||||
extension comme 'python' par la commande `/python`.
|
||||
Il est important de bien faire la différence entre une _extension_ et un
|
||||
_script_ : une _extension_ est un fichier binaire compilé et chargé avec la
|
||||
commande `/plugin`, tandis qu'un _script_ est un fichier texte chargé par une
|
||||
extension comme _python_ par la commande `/python`.
|
||||
|
||||
Quand votre script 'test.py' appelle une fonction de l'API WeeChat, le chemin
|
||||
Quand votre script _test.py_ appelle une fonction de l'API WeeChat, le chemin
|
||||
est le suivant :
|
||||
|
||||
....
|
||||
|
@ -244,7 +244,7 @@ test.py ─────► │ API script │ API C │ ─────► ║
|
|||
└────────────┴─────────┘ ╚═════════╧════════╝
|
||||
....
|
||||
|
||||
Quand WeeChat appelle un "callback" dans votre script 'test.py', le chemin
|
||||
Quand WeeChat appelle un "callback" dans votre script _test.py_, le chemin
|
||||
est inversé :
|
||||
|
||||
....
|
||||
|
@ -385,7 +385,7 @@ weechat.hook_timer(1000, 0, 1, "timer_cb", "test");
|
|||
== API script
|
||||
|
||||
Pour plus d'informations sur les fonctions de l'API, merci de consulter la
|
||||
'Référence API Extension WeeChat'.
|
||||
_Référence API Extension WeeChat_.
|
||||
|
||||
[[script_api_functions]]
|
||||
=== Fonctions
|
||||
|
@ -514,7 +514,7 @@ Liste des constantes de l'API script :
|
|||
|
||||
Ce chapitre montre quelques tâches courantes, avec des exemples.
|
||||
Seule une partie de l'API est utilisée ici, pour une référence complète, voir la
|
||||
'Référence API Extension WeeChat'.
|
||||
_Référence API Extension WeeChat_.
|
||||
|
||||
[[buffers]]
|
||||
=== Tampons
|
||||
|
@ -714,7 +714,7 @@ Vous pouvez lancer un processus en tâche de fond avec `hook_process`. Votre
|
|||
"callback" sera appelé quand des données seront prêtes. Il peut être appelé
|
||||
plusieurs fois.
|
||||
|
||||
Pour le dernier appel à votre "callback", 'rc' est positionné à 0 ou une valeur
|
||||
Pour le dernier appel à votre "callback", _rc_ est positionné à 0 ou une valeur
|
||||
positive, c'est le code retour de la commande.
|
||||
|
||||
Exemple :
|
||||
|
@ -768,7 +768,7 @@ Toutes les infos disponibles à propos de WeeChat sont sur la page
|
|||
https://weechat.org/dev/info
|
||||
|
||||
Exemple de transfert d'URL avec une option : télécharger le dernier paquet de
|
||||
développement WeeChat dans le fichier '/tmp/weechat-devel.tar.gz' :
|
||||
développement WeeChat dans le fichier _/tmp/weechat-devel.tar.gz_ :
|
||||
|
||||
[source,python]
|
||||
----
|
||||
|
@ -784,7 +784,7 @@ weechat.hook_process_hashtable("url:https://weechat.org/files/src/weechat-devel.
|
|||
|
||||
Pour plus d'information sur le transfert d'URL et les options disponibles, voir
|
||||
les fonctions `hook_process` et `hook_process_hashtable` dans la
|
||||
'Référence API Extension WeeChat'.
|
||||
_Référence API Extension WeeChat_.
|
||||
|
||||
[[config_options]]
|
||||
=== Config / options
|
||||
|
@ -949,7 +949,7 @@ Le résultat est une table de hachage avec les clés suivantes
|
|||
`nick!user@host`
|
||||
|
||||
| command | ≥ 0.3.4 |
|
||||
La commande ('PRIVMSG', 'NOTICE', ...) |
|
||||
La commande (_PRIVMSG_, _NOTICE_, ...) |
|
||||
`PRIVMSG`
|
||||
|
||||
| channel | ≥ 0.3.4 |
|
||||
|
@ -965,19 +965,19 @@ Le résultat est une table de hachage avec les clés suivantes
|
|||
`hello!`
|
||||
|
||||
| pos_command | ≥ 1.3 |
|
||||
La position de 'command' dans le message ("-1" si 'command' n'a pas été trouvé) |
|
||||
La position de _command_ dans le message ("-1" si _command_ n'a pas été trouvé) |
|
||||
`47`
|
||||
|
||||
| pos_arguments | ≥ 1.3 |
|
||||
La position de 'arguments' dans le message ("-1" si 'arguments' n'a pas été trouvé) |
|
||||
La position de _arguments_ dans le message ("-1" si _arguments_ n'a pas été trouvé) |
|
||||
`55`
|
||||
|
||||
| pos_channel | ≥ 1.3 |
|
||||
La position de 'channel' dans le message ("-1" si 'channel' n'a pas été trouvé) |
|
||||
La position de _channel_ dans le message ("-1" si _channel_ n'a pas été trouvé) |
|
||||
`55`
|
||||
|
||||
| pos_text | ≥ 1.3 |
|
||||
La position de 'text' dans le message ("-1" si 'text' n'a pas été trouvé) |
|
||||
La position de _text_ dans le message ("-1" si _text_ n'a pas été trouvé) |
|
||||
`65`
|
||||
|===
|
||||
|
||||
|
@ -1026,7 +1026,7 @@ else:
|
|||
|
||||
[NOTE]
|
||||
Les versions ≤ 0.3.1.1 retournent une chaîne vide pour
|
||||
'info_get("version_number")', donc vous devez vérifier que la valeur de retour
|
||||
_info_get("version_number")_, donc vous devez vérifier que la valeur de retour
|
||||
n'est *pas* vide.
|
||||
|
||||
Pour obtenir la version sous forme de chaîne :
|
||||
|
|
|
@ -51,7 +51,7 @@ Quasi tutti gli esempi in questo manuale sono scritti in Python, ma l'API
|
|||
==== Python
|
||||
|
||||
* E necessario `import weechat`
|
||||
* Le funzioni `print*` sono chiamate `prnt*` in python (dato che 'print'
|
||||
* Le funzioni `print*` sono chiamate `prnt*` in python (dato che _print_
|
||||
è una parola riservata)
|
||||
* Le funzioni sono chiamate con `weechat.xxx(arg1, arg2, ...)`
|
||||
|
||||
|
@ -61,7 +61,7 @@ Quasi tutti gli esempi in questo manuale sono scritti in Python, ma l'API
|
|||
|
||||
==== Ruby
|
||||
|
||||
* E necessario definire 'weechat_init' e chiamare 'register' all'interno
|
||||
* E necessario definire _weechat_init_ e chiamare _register_ all'interno
|
||||
* Le funzioni sono chiamate con `Weechat.xxx(arg1, arg2, ...)`
|
||||
* A causa di una limitazione di Ruby (massimo 15 argomenti per funzione), la
|
||||
funzione `WeeChat.config_new_option` riceve le callback in un array di 6
|
||||
|
@ -111,14 +111,14 @@ weechat.register(name, author, version, license, description, shutdown_function,
|
|||
|
||||
Argomenti:
|
||||
|
||||
* 'name': stringa, nome interno dello script
|
||||
* 'author': stringa, nome dell'autore
|
||||
* 'version': stringa, versione dello script
|
||||
* 'license': stringa, licenza dello script
|
||||
* 'description': stringa, breve descrizione dello script
|
||||
* 'shutdown_function': stringa, nome della funzione chiamata quando lo script
|
||||
* _name_: stringa, nome interno dello script
|
||||
* _author_: stringa, nome dell'autore
|
||||
* _version_: stringa, versione dello script
|
||||
* _license_: stringa, licenza dello script
|
||||
* _description_: stringa, breve descrizione dello script
|
||||
* _shutdown_function_: stringa, nome della funzione chiamata quando lo script
|
||||
viene scaricato (può essere una stringa vuota)
|
||||
* 'charset': stringa, set caratteri dello script (se il proprio script è in UTF-8,
|
||||
* _charset_: stringa, set caratteri dello script (se il proprio script è in UTF-8,
|
||||
è possibile utilizzare un valore nullo qui, dato che UTF-8 è il set caratteri predefinito)
|
||||
|
||||
Esempio di script, per ogni linguaggio:
|
||||
|
@ -211,7 +211,7 @@ Ogni linguaggio ha anche il suo comando specifico:
|
|||
/javascript load script.js
|
||||
----
|
||||
|
||||
È possibile creare un link nella directory 'linguaggio/autoload' per caricare
|
||||
È possibile creare un link nella directory _linguaggio/autoload_ per caricare
|
||||
automaticamente gli script all'avvio di WeeChat.
|
||||
|
||||
Ad esempio con Python:
|
||||
|
@ -223,21 +223,21 @@ $ ln -s ../script.py
|
|||
|
||||
[NOTE]
|
||||
Quando viene installato un script con il comando `/script install` il link nella
|
||||
directory 'autoload' viene creato automaticamente'.
|
||||
directory _autoload_ viene creato automaticamente'.
|
||||
|
||||
[[differences_with_c_api]]
|
||||
== Differenze con le API in C
|
||||
|
||||
Le API per gli script sono quasi identiche di quelle per i plugin C.
|
||||
È possibile consultare '*' per i dettagli su ogni funzione nelle API:
|
||||
È possibile consultare _*_ per i dettagli su ogni funzione nelle API:
|
||||
prototipo, argomenti, valori restituiti, esempi.
|
||||
|
||||
È importante fare la differenza tra un 'plugin' ed uno 'script':
|
||||
È importante fare la differenza tra un _plugin_ ed uno _script_:
|
||||
un plugin è un file binario compilato e caricato con il comando
|
||||
`plugin`, mentre uno 'script' è un file di testo caricato tramite
|
||||
un plugin come 'python' con il comando `python`.
|
||||
`plugin`, mentre uno _script_ è un file di testo caricato tramite
|
||||
un plugin come _python_ con il comando `python`.
|
||||
|
||||
Quando il proprio script 'test.py' chiama una funzione delle API di
|
||||
Quando il proprio script _test.py_ chiama una funzione delle API di
|
||||
Weechat, il path è simile a questo:
|
||||
|
||||
....
|
||||
|
@ -248,7 +248,7 @@ test.py ─────► │ script API │ C API │ ─────► ║
|
|||
└────────────┴─────────┘ ╚═════════╧════════╝
|
||||
....
|
||||
|
||||
Quando WeeChat chiama una callback nel proprio script 'test.py', è
|
||||
Quando WeeChat chiama una callback nel proprio script _test.py_, è
|
||||
l'opposto del path precedente:
|
||||
|
||||
....
|
||||
|
@ -389,7 +389,7 @@ weechat.hook_timer(1000, 0, 1, "timer_cb", "test");
|
|||
== Script API
|
||||
|
||||
Per maggiori informazioni sulle funzioni nelle API,
|
||||
consultare 'Referenze API per Plugin di WeeChat'.
|
||||
consultare _Referenze API per Plugin di WeeChat_.
|
||||
|
||||
[[script_api_functions]]
|
||||
=== Funzioni
|
||||
|
@ -519,7 +519,7 @@ Elenco di costanti nelle API per gli script:
|
|||
Questo capitolo spiega alcuni compiti comuni, con degli esempi.
|
||||
Verranno utilizzati soltanto degli elementi parziali contenuti
|
||||
nelle API, per un riferimento completo consultare
|
||||
'Referenze API per Plugin di WeeChat'.
|
||||
_Referenze API per Plugin di WeeChat_.
|
||||
|
||||
[[buffers]]
|
||||
=== Buffer
|
||||
|
@ -719,7 +719,7 @@ weechat.hook_timer(60 * 1000, 60, 0, "timer_cb", "")
|
|||
callback verrà chiamata quando i dati sono pronti. Può essere chiamata
|
||||
più volte.
|
||||
|
||||
Per l'ultima chiamata alla callback, 'rc' è impostato a zero o su un
|
||||
Per l'ultima chiamata alla callback, _rc_ è impostato a zero o su un
|
||||
valore positivo, è il codice restituito dal comando.
|
||||
|
||||
Esempio:
|
||||
|
@ -773,7 +773,7 @@ Tutte le informazioni disponibili su Weechat sono sulla pagina
|
|||
https://weechat.org/dev/info
|
||||
|
||||
Esempio di trasferimento di un URL con un'opzione: scaricare l'ultimo pacchetto
|
||||
di sviluppo di WeeChat nel file '/tmp/weechat-devel.tar.gz':
|
||||
di sviluppo di WeeChat nel file _/tmp/weechat-devel.tar.gz_:
|
||||
|
||||
[source,python]
|
||||
----
|
||||
|
@ -788,8 +788,8 @@ weechat.hook_process_hashtable("url:https://weechat.org/files/src/weechat-devel.
|
|||
----
|
||||
|
||||
Per maggiori informazioni sul trasferimento degli URL e le opzioni disponibili,
|
||||
consultare le funzioni `hook_process` e `hook_process_hashtable` in 'Referenze
|
||||
API per Plugin'.
|
||||
consultare le funzioni `hook_process` e `hook_process_hashtable` in
|
||||
_Referenze API per Plugin_.
|
||||
|
||||
[[config_options]]
|
||||
=== Configurazione / opzioni
|
||||
|
@ -954,7 +954,7 @@ The result is a hashtable with following keys
|
|||
`nick!user@host`
|
||||
|
||||
| command | ≥ 0.3.4 |
|
||||
The command ('PRIVMSG', 'NOTICE', ...) |
|
||||
The command (_PRIVMSG_, _NOTICE_, ...) |
|
||||
`PRIVMSG`
|
||||
|
||||
| channel | ≥ 0.3.4 |
|
||||
|
@ -970,19 +970,19 @@ The result is a hashtable with following keys
|
|||
`hello!`
|
||||
|
||||
| pos_command | ≥ 1.3 |
|
||||
The index of 'command' in message ("-1" if 'command' was not found) |
|
||||
The index of _command_ in message ("-1" if _command_ was not found) |
|
||||
`47`
|
||||
|
||||
| pos_arguments | ≥ 1.3 |
|
||||
The index of 'arguments' in message ("-1" if 'arguments' was not found) |
|
||||
The index of _arguments_ in message ("-1" if _arguments_ was not found) |
|
||||
`55`
|
||||
|
||||
| pos_channel | ≥ 1.3 |
|
||||
The index of 'channel' in message ("-1" if 'channel' was not found) |
|
||||
The index of _channel_ in message ("-1" if _channel_ was not found) |
|
||||
`55`
|
||||
|
||||
| pos_text | ≥ 1.3 |
|
||||
The index of 'text' in message ("-1" if 'text' was not found) |
|
||||
The index of _text_ in message ("-1" if _text_ was not found) |
|
||||
`65`
|
||||
|===
|
||||
|
||||
|
@ -1030,7 +1030,7 @@ else:
|
|||
|
||||
[NOTE]
|
||||
Le versioni ≤ 0.3.1.1 restituiscono una stringa vuota per
|
||||
'info_get("version_number")', per cui bisogna verificare che
|
||||
_info_get("version_number")_, per cui bisogna verificare che
|
||||
il valore restituito *non* sia vuoto.
|
||||
|
||||
To get version as string:
|
||||
|
|
|
@ -50,7 +50,7 @@ WeeChat (Wee Enhanced Environment for Chat)
|
|||
|
||||
* 必ず `import weechat` を使ってください。
|
||||
* python では `print*` 系の関数は `prnt*` と書きます
|
||||
('print' は予約済みキーワードなので)。
|
||||
(_print_ は予約済みキーワードなので)。
|
||||
* 関数は `weechat.xxx(arg1, arg2, ...)` のように呼び出してください。
|
||||
|
||||
==== Perl
|
||||
|
@ -59,7 +59,7 @@ WeeChat (Wee Enhanced Environment for Chat)
|
|||
|
||||
==== Ruby
|
||||
|
||||
* 'weechat_init' を定義して、内部で 'register' を呼び出してください。
|
||||
* _weechat_init_ を定義して、内部で _register_ を呼び出してください。
|
||||
* 関数は `Weechat.xxx(arg1, arg2, ...)` のように呼び出してください。
|
||||
* Ruby では関数に渡せる引数の数が最大 15 個に制限されているため、`Weechat.config_new_option`
|
||||
関数はコールバック用の引数群を 6 個の文字列からなる 1 個の配列で受け取ります (3 個のコールバック
|
||||
|
@ -108,14 +108,14 @@ weechat.register(name, author, version, license, description, shutdown_function,
|
|||
|
||||
引数:
|
||||
|
||||
* 'name': 文字列型、スクリプトの内部名
|
||||
* 'author': 文字列型、作者名
|
||||
* 'version': 文字列型、スクリプトのバージョン
|
||||
* 'license': 文字列型、スクリプトのライセンス
|
||||
* 'description': 文字列型、スクリプトの短い説明
|
||||
* 'shutdown_function': 文字列型、スクリプトがアンロードされた際に呼び出される関数の名前
|
||||
* _name_: 文字列型、スクリプトの内部名
|
||||
* _author_: 文字列型、作者名
|
||||
* _version_: 文字列型、スクリプトのバージョン
|
||||
* _license_: 文字列型、スクリプトのライセンス
|
||||
* _description_: 文字列型、スクリプトの短い説明
|
||||
* _shutdown_function_: 文字列型、スクリプトがアンロードされた際に呼び出される関数の名前
|
||||
(空文字列でも可)
|
||||
* 'charset': 文字列型、スクリプトの文字コード (UTF-8
|
||||
* _charset_: 文字列型、スクリプトの文字コード (UTF-8
|
||||
はデフォルトの文字コードなので、スクリプトが UTF-8 で書かれている場合、空文字列を指定してください)
|
||||
|
||||
各言語で書かれたスクリプトの例:
|
||||
|
@ -209,7 +209,7 @@ weechat.print("", "Hello, from javascript script!");
|
|||
----
|
||||
|
||||
WeeChat の開始時にスクリプトを自動ロードするには
|
||||
'language/autoload' ディレクトリ内にリンクを作ってください。
|
||||
_language/autoload_ ディレクトリ内にリンクを作ってください。
|
||||
|
||||
例えば Python の場合:
|
||||
|
||||
|
@ -219,22 +219,22 @@ $ ln -s ../script.py
|
|||
----
|
||||
|
||||
[NOTE]
|
||||
`/script install` コマンドでスクリプトをインストールした場合、'autoload'
|
||||
`/script install` コマンドでスクリプトをインストールした場合、_autoload_
|
||||
ディレクトリ内にリンクが自動的に作成されます。
|
||||
|
||||
[[differences_with_c_api]]
|
||||
== C API との違い
|
||||
|
||||
スクリプト API は C 言語プラグイン API とほぼ同じです。API
|
||||
に含まれる各関数の詳細については、'WeeChat プラグイン API リファレンス'
|
||||
に含まれる各関数の詳細については、_WeeChat プラグイン API リファレンス_
|
||||
をご覧ください: プロトタイプ、引数、戻り値、例。
|
||||
|
||||
'プラグイン' と'スクリプト' の違いを理解することは重要です: 'プラグイン'
|
||||
_プラグイン_ と_スクリプト_ の違いを理解することは重要です: _プラグイン_
|
||||
とはコンパイル済みバイナリファイルで `/plugin` コマンドを使ってロードします、これに対して
|
||||
'スクリプト' とはテキストファイルで例えば 'python' プラグインであれば `/python`
|
||||
_スクリプト_ とはテキストファイルで例えば _python_ プラグインであれば `/python`
|
||||
コマンドを使ってロードします。
|
||||
|
||||
例えば 'test.py' スクリプトが WeeChat API 関数を呼び出す場合、以下の順に呼び出されます:
|
||||
例えば _test.py_ スクリプトが WeeChat API 関数を呼び出す場合、以下の順に呼び出されます:
|
||||
|
||||
// PLEASE DO NOT TRANSLATE
|
||||
....
|
||||
|
@ -245,7 +245,7 @@ test.py ─────► │ script API │ C API │ ─────► ║
|
|||
└────────────┴─────────┘ ╚═════════╧════════╝
|
||||
....
|
||||
|
||||
WeeChat が 'test.py'
|
||||
WeeChat が _test.py_
|
||||
スクリプトで定義されたコールバックを呼び出す場合、順番は逆になります:
|
||||
|
||||
// PLEASE DO NOT TRANSLATE
|
||||
|
@ -382,7 +382,7 @@ weechat.hook_timer(1000, 0, 1, "timer_cb", "test");
|
|||
== スクリプト API
|
||||
|
||||
API に含まれる関数の詳しい情報は
|
||||
'WeeChat プラグイン API リファレンス' をご覧ください。.
|
||||
_WeeChat プラグイン API リファレンス_ をご覧ください。.
|
||||
|
||||
[[script_api_functions]]
|
||||
=== 関数
|
||||
|
@ -511,7 +511,7 @@ API に含まれる関数の詳しい情報は
|
|||
|
||||
この章ではいくつかの良くあるタスクを例を交えて紹介します。ここでは
|
||||
API の一部の機能を使っています。完全なリファレンスは
|
||||
'WeeChat プラグイン API リファレンス' をご覧ください。
|
||||
_WeeChat プラグイン API リファレンス_ をご覧ください。
|
||||
|
||||
[[buffers]]
|
||||
=== バッファ
|
||||
|
@ -705,7 +705,7 @@ weechat.hook_timer(60 * 1000, 60, 0, "timer_cb", "")
|
|||
バックグラウンドプロセスを実行するには `hook_process`
|
||||
を使います。コールバックはデータの準備が整った時点で呼び出されます。複数回呼び出されることもあります。
|
||||
|
||||
コールバックの最後の呼び出しでは 'rc' が 0
|
||||
コールバックの最後の呼び出しでは _rc_ が 0
|
||||
か正の値に設定されています。これはコマンドのリターンコードになります。
|
||||
|
||||
例:
|
||||
|
@ -757,7 +757,7 @@ weechat.hook_process("url:https://weechat.org/dev/info/stable/",
|
|||
WeeChat に関して利用できる情報は全て https://weechat.org/dev/info にあります
|
||||
|
||||
オプション有りの URL 転送の例: 最新の WeeChat 開発パッケージをファイル
|
||||
'/tmp/weechat-devel.tar.gz' にダウンロード:
|
||||
_/tmp/weechat-devel.tar.gz_ にダウンロード:
|
||||
|
||||
[source,python]
|
||||
----
|
||||
|
@ -772,7 +772,7 @@ weechat.hook_process_hashtable("url:https://weechat.org/files/src/weechat-devel.
|
|||
----
|
||||
|
||||
URL 転送に関するより詳しい情報と利用可能なオプションを見るには、
|
||||
'WeeChat プラグイン API リファレンス' の `hook_process` と `hook_process_hashtable` をご覧ください。
|
||||
_WeeChat プラグイン API リファレンス_ の `hook_process` と `hook_process_hashtable` をご覧ください。
|
||||
|
||||
[[config_options]]
|
||||
=== 設定 / オプション
|
||||
|
@ -932,7 +932,7 @@ _WeeChat バージョン 0.3.4 以上で利用可。_
|
|||
`nick!user@host`
|
||||
|
||||
| command | 0.3.4 以上 |
|
||||
コマンド ('PRIVMSG' 、'NOTICE' 、...) |
|
||||
コマンド (_PRIVMSG_ 、_NOTICE_ 、...) |
|
||||
`PRIVMSG`
|
||||
|
||||
| channel | 0.3.4 以上 |
|
||||
|
@ -948,19 +948,19 @@ _WeeChat バージョン 0.3.4 以上で利用可。_
|
|||
`hello!`
|
||||
|
||||
| pos_command | 1.3 以上 |
|
||||
メッセージ内における 'command' のインデックス ('command' が見つからない場合 "-1") |
|
||||
メッセージ内における _command_ のインデックス (_command_ が見つからない場合 "-1") |
|
||||
`47`
|
||||
|
||||
| pos_arguments | 1.3 以上 |
|
||||
メッセージ内における 'arguments' のインデックス ('arguments' が見つからない場合 "-1") |
|
||||
メッセージ内における _arguments_ のインデックス (_arguments_ が見つからない場合 "-1") |
|
||||
`55`
|
||||
|
||||
| pos_channel | 1.3 以上 |
|
||||
メッセージ内における 'channel' のインデックス ('channel' が見つからない場合 "-1") |
|
||||
メッセージ内における _channel_ のインデックス (_channel_ が見つからない場合 "-1") |
|
||||
`55`
|
||||
|
||||
| pos_text | 1.3 以上 |
|
||||
メッセージ内における 'text' のインデックス ('text' が見つからない場合 "-1") |
|
||||
メッセージ内における _text_ のインデックス (_text_ が見つからない場合 "-1") |
|
||||
`65`
|
||||
|===
|
||||
|
||||
|
@ -1007,7 +1007,7 @@ else:
|
|||
----
|
||||
|
||||
[NOTE]
|
||||
バージョン 0.3.1.1 以下の場合 'info_get("version_number")'
|
||||
バージョン 0.3.1.1 以下の場合 _info_get("version_number")_
|
||||
は空文字列を返すため、値が空でないことを確認しなければいけません。
|
||||
|
||||
文字列でバージョンを使うには:
|
||||
|
|
|
@ -49,7 +49,7 @@ ale API jest takie same dla wszystkich języków.
|
|||
==== Python
|
||||
|
||||
* Należy wykonać `import weechat`
|
||||
* Funkcje `print*` są nazwane `prnt*` w pythonie (ponieważ 'print' jest zastrzeżonym
|
||||
* Funkcje `print*` są nazwane `prnt*` w pythonie (ponieważ _print_ jest zastrzeżonym
|
||||
słowem kluczowym)
|
||||
* Funkcje są wywoływane za pomocą `weechat.xxx(arg1, arg2, ...)`
|
||||
|
||||
|
@ -59,7 +59,7 @@ ale API jest takie same dla wszystkich języków.
|
|||
|
||||
==== Ruby
|
||||
|
||||
* Trzeba zdefiniować 'weechat_init' i wywołać 'register' wewnątrz
|
||||
* Trzeba zdefiniować _weechat_init_ i wywołać _register_ wewnątrz
|
||||
* Funkcje są wywoływane za pomocą `Weechat.xxx(arg1, arg2, ...)`
|
||||
* W związku z ograniczeniami Ruby (maksymalnie 15 argumentów dla funkcji), funkcja
|
||||
`Weechat.config_new_option` otrzymuje callbacki w postaci tablicy 6 ciągów
|
||||
|
@ -108,14 +108,14 @@ weechat.register(nazwa, autor, wersja, licencja, opis, funkcja_wyłączająca, k
|
|||
|
||||
Argumenty:
|
||||
|
||||
* 'nazwa': string, wewnętrzna nazwa skryptu
|
||||
* 'autor': string, autor skryptu
|
||||
* 'wersja': string, wersja
|
||||
* 'licencja': string, licencja
|
||||
* 'opis': string, krótki opis skryptu
|
||||
* 'funkcja_wyłączająca': string, nazwa funkcji wywoływanej podczas wyładowania skryptu
|
||||
* _nazwa_: string, wewnętrzna nazwa skryptu
|
||||
* _autor_: string, autor skryptu
|
||||
* _wersja_: string, wersja
|
||||
* _licencja_: string, licencja
|
||||
* _opis_: string, krótki opis skryptu
|
||||
* _funkcja_wyłączająca_: string, nazwa funkcji wywoływanej podczas wyładowania skryptu
|
||||
(może być pusty ciąg)
|
||||
* 'kodowanie': string, kodowane skryptu (jeśli skrypt jest napisany
|
||||
* _kodowanie_: string, kodowane skryptu (jeśli skrypt jest napisany
|
||||
w UTF-8 można nie podawać tej wartości - UTF-8 to domyślne kodowanie)
|
||||
|
||||
Przykład dla skryptu w każdym z języków:
|
||||
|
@ -208,7 +208,7 @@ Każdy język posiada również swoją własną komendę:
|
|||
/javascript load skrypt.js
|
||||
----
|
||||
|
||||
Możesz zrobić dowiązanie w katalogu 'język/autoload' jeśli chcesz automatycznie
|
||||
Możesz zrobić dowiązanie w katalogu _język/autoload_ jeśli chcesz automatycznie
|
||||
ładować skrypt po uruchomieniu WeeChat.
|
||||
|
||||
Na przykład dla Pythona:
|
||||
|
@ -220,21 +220,21 @@ $ ln -s ../skrypt.py
|
|||
|
||||
[NOTE]
|
||||
Podczas instalacji skryptu za pomocą `/script install` automatycznie tworzone jest
|
||||
dowiązanie w katalogu 'autoload'.
|
||||
dowiązanie w katalogu _autoload_.
|
||||
|
||||
[[differences_with_c_api]]
|
||||
== Różnice pomiędzy API dla C
|
||||
|
||||
API skryptów jest prawie takie same jak API dla wtyczek pisanych w C.
|
||||
Możesz zajrzeć do 'Opisu API wtyczek WeeChat' po więcej informacji na temat
|
||||
Możesz zajrzeć do _Opisu API wtyczek WeeChat_ po więcej informacji na temat
|
||||
każdej z funkcji API: prototyp, argumenty, zwracane wartości, przykłady.
|
||||
|
||||
Ważne jest rozróżnienie 'wtyczki' od 'skryptu': 'wtyczka' jest plikiem binarnym
|
||||
skompilowanym i załadowanym za pomocą komendy `/plugin`, natomiast 'skrypt' jest
|
||||
plikiem tekstowym załadowanym przez wtyczkę jak 'python' za pomocą komendy
|
||||
Ważne jest rozróżnienie _wtyczki_ od _skryptu_: _wtyczka_ jest plikiem binarnym
|
||||
skompilowanym i załadowanym za pomocą komendy `/plugin`, natomiast _skrypt_ jest
|
||||
plikiem tekstowym załadowanym przez wtyczkę jak _python_ za pomocą komendy
|
||||
`/python`.
|
||||
|
||||
W momencie, kiedy Twój skrypt 'test.py' wywołuje funkcję z API Weechat, wygląda to tak:
|
||||
W momencie, kiedy Twój skrypt _test.py_ wywołuje funkcję z API Weechat, wygląda to tak:
|
||||
|
||||
....
|
||||
┌────────────────────────┐ ╔══════════════════╗
|
||||
|
@ -244,7 +244,7 @@ test.py ─────► │ API skryptów │ C API │ ─────►
|
|||
└──────────────┴─────────┘ ╚═════════╧════════╝
|
||||
....
|
||||
|
||||
Kiedy WeeChat odwołuje się do Twojego skryptu 'test.py' wygląda to tak:
|
||||
Kiedy WeeChat odwołuje się do Twojego skryptu _test.py_ wygląda to tak:
|
||||
|
||||
....
|
||||
╔══════════════════╗ ┌────────────────────────┐
|
||||
|
@ -378,7 +378,7 @@ weechat.hook_timer(1000, 0, 1, "timer_cb", "test");
|
|||
[[script_api]]
|
||||
== API skryptów
|
||||
|
||||
Więcej informacji o funkcjach w API, znajdziesz w 'Opisie API wtyczek WeeChat'.
|
||||
Więcej informacji o funkcjach w API, znajdziesz w _Opisie API wtyczek WeeChat_.
|
||||
|
||||
[[script_api_functions]]
|
||||
=== Fukcje
|
||||
|
@ -507,7 +507,7 @@ Lista stałych w API skryptów:
|
|||
|
||||
Ten rozdział przedstawia część częstych zadań z przykładami.
|
||||
Użyto tu tylko część rzeczy dostępnych w API, dokładne informacje można znaleźć
|
||||
w Opisie API wtyczek WeeChat'.
|
||||
w _Opisie API wtyczek WeeChat_.
|
||||
|
||||
[[buffers]]
|
||||
=== Bufory
|
||||
|
@ -701,7 +701,7 @@ weechat.hook_timer(60 * 1000, 60, 0, "timer_cb", "")
|
|||
Do wykonywania procesów w tle służy `hook_process`. Twoje callbacki zostaną
|
||||
wywołane, kiedy dane będą gotowe. Może zostać wywołane wiele razy.
|
||||
|
||||
Dla ostatniego wykonania Twojego callbacku 'rc' jest ustawiane na 0, lub wartość
|
||||
Dla ostatniego wykonania Twojego callbacku _rc_ jest ustawiane na 0, lub wartość
|
||||
dodatnią, jest to kod zwracany przez komendę.
|
||||
|
||||
Przykład:
|
||||
|
@ -753,7 +753,7 @@ weechat.hook_process("url:https://weechat.org/dev/info/stable/",
|
|||
Wszystkie informacje o WeeChat dostępne są na stronie https://weechat.org/dev/info
|
||||
|
||||
Przykładowy transfer URL z opcją: pobranie najnowszej wersji rozwojowej WeeChat
|
||||
do pliku '/tmp/weechat-devel.tar.gz':
|
||||
do pliku _/tmp/weechat-devel.tar.gz_:
|
||||
|
||||
[source,python]
|
||||
----
|
||||
|
@ -768,7 +768,7 @@ weechat.hook_process_hashtable("url:https://weechat.org/files/src/weechat-devel.
|
|||
----
|
||||
|
||||
Więcej informacji o transferach URL i dostępnych opcjach dla funkcji
|
||||
`hook_process` oraz `hook_process_hashtable` można znaleźć w 'Opisie API wtyczek'.
|
||||
`hook_process` oraz `hook_process_hashtable` można znaleźć w _Opisie API wtyczek_.
|
||||
|
||||
[[config_options]]
|
||||
=== Konfiguracja / opcje
|
||||
|
@ -929,7 +929,7 @@ Wynik jest tabela hashy z następującymi kluczami
|
|||
`nick!user@host`
|
||||
|
||||
| command | ≥ 0.3.4 |
|
||||
Komenda ('PRIVMSG', 'NOTICE', ...) |
|
||||
Komenda (_PRIVMSG_, _NOTICE_, ...) |
|
||||
`PRIVMSG`
|
||||
|
||||
| channel | ≥ 0.3.4 |
|
||||
|
@ -945,19 +945,19 @@ Wynik jest tabela hashy z następującymi kluczami
|
|||
`hello!`
|
||||
|
||||
| pos_command | ≥ 1.3 |
|
||||
The index of 'command' in message ("-1" if 'command' was not found) |
|
||||
The index of _command_ in message ("-1" if _command_ was not found) |
|
||||
`47`
|
||||
|
||||
| pos_arguments | ≥ 1.3 |
|
||||
The index of 'arguments' in message ("-1" if 'arguments' was not found) |
|
||||
The index of _arguments_ in message ("-1" if _arguments_ was not found) |
|
||||
`55`
|
||||
|
||||
| pos_channel | ≥ 1.3 |
|
||||
The index of 'channel' in message ("-1" if 'channel' was not found) |
|
||||
The index of _channel_ in message ("-1" if _channel_ was not found) |
|
||||
`55`
|
||||
|
||||
| pos_text | ≥ 1.3 |
|
||||
The index of 'text' in message ("-1" if 'text' was not found) |
|
||||
The index of _text_ in message ("-1" if _text_ was not found) |
|
||||
`65`
|
||||
|===
|
||||
|
||||
|
@ -1004,7 +1004,7 @@ else:
|
|||
----
|
||||
|
||||
[NOTE]
|
||||
Wersje ≤ 0.3.1.1 zwracają pusty ciąg dla 'info_get("version_number")' należy
|
||||
Wersje ≤ 0.3.1.1 zwracają pusty ciąg dla _info_get("version_number")_ należy
|
||||
sprawdzić, czy zwracana wartość *nie* jest pusta.
|
||||
|
||||
Aby otrzymać ciąg z numerem wersji:
|
||||
|
|
Loading…
Reference in New Issue