Hi Tierney,

Unfortunately, you've made a few errors in this... 

> \define podcast(start: '00:00:00' end:'00:05:00' audio:'
> podcast.com/someepisode.mp3')
> <audio src="http://"$audio$"#t="$start$","$end"; 
> controls="controls"></audio>
> \end
>

   1. you forgot to separate your parameters via comma
   2. the closing *$* for end is missing in the *src* attribute
   3. you broke the *src* attribute by trying to use quotes within quotes, 
   which you don't want or need

I'd also put the audio file first as it is the main element being specified 
by the macro and possibly the only parameter to be never left out. In other 
words, you may not need or want to specify any time frame at all. I don't 
see a need for a default for any of those parameters. Keep it simple!

So that already yields a much simpler:

\define audio(file, start, end)
<audio src="$file$#t=$start$,$end$" controls="controls"/>
\end

example: 
<<audio 
"http://www.hf.uio.no/csmn/english/services/knowledge/podcast/jerry-fodor/Fodor-What-Frege-got-wrong.mp3";
 
10 20>>

To make *start* or *end* optional, you could do...

\define audio(file, start, end)
<$reveal type="match" text="$end$" default="">
<audio src="$file$#t=$start$" controls="controls"/>
</$reveal>
<$reveal type="nomatch" text="$end$" default="">
<audio src="$file$#t=$start$,$end$" controls="controls"/>
</$reveal>
\end

example: <<audio 
"http://www.hf.uio.no/csmn/english/services/knowledge/podcast/jerry-fodor/Fodor-What-Frege-got-wrong.mp3";
 
10 20>>

As for urls, I would not assume anything.
After all, you might just wish to point to a file on a relative path.
To simplify handling of urls, you can however make use of some form of a 
base url, e.g.:

\define audio-embed(base, file, start, end)
<$reveal type="match" text="$end$" default="">
<audio src="$base$$file$#t=$start$" controls="controls"/>
</$reveal>
<$reveal type="nomatch" text="$end$" default="">
<audio src="$base$$file$#t=$start$,$end$" controls="controls"/>
</$reveal>
\end

\define audio(file, start, end)
<$macrocall $name="audio-embed" base=<<audio-base>> file="$file$" 
start="$start$" end="$end$"/>
\end

example:
<$vars audio
-base="http://www.hf.uio.no/csmn/english/services/knowledge/podcast/jerry-fodor/";>
<<audio "Fodor-What-Frege-got-wrong.mp3" 10 20>>
</$vars>

You can declare this "audio-base" variable in a global macro to define it 
once throughout the wiki, instead of per tiddler. You could also declare 
for the scope of the current tiddler as a macro definition, rather than 
using the SetWidget <http://tiddlywiki.com#SetWidget> or the VarsWidget 
<http://tiddlywiki.com#VarsWidget> e.g.:

\define audio
-base() 
http://www.hf.uio.no/csmn/english/services/knowledge/podcast/jerry-fodor/

You can probably tell that I'm used to working with strings from how I did 
> the concatenation of the audio, start, and end variables. I know how I have 
> them here is wrong, but I have no idea how to do them correctly.
>

Don't be afraid to experiment. But you got to experiment! Meaning: test 
your code! So start simply, test, modify, test, modify, test, etc... 
testing is the most crucial bit. Without it, you never know and won't get 
there. Don't be afraid to do it wrong but you've got to check. Trial and 
error, we all do.

It would be super awesome if I could actually just pull the audio, start, 
> and stop variables from fields in a tiddler - that would greatly increase 
> the semantics of my use of fields on tiddlers.
>
 
That works out of the box using the MacroCallWidget 
<http://tiddlywiki.com/#MacroCallWidget> and then TextReferences 
<http://tiddlywiki.com/#TextReference> or Variables 
<http://tiddlywiki.com/#Variables>:

<$macrocall $name="audio" file={{!!podcast}}/>

Best wishes,

— tb

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/46531fdc-aab9-4170-990b-eadd16c4a9b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to