Procedure works properly in tiddler but sometime fails when tiddler is transcluded

I have a head-scratcher.

I have three simple procedures to create links to other tiddlers in my wiki. They work all of the time when used simply in a tiddler. But in two cases, they fail when that tiddler is transcluded in another.

You can see what I’m talking about here in Andover Charter - 2022 Version. Sections 203A and 304B (which should open using that link, along with Charter) properly show links to (not-yet created) tiddlers. These are generated by three procedures in $:/_/atc/procedures/Section. But when those tiddlers are transcluded in another tiddler (you can see it in Charter, but also in Section 203 and Section 304, as well as in Chapter 2 and Chapter 3/), they get no link, just the plain text of the parameter (“203A” and “304B”).

There are several levels of transclusion going on, but it fails at the first one, which is handled by $:/_/atc/procedures/subsections, which looks like this:

\procedure subsections(parent)
<$list filter="[tag[Subsection]section<parent>!has[draft.of]]" >
  <$let 
    section={{{ [{!!section}] [{!!subsection}] +[join[]] }}} 
    currentTiddler={{{ [<section>addprefix[Section]] }}}
  > 
    <div class="subsection">
      <div class="ss-name"><$link>{{!!subsection}}. </$link></div>
      <div class="ss-body"><$transclude mode="block"/></div>
    </div>
  </$let>
</$list>
\end

It’s the same procedure which is failing in both cases. I don’t know if that’s coincidence, as it looks just like the other two:

\procedure section(sect) <$link to={{{ [[Section]] [<sect>] +[join[]] }}} >section <<sect>></$link>

This is an annoyance more than a show-stopper. I can just skip the procedure and hard-code the links. But it is annoying, and I’m hoping someone here can see what I’ve been blind too.

So, … any ideas?

1 Like

“Section 203A”, uses a macro, <<section 1012>>.

“Section 203”, uses <<subsections 203>>.

BUT… the subsections() macro uses sections as a LOCAL VARIABLE, thereby overriding the <<section>> macro that is used in the transcluded subsection 203A.

Try changing this:

<$let 
  section={{{ [{!!section}] [{!!subsection}] +[join[]] }}} 
  currentTiddler={{{ [<section>addprefix[Section]] }}}
> 

to

<$let currentTiddler={{{ [[Section]] [{!!section}] [{!!subsection}] +[join[]] }}}> 

This will avoid re-defining the <<section>> macro.

let me know how it goes…

-e

<$list filter="[tag[Subsection]section<parent>!has[draft.of]]">
  <$let 
    sectionTitle={{{ [{!!section}] [{!!subsection}] +[join[]] }}}
    subsectionTitle={{{ [<sectionTitle>addprefix[Section]] }}}
  > 
    <div class="subsection">
      <div class="ss-name">
        <$link to={{{ [<subsectionTitle>] }}}>
          {{{ [{!!subsection}] }}}
        </$link>.
      </div>
      <div class="ss-body">
        <$transclude 
          tiddler={{{ [<subsectionTitle>] }}}
          mode="block"
        />
      </div>
    </div>
  </$let>
</$list>
\end

quick test seems to work for me


Interesting set of procedures, by the way, I may have use for it in my wiki after I give it some thought.

I assumed that it was something like this. But I swear I checked everything! Thank you, as always!

This is fixed in https://charter2022.andoverct.info/0.4.0/. (You can use CTRL-SHIFT-/ to get out of read-only mode.)

Yes, that’s much the same fix Eric shared, and I really can’t believe I didn’t see it. Thank you very much for your help.

I think they’re going to be useful for fixed-depth outline wikis. There’s some annoying redundancy in this:

title: Section203C(2)
tags: Sub-subsection
caption: Section 203C(2)
chapter: 2
section: 203
sub-subsection: 2
subsection: C

A Board of Assessment Appeals, consisting of three (3) members which shall serve
four (4) year terms;

All the other fields are derivable from either the title or the caption. It would be interesting to try to rebuild those procedures on top of, say, just the title. And I may get there at some point. This wiki is a warm-up for creating another similar one based on the charter changes the town voted on this week. An earlier version was in my discussion about the proposed changes. But that one did not have nice permalink URLs, and it was based on an abstraction that I’ve decided against this time – putting multiple charter versions in one document.

Still, I think it’s coming out well. As soon as I finish the content, I need to figure out a TOC. I don’t think I want to use the built-in one, because I don’t want that proliferation of tags. And I believe both Eric’s and Mario’s alternatives are closer but not quite what I want, although I’ll probably try them. But this is to be a static site in the end, so I may just make a custom one for this.

If you do use them and find any improvements, please do share!

1 Like