Can the macro be in the body of an external link, like this:

[[My PDF file|<<external-document>>]]

Or, can I concatenate something to the link, like:

[[My PDF file|<<external-document>>#page=7]]



On Saturday, January 12, 2019 at 12:43:51 PM UTC-5, S. S. wrote:
>
> You will surely get some "spot on" help from others once they have time to 
> reply.
> If I have understood your requirements correctly, here is a solution just 
> off the top of my head.
>
>
>    1. Make a new tiddler, and give it this tag: $:/tags/Macro
>    2. Add a field to the tiddler and name it: *file*
>       - Give this *file* field a value of your file name. Example: 
>       *index.html*
>    3. Add another field to the tiddler - and name it: *path*
>       - Give this *path* field a default value for your path to the file 
>       - Example: *default/path/*
>    4. In the body of that tiddler copy and paste the below:
>
>
> \define external-document(file:{{!!file}} path:{{!!path}})
> \rules except wikilink
> <$wikify name="location" text="$path$$file$">
> <a href=<<location>> target="_blank">$file$</a>
> </$wikify>
> \end
>
> Save the tiddler. You have created a Global macro (a variable on steroids) 
> - which can be used as below.
>
> When you need to create the link to the external file using the default 
> path, in the body of the tiddler, type this text:
> <<external-document>>
>
> Someone else receiving this tiddler - can change the path in the *path* 
> field of the tiddler and call it the exact same way.
>
> Alternatively they can change the path by using the macro like this:
> <<external-document path:"the new path/whatever it might be/">>
>
> Note the file name also can be easily changed, both by changing it in the 
> *file* field, or by specifying it in the macro.
>
> Hope that helps for now.
>
>
> On Saturday, January 12, 2019 at 11:49:29 PM UTC+7, Jeff Wilson wrote:
>>
>> Is there any documentation that really lays out the concepts? Or, a 
>> document that takes a "task-based" approach?
>>
>> I'm getting started using TW5 and the most basic functionality is obvious 
>> to me -- I can create Tiddlers, link and 'transclude' (why use such an 
>> opaque word?) them, but doing things like arranging Tiddlers 
>> hierarchically, which seems like basic functionality, are mysterious. They 
>> seem to involve creating other Tiddlers with special names and copying a 
>> bunch of code into them.
>>
>> Here's something I'd like to do which I'm missing:
>>
>> I want to link to an external document from my Wiki in multiple Tiddlers. 
>> Depending on the user, the document may be in a different location. I'd 
>> like to create a variable or something that defines the location of the 
>> document. Each user can change the value of the variable to point to where 
>> the document lives in his filesystem.
>>
>> How would you do that?
>>
>

-- 
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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/8f3d514a-a14c-4a98-a374-f1b91cadb7e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to