mirror of
https://github.com/beetbox/beets.git
synced 2026-01-05 23:43:31 +01:00
Merge pull request #235 from KraYmer/inline-doc
Update inline plugin doc by providing an example about how to define a f...
This commit is contained in:
commit
fdf6bd7dc7
1 changed files with 5 additions and 4 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue