I’m trying to put together a basic bibliography section to cite my sources but I’d like to be able to create a field for each source that links to a source wiki page. I would also like to name each field ‘source-1’, ‘source-2’, …, ‘source-n’, so I can keep them organized.
If there is a better way to do this, please let me know!
I’ve tried two different ways to do this while extracting the number (n) from ‘source-n’ but for each method, I get stuck.
Method 1:
<$list filter="[<currentTiddler>fields[]prefix[source-]split[source-]!is[blank]]" variable="num">
<$vars source="source-<<num>>">
<$vars s={{{ [<currentTiddler>get<source>] }}}>
<span class="source">[<<num>>]: <$link to=<<s>> /></span><br />
</$vars>
</$vars>
</$list>
This fails as <<s>>
doesn’t actually contain any data (even though <<source>>
outputs “source-1”), however if I replace
<$vars source=“source-
<<num>>
”>
with
<$vars source=“source-1”>
I can get the appropriate link but only to the source entered into the field ‘source-1’ (as it’s hard-coded in).
So, my question here would be: how can I create the variable <<s>>
dynamically from <<num>>
?
Method 2 (basically the inverse of Method 1):
<$list filter="[<currentTiddler>fields[]prefix[source-]]" variable="source">
<$vars s={{{ [<currentTiddler>get<source>]}}}>
<span class="source">[<<source>>]: <$link to=<<s>> /></span><br />
</$vars>
</$list>
This works great but how can I extract out the source number and place it into the <span>
(currently the span shows [source-1]…, [source-2]… etc. and I want it to show [1], [2], etc.
Thank you for any help or if you know a much better way to build a bibliography.