From e8be4d5ba96f7d36de34c7422e3ed2edc964b508 Mon Sep 17 00:00:00 2001 From: Fabrice Laporte Date: Wed, 27 Mar 2013 23:19:15 +0100 Subject: [PATCH] Update inline plugin doc by providing an example about how to define a field depending on 'path' attribute. --- docs/plugins/inline.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/plugins/inline.rst b/docs/plugins/inline.rst index 2537dbebb..2998de9fc 100644 --- a/docs/plugins/inline.rst +++ b/docs/plugins/inline.rst @@ -33,12 +33,13 @@ referenced in path templates like so:: If you need to use statements like ``import``, you can write a Python function body instead of a single expression. In this case, you'll need to ``return`` -a result for the value of the path field. Here's a silly, contrived example:: +a result for the value of the path field, like so:: pathfields: - track_radius: | - import math - return 2.0 * math.pi * track + filename: | + import os + from beets.util import bytestring_path + return bytestring_path(os.path.basename(path)) You might want to use the YAML syntax for "block literals," in which a leading ``|`` character indicates a multi-line block of text.