Something I had tossed aside until I fine-tuned the "include" metacommand
in BASIC Anywhere Machine.
("include" is a macro that transcludes the BASIC code of one tiddler into
the BASIC code of another tiddler.
I can't see me setting up some kind of process to skip transclusion of an
already transcluded tiddler. I figure the simple approach is to provide
the ability to see the transclusion hierarchy and identify problems that
way when the BASIC interpreter complains about duplicate code.
In the image below, the Amazing Grace tiddler includes the Hz#(note$)
tiddler. I've created some extra tiddlers to test things out. Hz#(note$)
includes both "howdy" and "huh?", and "howdy" includes both "howdy two" and
"huh?"
A red line with yellow highlight indicates a problem. The content of
"huh?" will get transcluded twice into Amazing Grace (once via
"Hz#(note$)", and once via "howdy". The interpreter will give an error at
runtime about duplicate functions, variables, or whatever is in "huh?"
[image: Screenshot 2022-08-20 1.34.07 AM.png]
Here's the updated code that generates the graph:
```
<$let this_mode =
"""get[text]search-replace:g:regexp[\n],[CRLF]split[CRLF]regexp[\<\<include]search-replace:g:regexp[\<\<include\s+"],[]search-replace:g:regexp["\>\>],[]""">
<$tidgraph start="Amazing Grace" mode=<<this_mode>> layout="S"/>
</$let>
```
On Wednesday, June 8, 2022 at 8:34:45 PM UTC-3 Charlie Veniot wrote:
> And, for anybody interested:
>
> `
> <$tidgraph nocollapse start="Main Tiddler"
> mode="get[text]search-replace:g:regexp[\n],[NNNN]split[NNNN]regexp[include]search-replace:g[(include
>
> ],[]search-replace:g[)],[]search-replace:g[Main Tiddler],[CIRCULAR
> REFERENCE !!!]">
> `
>
> On Wednesday, June 8, 2022 at 8:32:36 PM UTC-3 Charlie Veniot wrote:
>
>> *If there is a plugin or a macro that can already do what I'm trying to
>> do here with Tidgraph, please let me know!*
>>
>> Just recently, I've setup BASIC Anywhere Machine with an include
>> directive.
>>
>> (i.e. the ability for a BASIC program to transclude BASIC code from
>> another tiddler.)
>>
>> I've since been thinking about how to set something up to eliminate the
>> possibility of unintentionally transcluding the same tiddler more than once
>> (say two tiddlers being included into my BASIC program each transclude a
>> common tiddler.)
>>
>> Not a problem that would normally matter in TiddlyWiki (content
>> duplication), but it is the kind of thing that will cause an error in a
>> BASIC program if, say, a same function/subroutine/variable/constant is
>> duplicated.
>>
>> As I chew on how to automagically eliminate duplicate transclusions, I
>> have at least a prototype of viewing such a problem when one exists.
>>
>> With Tidgraph, a sample:
>> [image: Screenshot 2022-06-08 8.25.58 PM.png]
>>
>> *Main Tiddler's text body has:*
>> (include A)
>> (include B)
>>
>> *Both tiddlers A and B have:*
>> (include C)
>>
>> *Tiddler C has:*
>> (include Main Tiddler)
>> (include D)
>>
>> *Tiddler D has:*
>> (include A)
>>
>> In the graph, the red line from tiddler B to C let's me know that C is
>> twice involved in the transclusion tree. The "CIRCULAR REFERENCE!!!" let's
>> me know that C is transcluding "Main Tiddler". The red line between D and
>> A (with arrow pointing to A) let's me know that A is twice involved in the
>> transclusion tree (and in this case is a circular reference too).
>>
>> Again, if anybody knows of another way to get this information (graph or
>> text-only, either are A-1), please let me know!
>>
>>
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/57d2b7e3-e205-48f2-816f-9764c0f18dfbn%40googlegroups.com.