WebIncludes

This page contains snippets of TWiki markup that are included by other pages in assorted project sub-webs.

Note: Although it took a bit of digging to find out about it, TWiki INCLUDEs work quite nicely as macros. Basically, any named include argument (eg, foo="123") that doesn't match a predefined parameter can be used (eg, ...%foo%...) in the body of the include.

These includes generate links for Amazon pages for books, based on ISBN. Full disclosure: the links incorporate Rich's Amazon Associates tag!

Examples:

%INCLUDE{"WebIncludes"  section="bl_amz"  imprint="O'Reilly"  isbn="0596516177"
  author="David Flanagan & Yukihiro Matsumoto"
  title="The Ruby Programming Language"}%

%INCLUDE{"WebIncludes"  section="bl_amz"  imprint="O'Reilly"  isbn="0596516177"
  author="David Flanagan & Yukihiro Matsumoto"
  title="The Ruby Programming Language"
  notes="This book is definitive!"}%

Definition:

%STARTSECTION{"bl_amz"}%
   * [[http://www.amazon.com/dp/%isbn%/?tag=assorted0a-20][%title%]];<br>
     %author%; %imprint%
     %IF{ "defined notes" then="<p>%notes%" }%
%ENDSECTION{"bl_amz"}%

%INCLUDE{"WebIncludes"  section="bl_prc"
  author="David A. Black"  title="Rails Routing"}%

%INCLUDE{"WebIncludes"  section="bl_prc"
  author="David A. Black"  title="Rails Routing"
  notes="David Black rocks!"}%

Definition:

%STARTSECTION{"bl_prc"}%
   * "%title%";<br>
     %author%, in [[http://www.amazon.com/dp/0132417995/?tag=assorted0a-20]
*~~  [Professional Ruby Collection]];
     Addison-Wesley
     %IF{ "defined notes" then="<p>%notes%"}%
%ENDSECTION{"bl_prc"}%

Twisty Code (tc_*)

These includes are used to hide/show code sections. They were written for the Ruby_Parse_Trees page.

Example:

 
$ irb --simple-prompt
>> %w{rubygems parse_tree pp}.each {|i| require i }
=> ["rubygems", "parse_tree"]

%TCb%
$ irb --simple-prompt
>> %w{rubygems parse_tree pp}.each {|i| require i }
=> ["rubygems", "parse_tree"]
%TCe%

Definition:

%STARTSECTION{"tc_beg"}%
%TWISTY{mode="div"
  showlink="<tt>show code</tt>"
  hidelink="<tt>hide code</tt>"
  showimgleft="%ICONURLPATH{toggleopen-small}%" 
  hideimgleft="%ICONURLPATH{toggleclose-small}%"
}% <pre> %ENDSECTION{"tc_beg"}%

%STARTSECTION{"tc_end"}%
</pre> %ENDTWISTY% %ENDSECTION{"tc_end"}%

Twisty Tables (tt_*)

These includes are used to hide/show database table descriptions. They were written for the MySQL page.

Example:

mysql> describe schema_info; 
+---------+---------+------+-----+---------+-------+
| Field   | Type    | Null | Key | Default | Extra |
+---------+---------+------+-----+---------+-------+
| version | int(11) | YES  |     | NULL    |       | 
+---------+---------+------+-----+---------+-------+

%INCLUDE{"WebIncludes" section="tt_beg" NAME="schema_info"}%
+---------+---------+------+-----+---------+-------+
| Field   | Type    | Null | Key | Default | Extra |
+---------+---------+------+-----+---------+-------+
| version | int(11) | YES  |     | NULL    |       | 
+---------+---------+------+-----+---------+-------+
%INCLUDE{"WebIncludes" section="tt_end"}%

Definition:

%STARTSECTION{"tt_beg"}%
%TWISTY{mode="div"
  showlink="<tt>%NAME%</tt>"
  hidelink="<tt>%NAME%</tt>"
  showimgleft="%ICONURLPATH{toggleopen-small}%" 
  hideimgleft="%ICONURLPATH{toggleclose-small}%"
}% <pre>
mysql> describe %NAME%; %ENDSECTION{"tt_beg"}%

%STARTSECTION{"tt_end"}%
</pre> %ENDTWISTY% %ENDSECTION{"tt_end"}%

Ze Bottom

This include is actually used in a rather peculiar manner. At the bottom of SitePreferences, there is a definition for ZB:

%INCLUDE{"Projects/WebIncludes" section="zb" web="%INCLUDINGWEB%" topic="%INCLUDINGTOPIC%"}%

This TWiki Variable (ie, %ZB%) is used at the bottom of pages in Rich's "Projects" sub-webs. TWiki expands %ZB% into the %INCLUDE{...}% call, then processes the include. Along the way, however, TWiki picks up the current page's values for %WEB% and %TOPIC%. So, as each page is being rendered, it gets the current values:

Example:


This wiki page is maintained by Rich Morin, an independent consultant specializing in software design, development, and documentation. Please feel free to email comments, inquiries, suggestions, etc!

%ZB%

Definition:

%STARTSECTION{"zb"}%
-------------
This wiki page is maintained by [[http://www.cfcl.com/rdm][Rich Morin]],
an independent consultant specializing in software design, development, and documentation.
Please feel free to <a href="mailto:rdm@cfcl.com?subject=comment%20on%20%web%/%topic%">email</a>
comments, inquiries, suggestions, etc!  

<!--
Ancestry: %<nop>BREADCRUMBS{"%web%.%topic%"}%
%<nop>METASEARCH{type="parent" web="%web%" topic="%topic%" title="Children: "}%
-->
</noautolink>
%ENDSECTION{"zb"}%

Topic revision: r15 - 07 Sep 2015, RichMorin
This site is powered by Foswiki Copyright © by the contributing authors. All material on this wiki is the property of the contributing authors.
Foswiki version v2.1.6, Release Foswiki-2.1.6, Plugin API version 2.4
Ideas, requests, problems regarding CFCL Wiki? Send us email