There's no need to use javascript for this macro.  Instead, you can create 
a tiddler named "$:/plugins/vpl/jazzbokMem/db_macros_plan", tagged with 
`$:/tags/Macro`, containing:
```
\define db_macros_plan(opt)
<$let audio_path={{$opt$!!audio_ref}}>
<$list filter="[<audio_path>search:title[file/audio/cours]]" 
emptyMessage="N/A">
   <audio src=<<audio_path>> preload="auto" controls></audio>
</$list>
\end
```
You can then use it exactly as you were before:
```
<$macrocall $name="db_macros_plan" opt={{{ [<currentTiddler>get[title]] }}} 
/>
```
enjoy,
-e
On Sunday, December 4, 2022 at 11:41:38 PM UTC-8 vpl wrote:

> Of course,
> here it is:
>
> /*\
> title: $:/plugins/vpl/jazzbokMem/db_macros_plan.js
> type: application/javascript
> module-type: macro
>
>
> \*/
> (function(){
>
> /*jslint node: true, browser: true */
> /*global $tw: false */
> "use strict";
>
>
> /*
> Information about this macro
>
> */
> exports.name = "db_macros_plan";
>
> exports.params = [
>     {name: "opt"}
> ];
> /*
> Run the macro
> */
> exports.run = function(opt) {
>     var str_return = "N/A";
>     console.log("db_macros_plan 0.2. opt:"+opt);
>        var dbPlanTiddler = this.wiki.getTiddler(opt);
>     var audio_path = dbPlanTiddler.getFieldString("audio_ref");
>     if (audio_path.includes("files/audio/cours")) {
>         str_return = "audio src=\""+audio_path+"\" preload=\"auto\" 
> controls></audio>";
>         console.log(str_return);
>     }
>     return (str_return);
> };
>
> })();
>
> Le lundi 5 décembre 2022 à 03:15:56 UTC+1, [email protected] a écrit :
>
>> I think we are going to need to see the full definition of your 
>> "db_macros_plan" macro.
>>
>> On Sunday, December 4, 2022 at 10:43:27 AM UTC-4 vpl wrote:
>>
>>> Hi,
>>>
>>> I've the following table that list different scores (tiddlers in 
>>> tiddlywiki). See bottom of this mail
>>>
>>> This works perfectly except for the 
>>> <$macrocall $name="db_macros_plan" opt={{{ [<currentTiddler>get[title]] 
>>> }}} /> execution.
>>>
>>> This macro return what I expect, that is to say: 
>>> audio src="files/audio/cours/blues-ex-1.mp3" preload="auto" 
>>> controls></audio>
>>> But in the rendered table this appears as a the string 'audio 
>>> src="files/audio/cou ...." where I expect to get the refering html5 
>>> audio element
>>>
>>> What is my error ..??
>>>
>>> Thanks a lot for your help
>>> Regards
>>>
>>>
>>> <table>
>>> <tbody>
>>> <tr>
>>> <th>Mode</th><th>Audio</th><th>Comments</th><th>Score</th>
>>> </tr>
>>> <$list filter=<<plansDBFilter>>>
>>> <tr>
>>> <td><$view field="mode"/></td>
>>> <td><$macrocall $name="db_macros_plan" opt={{{ 
>>> [<currentTiddler>get[title]] }}} /></td>
>>> <td><$view field="comments"/></td>
>>> <td><img src= {{{ [<currentTiddler>get[score_ref]] }}} /></td>
>>> </tr>
>>> </$list></tbody></table>
>>> \end
>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/c118709a-0911-4c77-8fd4-45d4b2b5652cn%40googlegroups.com.

Reply via email to