Am Sonntag, 20. April 2014 15:45:35 UTC+2 schrieb Devin Weaver:
>
> I was recently working on a macro for handling the creation of links to 
> our ticket system. Instead of copy pasting the whole URL I can place the 
> ticket number in the TiddlyWiki <http://localhost:8080/#TiddlyWiki> text 
> and the macro will build the URL and 
> WikiText<http://localhost:8080/#WikiText> link 
> for me.
>
> One of the requirements was that it could grab the ticket number from a 
> tiddler's field so that if you called the macro without a ticket number it 
> would still have a sane default. For example: <<jira IOS-200>> would 
> become [[IOS-200|https://mycompany.atlassian.net/browse/IOS-200]] and if 
> I set the ticketfield to IOS-300 on a tiddler and call <<jira>> it would 
> output [[IOS-300|https://mycompany.atlassian.net/browse/IOS-300]
>
Just as a side note: This template would have done it without a macro:

\define jira(number) <a 
href="https://mycompany.atlassian.net/browse/$number$";>$number$</a>

<$list filter="[is[current]!field:ticket[]]"><$macrocall $name="jira" 
number={{!!ticket}}/></$list><$list filter="[title{!!title}is[missing]] 
[title{!!title}!has[ticket]]"><$macrocall $name="jira" 
number={{!!title}}/></$list> 

Used like this:

{{||jira}} -> if you want the ticket field to be used.
{{IOS-330||jira}} -> if you want IOS-330 to be used.

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" 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/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.

Reply via email to