> But as something with a more general usage pattern, I'd like to have a
> hidden/not-rendered section in which to plunk the table values, (e.g.
> in tab separated values format), and have TW generate the visible
> memorizable table from that data, (when the user accepts an edit of
> the tiddler).
>
> Would sections give me access to the TSV's?
You can enclose a section definition within TW comment markers, like
this:
/%
!SectionName
1,2,3,4...
5,6,7,8...
etc.
!end SectionName
%/
Although the section content will not be rendered (because it is
inside a comment), it *is* still available for use in a section
reference from another tiddler. The trailing "!end..." syntax ensures
that the closing comment marker is not included as part of the section
content.
Note that, because the entire section is enclosed in a comment, you
cannot also use TW comments within the section content itself (because
the comment syntax does not 'nest').
As an alternative approach, you could *hide* the section definition by
wrapping it in some CSS, like this:
@@display:none;
!SectionName
content
!end SectionName
@@
OR
{{hidden{
!SectionName
content
!end SectionName
}}}
(where 'hidden' is a custom CSS class... see
TiddlyTools#StyleSheetShortcuts)
However, unlike comment-wrapped section definitions, hidden sections
are still *rendered*, even though they are not visible. This might
increase the display overhead when viewing that tiddler, but shouldn't
normally cause any problems, unless the hidden section content invokes
some macros that produce side effects.
Once you have defined a commented/hidden section, you can, of course,
display that content by transcluding it using <<tiddler
TiddlerName##SectionName>>. Because the surrounding comment markers
(or CSS syntax) are *not* part of the section content itself, the
content renders as normal when transcluded, even though it is
commented/hidden in the 'source' tiddler that defines it.
For your specific purposes, where the section content is just TSV (tab-
separated values) data, simple transclusion is obviously not
sufficient. You will also need some code that reads the TSV data and
converts that content into a TW table (by replacing the tabs with "|"
and the newlines with "|\n|"). To do this, you can use
InlineJavascriptPlugin to write a script like this:
<script>
var out=store.getTiddlerText("TiddlerName##SectionName"); if (!out)
return;
out=out.replace(/\t/g,"|");
out=out.split("\n").join("|\n|");
out="|"+out+"|\n";
return out;
</script>
The result is that input like this:
1,2,3
4,5,6
7,8
becomes
|1|2|3|
|4|5|6|
|7|8|
(i.e., a TW table... QED)
Note: you can write the above even more compactly:
<script>
var out=store.getTiddlerText("TiddlerName##SectionName"); if (!out)
return;
return "|"+out.replace(/\t/g,"|").split("\n").join("|\n|")+"|\n";
</script>
enjoy,