Sure, once you have the auto-numbering you can use it with whatever object 
you need numbering. I used oleghbond's ref examples because they didn't 
require me to go spelunking for lightweight, copyright free images. 

The next step would be to add "namespaces" to the JS macro for captions, 
figures, references, etc. since you probably don't them share the same 
numbering base. Maybe a little later.

-- Mark

On Saturday, December 8, 2018 at 3:44:25 PM UTC-8, TonyM wrote:
>
> Mark,
>
> This is looking good as far as reference counts are concerned. However I 
> believe Mohammad wanted to show figures (Tables/Images) presumably the text 
> of the "reference tiddler".  So perhaps showref should be extended to show 
> the reference and the details (render the text field)
>
> <<showref "WS-2016" details>>
>
> This will make a nice little solution, good work.
>
> Regards
> Tony
>
> On Sunday, December 9, 2018 at 9:58:00 AM UTC+11, Mark S. wrote:
>>
>> Ideally, the way to do this would be to put the references in their own 
>> tiddlers. The problem is the auto-numbering ... since you can't know the 
>> numbering in advance. The workaround is to use a javascript macro, that can 
>> keep track of references internally.
>>
>> This is a proof of concept. It adds a JS macro, autoref.
>>
>> Parameter: tiddler
>>
>>   Tiddler to be accessed. Or, can also contain number of tiddler
>>
>> Parameter: action
>>
>>   "link" (to link a tiddler to a number) 
>>   "ref"  (to access the tiddler assigned to the number,
>>        or number assigned to the tiddler)
>>   "max" (to access the current max reference number)
>>   Default is "max".
>>
>>
>> Be sure to backup your TW before trying (or better yet, use in an empty 
>> TW file).
>>
>> This shows how the concept can work with numbered references. The idea is 
>> that the javascript tracks the auto-numbers, but everything else would be 
>> left up to your own, task-appropriate macros. The next stage would be to 
>> add code to allow multiple kinds of references (e.g. captions, figures). 
>> The sample macros here let you insert references that show as numbers 
>> (think anchors), show a tiddler description by tiddler (with number), show 
>> a tiddler description by number. The list routine uses the range operator 
>> to list all references.
>>
>> Drag and drop into your TW file, and then reload (the JS does not take 
>> effect until you reload).
>>
>> Various caveats: Please don't give your reference tiddlers names that are 
>> numbers! Resist the urge to give any of your tiddlers the name 
>> "MAS-REF-COUNTER". Note that presently the macro doesn't check if your 
>> referenced tiddlers actually exist. Not sure if this is a bug or feature.
>>
>> Have fun,
>> Mark
>>
>

-- 
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/22e6b62e-7f3f-4106-8cfb-15529e403230%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to