From 0b604cdc0b670b1621108cb2fa31ff9ad2b63fe0 Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Mon, 9 Mar 2020 10:50:41 +0100 Subject: [PATCH] Embed more script function docs --- picard/script.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/picard/script.py b/picard/script.py index a218e2157..c8e7349cb 100644 --- a/picard/script.py +++ b/picard/script.py @@ -560,9 +560,9 @@ def _compute_logic(operation, *args): @script_function(eval_args=False, documentation=N_( - """`$if(if,then,else)` +"""`$if(if,then,else)` - If `if` is not empty, it returns `then`, otherwise it returns `else`.""" +If `if` is not empty, it returns `then`, otherwise it returns `else`.""" )) def func_if(parser, _if, _then, _else=None): """If ``if`` is not empty, it returns ``then``, otherwise it returns ``else``.""" @@ -573,7 +573,11 @@ def func_if(parser, _if, _then, _else=None): return '' -@script_function(eval_args=False) +@script_function(eval_args=False, documentation=N_( +"""`$if2(a1,a2,a3,...)` + +Returns first non empty argument.""" +)) def func_if2(parser, *args): """Returns first non empty argument.""" for arg in args: @@ -583,13 +587,22 @@ def func_if2(parser, *args): return '' -@script_function(eval_args=False) +@script_function(eval_args=False, documentation=N_( +"""`$noop(...)` + +Does nothing (useful for comments or disabling a block of code).""" +)) def func_noop(parser, *args): """Does nothing :)""" return '' -@script_function() +@script_function(documentation=N_( +"""`$left(text,num)` + +Returns the first `num` characters from `text`. +""" +)) def func_left(parser, text, length): """Returns first ``num`` characters from ``text``.""" try: