discuss@lists.openscad.org

OpenSCAD general discussion

View all threads

Re: Tutorial example style (was Re: Newbie with Parser Error Line 1)

JB
Jordan Brown
Wed, Apr 21, 2021 1:27 AM

Did anybody have any thought on this presentation or on the underlying
document/template structure?  Is there anybody who considers themselves
to be the lead editor on the tutorial?

On 4/17/2021 9:30 PM, Jordan Brown wrote:

On 4/17/2021 10:14 AM, Torsten Paul wrote:

On 16.04.21 02:20, Jordan Brown wrote:

Maybe move it into the title?

I like that option best, it might be useful to have a file
name that could be matched (or even linked?) against a github
repo with all the files.

Here's a structure that is in some ways convenient.

I created a template {{User:Jordan Brown/sandbox/tmpl}}.  Its simplest
invocation is

{{User:Jordan Brown/sandbox/OpenSCADExample|name=a_small_cube}}

which generates:

You can see this live at
https://en.wikibooks.org/wiki/User:Jordan_Brown/sandbox/demo .

What it does, in this simple invocation, with a name FOO, is:

So the idea is that you put this simple reference into the main
document, and you create a page FOO with the OpenSCAD program, and an
image file FOO.jpg, and the template takes care of putting them
together into the preferred form.

I also put together a slightly different template OpenSCADExample2,
that produces this, which I like a little better:

... but I'm not entirely happy with the title format.

The tricky part of this is in getting it to transclude a page
without processing any wikitext on that page, so that the FOO page
can contain precisely the OpenSCAD program, without needing any
protective markup.  The mechanism that I found, the "msgnw:" modifier,
seems to work but there are hints that there may be a few kinds of
wikitext that will still be processed.

Of course, this requires that the page containing the example, the
image, and the source file on github have the same name.  That could
be viewed as a limitation, or it could be viewed as a feature
encouraging structure.  The current implementation of the template
allows for specifying the name of the image separately, as img=BAR,
and allows specifying the content directly (instead of via another
page) as content=WHATEVER.  There could be a similar override for the
github link, but isn't yet.  The image type defaults to jpg, but can
be overridden with imgtype=XXX.

All of the details are easily changed, at least until we start using it.

Of course it would get put somewhere in the main template namespace,
not in my sandbox.

The key feature is that one template then controls the format of all
examples throughout the book.

Did anybody have any thought on this presentation or on the underlying document/template structure?  Is there anybody who considers themselves to be the lead editor on the tutorial? On 4/17/2021 9:30 PM, Jordan Brown wrote: > On 4/17/2021 10:14 AM, Torsten Paul wrote: >> On 16.04.21 02:20, Jordan Brown wrote: >>> Maybe move it into the title? >> I like that option best, it might be useful to have a file >> name that could be matched (or even linked?) against a github >> repo with all the files. > > Here's a structure that is in some ways convenient. > > I created a template {{User:Jordan Brown/sandbox/tmpl}}.  Its simplest > invocation is > > {{User:Jordan Brown/sandbox/OpenSCADExample|name=a_small_cube}} > > which generates: > > > You can see this live at > https://en.wikibooks.org/wiki/User:Jordan_Brown/sandbox/demo . > > What it does, in this simple invocation, with a name FOO, is: > > * Generates a caption with a link to > https://github.com/openscad/examples/blob/master/FOO.scad > * Inside a gold box, protected from wikitext processing, transcludes > https://en.wikibooks.org/wiki/User:Jordan_Brown/sandbox/FOO > * Brings in the image [[File:FOO.jpg]] at a size of 680px. > > So the idea is that you put this simple reference into the main > document, and you create a page FOO with the OpenSCAD program, and an > image file FOO.jpg, and the template takes care of putting them > together into the preferred form. > > I also put together a slightly different template OpenSCADExample2, > that produces this, which I like a little better: > > ... but I'm not entirely happy with the title format. > > The tricky part of this is in getting it to transclude a page > *without* processing any wikitext on that page, so that the FOO page > can contain precisely the OpenSCAD program, without needing any > protective markup.  The mechanism that I found, the "msgnw:" modifier, > seems to work but there are hints that there may be a few kinds of > wikitext that will still be processed. > > Of course, this requires that the page containing the example, the > image, and the source file on github have the same name.  That could > be viewed as a limitation, or it could be viewed as a feature > encouraging structure.  The current implementation of the template > allows for specifying the name of the image separately, as img=BAR, > and allows specifying the content directly (instead of via another > page) as content=WHATEVER.  There could be a similar override for the > github link, but isn't yet.  The image type defaults to jpg, but can > be overridden with imgtype=XXX. > > All of the details are easily changed, at least until we start using it. > > Of course it would get put somewhere in the main template namespace, > not in my sandbox. > > The key feature is that one template then controls the format of all > examples throughout the book. > >