Discussion:
[Textbook-l] Strange interaction between templates, noinclude, BookCat
Jordan Brown
2021-05-24 16:54:52 UTC
Permalink
[ Apologies in advance for not distilling this to a minimum example. 
I'm not sure how to do so without a bunch of edits in production pages,
and I can't immediately duplicate it in my sandbox. Since I can't figure
out how two pieces of the puzzle are interacting, I don't want to
blindly drop out something that might be related. ]

I have a template
https://en.wikibooks.org/wiki/Template:OpenSCAD_Tutorial/example that
attempts to encapsulate the layout for an example.

It's not terribly complex:

<table class="wikitable" style="border: 2px solid Gold;">
<caption style="text-align: left;">[[{{BOOKNAME}}/examples/{{{name}}}|Code&nbsp;-&nbsp;{{{name}}}.scad]]</caption>
<tr><td>
{{Pre|{{{content|{{msgnw::{{BOOKNAME}}/examples/{{{name}}}}}}}}}}
</td></tr>
</table>
[[File:{{{name}}}.{{{imgtype|jpg}}}|{{{size|680px}}}]]
<noinclude>{{BookCat}}</noinclude>

The intent is that it's invoked like so:

{{OpenSCAD Tutorial/example|name=a_small_cube}}

to suck in example source text and an example image from separate pages.

It can also be invoked as:

{{OpenSCAD Tutorial/example|name=a_small_cube|content=
cube(10);
}}

to specify the source text in-line.[*]

[*] Yes, I know the header still tries to link to the separate
page.  It's still a work in progress.

When I first put it together with the separate-page style, everything
seemed OK.  Then somebody wrapped the {{BookCat}} in <noinclude>, and
"{{BookCat}}" started appearing on the final pages.  I'm not completely
sure how <noinclude> works, but OK, I can believe that.  I started a
conversation with the other editor about why they added the <noinclude>.

Meanwhile, other editors had commented that the
example-in-a-separate-page scheme would be unwieldy.  OK, so I went to
back off to the content= style.

And the BookCat problem went away.  The BookCat problem is there for the
example-in-separate-page invocation, but not for the in-line invocation.

You can see this at
https://en.wikibooks.org/w/index.php?title=OpenSCAD_Tutorial/Chapter_1&oldid=3838669
.  The first example (a_small_cube) uses the in-line style and does not
show {{BookCat}}.  The second example
(a_cube_with_different_side_lengths) uses the separate-page style and
shows the {{BookCat}}.

I can't see how those two things can possibly be tied together.

_______________________________________________
Textbook-l mailing list -- textbook-***@lists.wikimedia.org
To unsubscribe send an email to tex

Loading...