| | 3343 | |
| | 3344 | </sect2> |
| | 3345 | |
| | 3346 | <sect2> |
| | 3347 | <title>Filters</title> |
| | 3348 | |
| | 3349 | <para> |
| | 3350 | Any format string ending in a vertical bar (``|'') will be |
| | 3351 | expanded and piped through the first word in the string, using spaces |
| | 3352 | as separator. The string returned will be used for display. |
| | 3353 | If the returned string ends in %, it will be passed through |
| | 3354 | the formatter a second time. This allows the filter to generate a |
| | 3355 | replacement format string including % expandos. |
| | 3356 | </para> |
| | 3357 | |
| | 3358 | <para> |
| | 3359 | All % expandos in a format string are expanded before the script |
| | 3360 | is called so that: |
| | 3361 | </para> |
| | 3362 | |
| | 3363 | <screen> |
| | 3364 | set status_format="script.sh '%r %f (%L)'|" |
| | 3365 | </screen> |
| | 3366 | |
| | 3367 | <para> |
| | 3368 | will make mutt expand <literal>%r</literal>, |
| | 3369 | <literal>%f</literal> and <literal>%L</literal> |
| | 3370 | before calling the script. The example also shows that arguments can be |
| | 3371 | quoted: the script will receive the expanded string between the single quotes |
| | 3372 | as the only argument. |
| | 3373 | </para> |
| | 3374 | |
| | 3375 | <para> |
| | 3376 | A practical example is the <literal>mutt_xtitle</literal> |
| | 3377 | script installed in the <literal>samples</literal> |
| | 3378 | subdirectory of the mutt documentation: it can be used as filter for |
| | 3379 | <literal>$status_format</literal> to set the current |
| | 3380 | terminal's title, if supported. |
| | 3381 | </para> |
| | 3382 | |
| | 3383 | </sect2> |