Achille, la tartaruga e la serie geometrica - Dal paradosso di Zeno alla somma della serie geometrica
<!--{{{-->
<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml'/>
<!--}}}-->
Background: #fff
Foreground: #000
PrimaryPale: #8cf
PrimaryLight: #18f
PrimaryMid: #04b
PrimaryDark: #014
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
/*{{{*/
body {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}

a {color:[[ColorPalette::PrimaryMid]];}
a:hover {background-color:[[ColorPalette::PrimaryMid]]; color:[[ColorPalette::Background]];}
a img {border:0;}

h1,h2,h3,h4,h5,h6 {color:[[ColorPalette::SecondaryDark]]; background:transparent;}
h1 {border-bottom:2px solid [[ColorPalette::TertiaryLight]];}
h2,h3 {border-bottom:1px solid [[ColorPalette::TertiaryLight]];}

.button {color:[[ColorPalette::PrimaryDark]]; border:1px solid [[ColorPalette::Background]];}
.button:hover {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::SecondaryLight]]; border-color:[[ColorPalette::SecondaryMid]];}
.button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::SecondaryDark]];}

.header {background:[[ColorPalette::PrimaryMid]];}
.headerShadow {color:[[ColorPalette::Foreground]];}
.headerShadow a {font-weight:normal; color:[[ColorPalette::Foreground]];}
.headerForeground {color:[[ColorPalette::Background]];}
.headerForeground a {font-weight:normal; color:[[ColorPalette::PrimaryPale]];}

.tabSelected{color:[[ColorPalette::PrimaryDark]];
	background:[[ColorPalette::TertiaryPale]];
	border-left:1px solid [[ColorPalette::TertiaryLight]];
	border-top:1px solid [[ColorPalette::TertiaryLight]];
	border-right:1px solid [[ColorPalette::TertiaryLight]];
}
.tabUnselected {color:[[ColorPalette::Background]]; background:[[ColorPalette::TertiaryMid]];}
.tabContents {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::TertiaryPale]]; border:1px solid [[ColorPalette::TertiaryLight]];}
.tabContents .button {border:0;}

#sidebar {}
#sidebarOptions input {border:1px solid [[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel {background:[[ColorPalette::PrimaryPale]];}
#sidebarOptions .sliderPanel a {border:none;color:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:hover {color:[[ColorPalette::Background]]; background:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:active {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::Background]];}

.wizard {background:[[ColorPalette::PrimaryPale]]; border:1px solid [[ColorPalette::PrimaryMid]];}
.wizard h1 {color:[[ColorPalette::PrimaryDark]]; border:none;}
.wizard h2 {color:[[ColorPalette::Foreground]]; border:none;}
.wizardStep {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];
	border:1px solid [[ColorPalette::PrimaryMid]];}
.wizardStep.wizardStepDone {background:[[ColorPalette::TertiaryLight]];}
.wizardFooter {background:[[ColorPalette::PrimaryPale]];}
.wizardFooter .status {background:[[ColorPalette::PrimaryDark]]; color:[[ColorPalette::Background]];}
.wizard .button {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryLight]]; border: 1px solid;
	border-color:[[ColorPalette::SecondaryPale]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryPale]];}
.wizard .button:hover {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Background]];}
.wizard .button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::Foreground]]; border: 1px solid;
	border-color:[[ColorPalette::PrimaryDark]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryDark]];}

#messageArea {border:1px solid [[ColorPalette::SecondaryMid]]; background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]];}
#messageArea .button {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::SecondaryPale]]; border:none;}

.popupTiddler {background:[[ColorPalette::TertiaryPale]]; border:2px solid [[ColorPalette::TertiaryMid]];}

.popup {background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]]; border-left:1px solid [[ColorPalette::TertiaryMid]]; border-top:1px solid [[ColorPalette::TertiaryMid]]; border-right:2px solid [[ColorPalette::TertiaryDark]]; border-bottom:2px solid [[ColorPalette::TertiaryDark]];}
.popup hr {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::PrimaryDark]]; border-bottom:1px;}
.popup li.disabled {color:[[ColorPalette::TertiaryMid]];}
.popup li a, .popup li a:visited {color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:active {background:[[ColorPalette::SecondaryPale]]; color:[[ColorPalette::Foreground]]; border: none;}
.popupHighlight {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
.listBreak div {border-bottom:1px solid [[ColorPalette::TertiaryDark]];}

.tiddler .defaultCommand {font-weight:bold;}

.shadow .title {color:[[ColorPalette::TertiaryDark]];}

.title {color:[[ColorPalette::SecondaryDark]];}
.subtitle {color:[[ColorPalette::TertiaryDark]];}

.toolbar {color:[[ColorPalette::PrimaryMid]];}
.toolbar a {color:[[ColorPalette::TertiaryLight]];}
.selected .toolbar a {color:[[ColorPalette::TertiaryMid]];}
.selected .toolbar a:hover {color:[[ColorPalette::Foreground]];}

.tagging, .tagged {border:1px solid [[ColorPalette::TertiaryPale]]; background-color:[[ColorPalette::TertiaryPale]];}
.selected .tagging, .selected .tagged {background-color:[[ColorPalette::TertiaryLight]]; border:1px solid [[ColorPalette::TertiaryMid]];}
.tagging .listTitle, .tagged .listTitle {color:[[ColorPalette::PrimaryDark]];}
.tagging .button, .tagged .button {border:none;}

.footer {color:[[ColorPalette::TertiaryLight]];}
.selected .footer {color:[[ColorPalette::TertiaryMid]];}

.sparkline {background:[[ColorPalette::PrimaryPale]]; border:0;}
.sparktick {background:[[ColorPalette::PrimaryDark]];}

.error, .errorButton {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Error]];}
.warning {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryPale]];}
.lowlight {background:[[ColorPalette::TertiaryLight]];}

.zoomer {background:none; color:[[ColorPalette::TertiaryMid]]; border:3px solid [[ColorPalette::TertiaryMid]];}

.imageLink, #displayArea .imageLink {background:transparent;}

.annotation {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border:2px solid [[ColorPalette::SecondaryMid]];}

.viewer .listTitle {list-style-type:none; margin-left:-2em;}
.viewer .button {border:1px solid [[ColorPalette::SecondaryMid]];}
.viewer blockquote {border-left:3px solid [[ColorPalette::TertiaryDark]];}

.viewer table, table.twtable {border:2px solid [[ColorPalette::TertiaryDark]];}
.viewer th, .viewer thead td, .twtable th, .twtable thead td {background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::Background]];}
.viewer td, .viewer tr, .twtable td, .twtable tr {border:1px solid [[ColorPalette::TertiaryDark]];}

.viewer pre {border:1px solid [[ColorPalette::SecondaryLight]]; background:[[ColorPalette::SecondaryPale]];}
.viewer code {color:[[ColorPalette::SecondaryDark]];}
.viewer hr {border:0; border-top:dashed 1px [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::TertiaryDark]];}

.highlight, .marked {background:[[ColorPalette::SecondaryLight]];}

.editor input {border:1px solid [[ColorPalette::PrimaryMid]];}
.editor textarea {border:1px solid [[ColorPalette::PrimaryMid]]; width:100%;}
.editorFooter {color:[[ColorPalette::TertiaryMid]];}

#backstageArea {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::TertiaryMid]];}
#backstageArea a {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstageArea a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; }
#backstageArea a.backstageSelTab {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
#backstageButton a {background:none; color:[[ColorPalette::Background]]; border:none;}
#backstageButton a:hover {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstagePanel {background:[[ColorPalette::Background]]; border-color: [[ColorPalette::Background]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]];}
.backstagePanelFooter .button {border:none; color:[[ColorPalette::Background]];}
.backstagePanelFooter .button:hover {color:[[ColorPalette::Foreground]];}
#backstageCloak {background:[[ColorPalette::Foreground]]; opacity:0.6; filter:'alpha(opacity:60)';}
/*}}}*/
/*{{{*/
* html .tiddler {height:1%;}

body {font-size:.75em; font-family:arial,helvetica; margin:0; padding:0;}

h1,h2,h3,h4,h5,h6 {font-weight:bold; text-decoration:none;}
h1,h2,h3 {padding-bottom:1px; margin-top:1.2em;margin-bottom:0.3em;}
h4,h5,h6 {margin-top:1em;}
h1 {font-size:1.35em;}
h2 {font-size:1.25em;}
h3 {font-size:1.1em;}
h4 {font-size:1em;}
h5 {font-size:.9em;}

hr {height:1px;}

a {text-decoration:none;}

dt {font-weight:bold;}

ol {list-style-type:decimal;}
ol ol {list-style-type:lower-alpha;}
ol ol ol {list-style-type:lower-roman;}
ol ol ol ol {list-style-type:decimal;}
ol ol ol ol ol {list-style-type:lower-alpha;}
ol ol ol ol ol ol {list-style-type:lower-roman;}
ol ol ol ol ol ol ol {list-style-type:decimal;}

.txtOptionInput {width:11em;}

#contentWrapper .chkOptionInput {border:0;}

.externalLink {text-decoration:underline;}

.indent {margin-left:3em;}
.outdent {margin-left:3em; text-indent:-3em;}
code.escaped {white-space:nowrap;}

.tiddlyLinkExisting {font-weight:bold;}
.tiddlyLinkNonExisting {font-style:italic;}

/* the 'a' is required for IE, otherwise it renders the whole tiddler in bold */
a.tiddlyLinkNonExisting.shadow {font-weight:bold;}

#mainMenu .tiddlyLinkExisting,
	#mainMenu .tiddlyLinkNonExisting,
	#sidebarTabs .tiddlyLinkNonExisting {font-weight:normal; font-style:normal;}
#sidebarTabs .tiddlyLinkExisting {font-weight:bold; font-style:normal;}

.header {position:relative;}
.header a:hover {background:transparent;}
.headerShadow {position:relative; padding:4.5em 0em 1em 1em; left:-1px; top:-1px;}
.headerForeground {position:absolute; padding:4.5em 0em 1em 1em; left:0px; top:0px;}

.siteTitle {font-size:3em;}
.siteSubtitle {font-size:1.2em;}

#mainMenu {position:absolute; left:0; width:10em; text-align:right; line-height:1.6em; padding:1.5em 0.5em 0.5em 0.5em; font-size:1.1em;}

#sidebar {position:absolute; right:3px; width:16em; font-size:.9em;}
#sidebarOptions {padding-top:0.3em;}
#sidebarOptions a {margin:0em 0.2em; padding:0.2em 0.3em; display:block;}
#sidebarOptions input {margin:0.4em 0.5em;}
#sidebarOptions .sliderPanel {margin-left:1em; padding:0.5em; font-size:.85em;}
#sidebarOptions .sliderPanel a {font-weight:bold; display:inline; padding:0;}
#sidebarOptions .sliderPanel input {margin:0 0 .3em 0;}
#sidebarTabs .tabContents {width:15em; overflow:hidden;}

.wizard {padding:0.1em 1em 0em 2em;}
.wizard h1 {font-size:2em; font-weight:bold; background:none; padding:0em 0em 0em 0em; margin:0.4em 0em 0.2em 0em;}
.wizard h2 {font-size:1.2em; font-weight:bold; background:none; padding:0em 0em 0em 0em; margin:0.4em 0em 0.2em 0em;}
.wizardStep {padding:1em 1em 1em 1em;}
.wizard .button {margin:0.5em 0em 0em 0em; font-size:1.2em;}
.wizardFooter {padding:0.8em 0.4em 0.8em 0em;}
.wizardFooter .status {padding:0em 0.4em 0em 0.4em; margin-left:1em;}
.wizard .button {padding:0.1em 0.2em 0.1em 0.2em;}

#messageArea {position:fixed; top:2em; right:0em; margin:0.5em; padding:0.5em; z-index:2000; _position:absolute;}
.messageToolbar {display:block; text-align:right; padding:0.2em 0.2em 0.2em 0.2em;}
#messageArea a {text-decoration:underline;}

.tiddlerPopupButton {padding:0.2em 0.2em 0.2em 0.2em;}
.popupTiddler {position: absolute; z-index:300; padding:1em 1em 1em 1em; margin:0;}

.popup {position:absolute; z-index:300; font-size:.9em; padding:0; list-style:none; margin:0;}
.popup .popupMessage {padding:0.4em;}
.popup hr {display:block; height:1px; width:auto; padding:0; margin:0.2em 0em;}
.popup li.disabled {padding:0.4em;}
.popup li a {display:block; padding:0.4em; font-weight:normal; cursor:pointer;}
.listBreak {font-size:1px; line-height:1px;}
.listBreak div {margin:2px 0;}

.tabset {padding:1em 0em 0em 0.5em;}
.tab {margin:0em 0em 0em 0.25em; padding:2px;}
.tabContents {padding:0.5em;}
.tabContents ul, .tabContents ol {margin:0; padding:0;}
.txtMainTab .tabContents li {list-style:none;}
.tabContents li.listLink { margin-left:.75em;}

#contentWrapper {display:block;}
#splashScreen {display:none;}

#displayArea {margin:1em 17em 0em 14em;}

.toolbar {text-align:right; font-size:.9em;}

.tiddler {padding:1em 1em 0em 1em;}

.missing .viewer,.missing .title {font-style:italic;}

.title {font-size:1.6em; font-weight:bold;}

.missing .subtitle {display:none;}
.subtitle {font-size:1.1em;}

.tiddler .button {padding:0.2em 0.4em;}

.tagging {margin:0.5em 0.5em 0.5em 0; float:left; display:none;}
.isTag .tagging {display:block;}
.tagged {margin:0.5em; float:right;}
.tagging, .tagged {font-size:0.9em; padding:0.25em;}
.tagging ul, .tagged ul {list-style:none; margin:0.25em; padding:0;}
.tagClear {clear:both;}

.footer {font-size:.9em;}
.footer li {display:inline;}

.annotation {padding:0.5em; margin:0.5em;}

* html .viewer pre {width:99%; padding:0 0 1em 0;}
.viewer {line-height:1.4em; padding-top:0.5em;}
.viewer .button {margin:0em 0.25em; padding:0em 0.25em;}
.viewer blockquote {line-height:1.5em; padding-left:0.8em;margin-left:2.5em;}
.viewer ul, .viewer ol {margin-left:0.5em; padding-left:1.5em;}

.viewer table, table.twtable {border-collapse:collapse; margin:0.8em 1.0em;}
.viewer th, .viewer td, .viewer tr,.viewer caption,.twtable th, .twtable td, .twtable tr,.twtable caption {padding:3px;}
table.listView {font-size:0.85em; margin:0.8em 1.0em;}
table.listView th, table.listView td, table.listView tr {padding:0px 3px 0px 3px;}

.viewer pre {padding:0.5em; margin-left:0.5em; font-size:1.2em; line-height:1.4em; overflow:auto;}
.viewer code {font-size:1.2em; line-height:1.4em;}

.editor {font-size:1.1em;}
.editor input, .editor textarea {display:block; width:100%; font:inherit;}
.editorFooter {padding:0.25em 0em; font-size:.9em;}
.editorFooter .button {padding-top:0px; padding-bottom:0px;}

.fieldsetFix {border:0; padding:0; margin:1px 0px 1px 0px;}

.sparkline {line-height:1em;}
.sparktick {outline:0;}

.zoomer {font-size:1.1em; position:absolute; overflow:hidden;}
.zoomer div {padding:1em;}

* html #backstage {width:99%;}
* html #backstageArea {width:99%;}
#backstageArea {display:none; position:relative; overflow: hidden; z-index:150; padding:0.3em 0.5em 0.3em 0.5em;}
#backstageToolbar {position:relative;}
#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em 0.3em 0.5em;}
#backstageButton {display:none; position:absolute; z-index:175; top:0em; right:0em;}
#backstageButton a {padding:0.1em 0.4em 0.1em 0.4em; margin:0.1em 0.1em 0.1em 0.1em;}
#backstage {position:relative; width:100%; z-index:50;}
#backstagePanel {display:none; z-index:100; position:absolute; margin:0em 3em 0em 3em; padding:1em 1em 1em 1em;}
.backstagePanelFooter {padding-top:0.2em; float:right;}
.backstagePanelFooter a {padding:0.2em 0.4em 0.2em 0.4em;}
#backstageCloak {display:none; z-index:20; position:absolute; width:100%; height:100px;}

.whenBackstage {display:none;}
.backstageVisible .whenBackstage {display:block;}
/*}}}*/
/***
StyleSheet for use when a translation requires any css style changes.
This StyleSheet can be used directly by languages such as Chinese, Japanese and Korean which need larger font sizes.
***/
/*{{{*/
body {font-size:0.8em;}
#sidebarOptions {font-size:1.05em;}
#sidebarOptions a {font-style:normal;}
#sidebarOptions .sliderPanel {font-size:0.95em;}
.subtitle {font-size:0.8em;}
.viewer table.listView {font-size:0.95em;}
/*}}}*/
/*{{{*/
@media print {
#mainMenu, #sidebar, #messageArea, .toolbar, #backstageButton, #backstageArea {display: none ! important;}
#displayArea {margin: 1em 1em 0em 1em;}
/* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */
noscript {display:none;}
}
/*}}}*/
<!--{{{-->
<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' macro='toolbar closeTiddler closeOthers +editTiddler > fields syncing permalink references jump'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date'></span>)</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' macro='toolbar +saveTiddler -cancelTiddler deleteTiddler'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser'></span></div>
<!--}}}-->
To get started with this blank TiddlyWiki, you'll need to modify the following tiddlers:
* SiteTitle & SiteSubtitle: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)
* MainMenu: The menu (usually on the left)
* DefaultTiddlers: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened
You'll also need to enter your username for signing your edits: <<option txtUserName>>
These InterfaceOptions for customising TiddlyWiki are saved in your browser

Your username for signing your edits. Write it as a WikiWord (eg JoeBloggs)

<<option txtUserName>>
<<option chkSaveBackups>> SaveBackups
<<option chkAutoSave>> AutoSave
<<option chkRegExpSearch>> RegExpSearch
<<option chkCaseSensitiveSearch>> CaseSensitiveSearch
<<option chkAnimate>> EnableAnimations

----
Also see AdvancedOptions
<<importTiddlers>>
|''Type:''|file|
|''URL:''|http://tiddlyvault.tiddlyspot.com/|
|''Workspace:''|(default)|

This tiddler was automatically created to record the details of this server
/***
|''Name:''|ASCIIsvgPlugin|
|''Description:''|Mathematical vector graphics based on [[ASCIIsvg|http://www1.chapman.edu/~jipsen/asciisvg.html]]|
|''Version:''|1.0.0|
|''Date:''|Sep 12, 2007|
|''Source:''|http://www.math.ist.utl.pt/~psoares/addons.html|
|''Documentation:''|[[ASCIIsvgPlugin Documentation|ASCIIsvgPluginDoc]]|
|''Author:''|Paulo Soares|
|''License:''|[[Creative Commons Attribution-Share Alike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]]|
|''~CoreVersion:''|2.1.0|
***/
//{{{
Story.prototype.ASCIIsvgRefreshTiddler = Story.prototype.refreshTiddler;
Story.prototype.refreshTiddler = function(title,minorUpdate) {
	setTimeout('drawPictures()',100);
	return(this.ASCIIsvgRefreshTiddler(title,minorUpdate));
}

config.shadowTiddlers.ASCIIsvgPluginDoc="The documentation is available [[here.|http://www.math.ist.utl.pt/~psoares/addons.html#ASCIIsvgPluginDoc]]";
//}}}
!Description
This plugin is a wrapper for a modified version of Peter Jipsen's [[ASCIIsvg|http://www1.chapman.edu/~jipsen/asciisvg.html]]. The main changes are:
#mouseover effects over the figures were removed (too much clumsy code to so little results...)
#a unique id for each figure is mandatory
#small changes in some functions' names (for improved coherence)
Most of the syntax was preserved so, to be able to draw beautiful SVG pictures in your ~TiddlyWiki you should take a look at the [[ASCIIsvg|http://www1.chapman.edu/~jipsen/asciisvg.html]] site.

The plugin is known to do a good job with Mozilla Firefox 2.0 and Opera 9.23. I'm not sure about the awful Internet Explorer (with the Adobe SVG plugin).
!Installation
This is not a self-contained plugin. To install it, download the modified ~ASCIIsvg code [[here|http://www.math.ist.utl.pt/~psoares/TWASCIIsvg.js]] and this other [[one|http://www.math.ist.utl.pt/~psoares/d.svg]], and put them next to your ~TiddlyWiki file. Next, add the following line to the MarkupPreHead tiddler:
{{{
<script type="text/javascript" src="TWASCIIsvg.js"></script>
}}}
Finally, copy the ASCIIsvgPlugin tiddler to your ~TiddlyWiki, give it the //systemConfig// tag, save and reload.
!Credits
A final word of appreciation for Peter Jipsen's fine work on promoting beautiful math in the web.
<<slideShow noClicks forceRefresh>> 
-s-
!
In questa presentazione, deriviamo la formula per la somma di una serie geometrica partendo dal presupposto che il paradosso di Zeno sia falso e che Achille riesca a catturare la tartaruga.

{{Comment{
@@Premi F11 per allargare a tutto schermo ed utilizza Ctrl++ Ctrl+- (or Ctrl+rotella) per cambiare la dimensione dei caratteri.@@}}}

-s-
!Il Paradosso di Zeno – ca. 450 a.C.

Una tartaruga sfida Achille in una corsa. 
La tartaruga sostiene di poter vincere se viene fatta partire in vantaggio, 
dato che Achille non può riuscire a raggiungerla.



-s-
!Achille e la tartaruga

Se la tartaruga parte con un vantaggio iniziale pari ad $a$ metri, Achille deve cominciare a correre per i primi $a$ metri. 
Nel frattempo la tartaruga percorre circa $\frac{a}{10}$ metri.

Quindi Achille deve correre per $\frac{a}{10}$  metri mentre la tartaruga percorre di nuovo circa $\frac{a}{100}$ metri, e così via. 

Rimane sempre una distanza tra Achille e la tartaruga.

-s-
!Achille riesce a raggiungere la tartaruga?

Se la velocità di Achille e' $v$ m/s, allora la tartaruga, che e' piu' lenta, avrà una velocità pari a $qv$ m/s, per $0<q<1$.

|! Achille corre |! La tartaruga corre |
| $a$ metri | $qa$ metri |
| $qa$ metri | $q²a$ metri |
| $q²a$ metri | $q³a$ metri |


-s-
!Quanto deve correre Achille?

|! Round |! Distanza |! Achille corre |! La tartaruga corre |
| 1 | $a$ metri | $a$ metri |  $qa$ metri |
| 2 | $qa$ metri | $qa$ metri |  $q²a$ metri |
| 3 | $q²a$ metri | $q²a$ metri |  $q³a$ metri |
	
Risposta: Achille deve correre $a+aq+aq²+aq³+…$ metri per raggiungere la tartaruga.

-s-
!Quando riuscirà Achille a raggiungere la tartaruga?

Achille avrà raggiunto la tartaruga quando avrà corso $a$ metri oltre la tartaruga.

Date le velocità $v$ m/s per Achille, e $qv$ m/s, dove $0<q<1$, per la tartaruga, si ottiene che Achille impiega un tempo $t$ per raggiungere la tartaruga tale che:
$$vt=a+qvt$$

Quindi, Achille riuscirà a raggiungere la tartaruga in $t=\frac{a}{v(1-q)}$ secondi.



-s-
!Dove raggiungerà Achille la tartaruga?

Sappiamo che Achille impiega $t=\frac{a}{v(1-q)}$ secondi per raggiungere la tartaruga. 

Achille quindi percorre metri:
$$vt=\frac{a}{v(1-q)}v=\frac{a}{1-q}$$
per raggiungere la tartaruga.

-s-
!Serie Geometrica

Paradosso di Zeno: Achille deve correre  $a+aq+aq²+aq³+…$ metri per raggiungere la tartaruga. 

Formula per la somma di una serie geometrica:

$$a+aq+aq²+aq³+…= \sum_{k=0}^{\infty}aq^k=\frac{a}{1-q}$$

per $|q|<1$.

-s-
!
[img[Achille cattura la tartaruga|http://farm3.static.flickr.com/2194/2420999602_92b160cd3d_m.jpg]]
Zeno spiega così il paradosso. 

Se la tartaruga parte con un vantaggio iniziale pari ad $a$ metri, Achille deve cominciare a correre per i primi $a$ metri. Nel frattempo la tartaruga percorre circa $\frac{a}{10}$ metri.

Quindi Achille deve correre per $\frac{a}{10}$  metri mentre la tartaruga percorre di nuovo circa $\frac{a}{100}$ metri, e così via. 

Zeno quindi conclude che rimane sempre una distanza tra Achille e la tartaruga. La domanda é: [[Achille riesce a raggiungere la tartaruga?]]
Ora si supponga che la velocità di Achille sia $v$ m/s, mentre quella della tartaruga $qv$ m/s, per $0<q<1$. Chiaramente, nel caso di una tartaruga, $q$ deve essere più vicino a $0$ che ad $1$ (altrimenti avremmo una tartaruga veloce quanto Achille). Siccome il rapporto tra la velocita di Achille e quella della tartaruga é $q$, se Achille corre $a$ metri, la tartaruga ne corre $qa$ ($v:qv=a:qa$). Seguendo le linee del ragionamento di Zeno, si ha: 

|! Achille corre |! La tartaruga corre|
| $a$ metri | $qa$ metri|
| $qa$ metri | $q²a$ metri|
| $q²a$ metri | $q³a$ metri|

Proviamo a vedere [[quanto deve correre Achille per raggiungere la tartaruga|Quanto deve correre Achille?]].
/***
|''Name:''|BibTeXPlugin|
|''Description:''|Very incomplete BibTeX implementation to work with bibliographic references|
|''Version:''|1.0.0|
|''Date:''|Sep 12, 2007|
|''Source:''|http://www.math.ist.utl.pt/~psoares/addons.html|
|''Documentation:''|[[BibTeXPlugin Documentation|BibTeXPluginDoc]]|
|''Author:''|Paulo Soares|
|''License:''|[[Creative Commons Attribution-Share Alike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]]|
|''~CoreVersion:''|2.1.0|
***/
//{{{
config.macros.cite = {noReference: "(??)", biblioTiddler: ""};
config.macros.bibliography = {title: "!References"};

config.macros.bibliography.handler=function(place,macroName,params,wikifier,paramString,tiddler) {
	if(params.length==0) return;
	var title = params[0];
	var showAll = getParam(paramString.parseParams("list",null,true),"showAll",false);
	var entry, entryText, start, bib, prefix;
	var entries = new Array();
	if(title!="") wikify(config.macros.bibliography.title, place);
	if(showAll) {
		if(store.tiddlerExists(title)) entryText = extractAllEntries(title);
		for(i=0; i<entryText.length; i++) {
			bib = processEntry(entryText[i], true);
			entries.push(bib[1]);
		}
	} else {
		var text = store.getTiddlerText(tiddler.title);
		var idx = -1;
		while(true) {
			idx = text.indexOf("<<cite",idx);
			if(idx==-1) break;
			start = text.indexOf(" ",idx)+1;
			idx = Math.min(text.indexOf(">>",start),text.indexOf(" ",start));
			entry = text.substring(start,idx);
			if(store.tiddlerExists(title)) entryText = extractEntry(title, entry);
			idx++;
			if(entryText != null) {
				bib = processEntry(entryText, true);
				entries.push(bib[1]);
			}
		}
	}
	entries.sort();
	for (var i=0; i < entries.length; i++) {
		prefix = (i>0) ? "\n\n" : "";
		wikify(prefix + entries[i] , place);
	}
	return;
}

String.prototype.extract = extractField;

config.macros.cite.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
	if(params.length==0) return;
	var text;
	var entry = params[0];
	var args = paramString.parseParams("list",null,true);
	var title = getParam(args,"bibliography",undefined);
	if(title) {
		config.macros.cite.biblioTiddler = title;
	} else {title = config.macros.cite.biblioTiddler;}
	var showAll = getParam(args,"showAll",false);
	if(title!="" && store.tiddlerExists(title)) text = extractEntry(title, entry);
	if(text == null) {
		wikify(config.macros.cite.noReference, place);
	} else {
		var bib = processEntry(text, showAll);
		wikify(bib[0], place);
	}
	return;
}

function processNames(names, showAll) {
	var authors = names.split(" and ");
	var entry = authors[0];
	var numAuthors = authors.length;
	var fullEntry = entry;
	if (numAuthors==2) {
		entry += " and " + authors[1];
		fullEntry = entry;
	}
	if (numAuthors>2) {
		fullEntry = entry;
		for (var i=1; i < numAuthors; i++) {
			if (i==numAuthors-1) {fullEntry += " and "} else {fullEntry += ", "};
			fullEntry += authors[i];
		}
		if(showAll) {entry = fullEntry;} else {entry += " et al.";}
	}
	return [entry,fullEntry];
}

function processEntry(text,showAll) {
	var type = text.substring(text.indexOf("@")+1,text.indexOf("{"));
	var authors = processNames(text.extract("author"), showAll); 
	var entry = authors[0] + " ("+text.extract("year")+")";
	var fullEntry = authors[1] + " ("+text.extract("year")+").";
	var url = text.extract("url");
	var title = (url) ? "[[" + text.extract("title") + "|" + url + "]]" : text.extract("title") ;
	switch(type.toLowerCase()) {
		case "article":
			fullEntry += " " + title + ". //" + text.extract("journal") + "// \'\'" + text.extract("volume") + "\'\', " + text.extract("pages") + ".";
			break;
		case "book":
			fullEntry += " //" + title + "//. "  + text.extract("publisher") + ".";
			break;
		case "inproceedings":
			fullEntry += " " + title + ". In " + processNames(text.extract("editor"),true)[1] + " (Eds.), //" + text.extract("booktitle") + "//, " + text.extract("pages") + ". " + text.extract("publisher") + ".";
			break;
		case "incollection":
			fullEntry += " " + title + ". In " + processNames(text.extract("editor"),true)[1] + " (Eds.), //" + text.extract("booktitle") + "//, " + text.extract("pages") + ". " + text.extract("publisher") + ".";
			break;
		case "techreport":
			fullEntry += " " + title + ". Technical report, " + text.extract("institution") + ".";
			break;
		case "manual":
			fullEntry += " //" + title + "//. " + text.extract("organization") + ".";
			break;
		case "unpublished":
			fullEntry += " " + title + ". Unpublished.";
			break;
	}
	return [entry, fullEntry];
}

function extractEntry(title,entry) {
	var parseText = store.getTiddlerText(title);
	var pos = parseText.indexOf(entry);
	if(pos==-1) return null;
	var previousText=parseText.substring(0,pos);
	var start = previousText.lastIndexOf("@",pos);
	var end = parseText.indexOf("@",pos);
	var entryText = ((end==-1) ? parseText.substring(start) : parseText.substring(start,end));
	return entryText;
}

function extractAllEntries(title) {
	var parseText = store.getTiddlerText(title);
	var start, end;
	var pos = 0;
	var entries = new Array();
	while(true) {
		start = parseText.indexOf("@",pos);
		if(start==-1) break;
		end = parseText.indexOf("@",start+1)+1;
		if(end==0) end=parseText.length;
		pos=end;
		entries.push(parseText.substring(start,end));
	}
	return entries;
}

function extractField(fieldDescr) {
	var i = this.toLowerCase().indexOf(fieldDescr);
	if (i != -1) {
		i += fieldDescr.length;
		i += 1 + (this.substring(i,this.length)).indexOf("=");
		if (i != -1) {
			var contExtr = true;
			var fieldDelim = ""
			var fieldText = "";
			var nestedPar = 0;
			while (i<this.length && contExtr) {
				if (fieldDelim == "") {
					if (this.charAt(i) == "\"" || this.charAt(i) == "\'" || this.charAt(i)=="\`") {
						fieldDelim = this.charAt(i);
					} else if (this.charAt(i) == "\{") {
						fieldDelim = "\}";
					} else if (this.charAt(i) != " " && this.charAt(i) != "\t" && this.charAt(i) != "\n") {
						fieldDelim = ",";
						i--;
					}
				} else {
					if (this.charAt(i) == "\{" && fieldDelim == "\}") {
						nestedPar++;
						fieldText += this.charAt(i);
					} else if (this.charAt(i) == fieldDelim) {
						if (nestedPar == 0) {
							contExtr = false;
						} else {
							nestedPar--;
							fieldText += this.charAt(i);
						}
					} else {
						fieldText += this.charAt(i);
					}
				}
				i++;
			}
			return fieldText;
		} else {
			return "";
		}
	} else {
		return "";
	}
}

config.shadowTiddlers.BibTeXPluginDoc="The documentation is available [[here.|http://www.math.ist.utl.pt/~psoares/addons.html#BibTeXPluginDoc]]";
//}}}
!Description
Very incomplete (and personal) ~BibTeX implementation to work with bibliographic references.
!Usage
First of all, you need to dump your ~BibTeX entries in a tiddler, lets call it //~MyReferences//. The first macro that this plugin provides is {{{<<cite>>}}}. As the name suggests it is used to cite a reference such as {{{<<cite Soares:07>>}}} where {{{Soares:07}}} is a ~BibTeX key for a reference. However, in your first citation you must include the name of the tiddler that contains the ~BibTeX entries like this {{{<<cite Soares:07 bibliography:MyReferences>>}}}

The {{{<<cite>>}}} macro produces a full reference if there are at most two authors, otherwise it is abbreviated. If you want to force a full reference then you can use  the {{{showAll}}} parameter as in {{{<<cite Coda:97 showAll:true>>}}}.

The production of a list of cited references is done with the {{{<<bibliography>>}}} macro using the name of the tiddler that contains the ~BibTeX entries as a single parameter such as {{{<<bibliography MyReferences>>}}}. If you want to make a list of all your ~BibTeX entries then use {{{<<bibliography MyReferences showAll:true>>}}}.
//{{{
config.macros.cite = {noReference: "(??)", biblioTiddler: ""};
config.macros.bibliography = {title: "!Bibliografia"};
//}}}
{{{
@TECHREPORT{AgaGel:03,
  author = {Agarwal, D. K. and Gelfand, A. E.},
  title = {Slice Gibbs sampling for simulation based fitting of spatial data models},
  institution = {University of Connecticut},
  year = {2003},
}

@ARTICLE{Ait:91,
  author = {Aitkin, M.},
  title = {Posterior Bayes factors},
  journal = {Journal of the Royal Statistical Society B},
  year = {1991},
  volume = {53},
  pages = {111-142},
}

@ARTICLE{AlbChi:93,
  author = {Albert, J. H. and Chib, S.},
  title = {Bayesian Analysis of Binary and Polychotomous Response Data},
  journal = {Journal of the American Statistical Association},
  year = {1993},
  volume = {88},
  number = {422},
  pages = {669-679},
}

@ARTICLE{BerChe:93,
  author = {Berger, J. O. and Chen, M.- H.},
  title = {Predicting retirement patterns: prediction for a multinomial distribution with constrained parameter space},
  journal = {The Statistician},
  year = {1993},
  volume = {42},
  pages = {427-443},
}

@ARTICLE{BesGre:93,
  author = {Besag, J. and Green, P. J.},
  title = {Spatial Statistics and Bayesian Computation},
  journal = {Journal of the Royal Statistical Society B},
  year = {1993},
  volume = {55},
  number = {1},
  pages = {25-37},
}

@MANUAL{Coda:97,
  title = {CODA - Convergence Diagnosis and Output Analysis software for Gibbs sampling output: Version 0.4},
  author = {Best, N. and Cowles, M. K. and Vines, K.},
  organization = {MRC Biostatistics Unit},
  address = {Cambrigde},
  year = {1997},
}

@TECHREPORT{Bro.R:95,
  author = {Brooks, S. and Roberts, G.},
  title = {Assessing convergence of Markov chain Monte Carlo algorithms},
  institution = {Department of Pure Mathematics and Mathematical Statistics, University of Cambridge},
  year = {1995},
  number = {12},
}

@ARTICLE{Car.C:95,
  author = {Carlin, B. P. and Chib, S.},
  title = {Bayesian model choice via Markov chain Monte Carlo methods},
  journal = {Journal of the Royal Statistical Society B},
  year = {1995},
  volume = {57},
  pages = {473-484},
}

@ARTICLE{Cas.G:92,
  author = {Casella, G. and George, E. I.},
  title = {Explaining the Gibbs Sampler},
  journal = {The American Statistician},
  year = {1992},
  volume = {46},
  number = {3},
  pages = {167-174},
}

@ARTICLE{CasLAvRob:01,
  author = {Casella, G. and Lavine, M. and Robert, C. P.},
  title = {Explaining the Perfect Sampler},
  journal = {The American Statistician},
  year = {2001},
  volume = {55},
  number = {4},
  pages = {299-305},
}

@ARTICLE{ChaVan:01,
  author = {Chauveau, D. and Vandekerkhove, P.},
  title = {Improving convergence of the Hastings-Metropolis Algorithm with a learning proposal},
  journal = {Scandinavian Journal of Statistics},
  year = {2001},
  volume = {29},
  number = {1},
  pages = {13-29},
}

@TECHREPORT{Che,
  author = {Chen, M.-H.},
  title = {Markov Chain Monte Carlo Sampling for Evaluating Multidimensional Integrals With Application to Bayesian Computation},
  institution = {Dept of Mathematical Sciences, WPI},
}

@ARTICLE{Chi.G:95,
  author = {Chib, S. and Greenberg, E.},
  title = {Understanding the Metropolis-Hastings algorithm},
  journal = {The American Statistician},
  year = {1995},
  volume = {49},
  number = {4},
  pages = {327-335},
}

@ARTICLE{Coo.B:95,
  author = {Cook, P. and Broemeling, L.D.},
  title = {Bayesian statistics using Mathematica},
  journal = {The American Statistician},
  year = {1995},
  volume = {49},
  pages = {70-76},
}

@ARTICLE{Cow.C:96,
  author = {Cowles, M. K. and Carlin, B. P.},
  title = {Markov chain Monte Carlo convergence diagnostics: a comparative review},
  journal = {Journal of the American Statistical Association},
  year = {1996},
  volume = {91},
  pages = {883-904},
}

@ARTICLE{DamWakWal:99,
  author = {Damien, P. and Wakefield, J. and Walker, S.},
  title = {Gibbs sampling for Bayesian non-conjugate and hierarchical models by using auxiliary variables},
  journal = {Journal of the Royal Statistical Society B},
  year = {1999},
  volume = {61},
  number = {Part 2},
  pages = {331-344},
}

@TECHREPORT{DouGodRob,
  author = {Doucet, A. and Godsill, S. J. and Robert, C. P.},
  title = {Marginal Maximum A Posteriori Estimation using Markov Chain Monte Carlo},
  institution = {Signal Processing Group, University of Cambridge},
}

@ARTICLE{Gel.S:90,
  author = {Gelfand, A. E. and Smith, A. F. M.},
  title = {Sampling-based approaches to calculating marginal densities},
  journal = {Journal of the American Statistical Association},
  year = {1990},
  volume = {85},
  number = {410},
  pages = {398-409},
}

@ARTICLE{GelSmiLee:92,
  author = {Gelfand, A. E. and Smith, A. F. M. and Lee, T.-M.},
  title = {Bayesian Analysis of Constrained Parameter and Truncated Data Problems Using Gibbs Sampling},
  journal = {Journal of the American Statistical Association},
  year = {1992},
  volume = {87},
  number = {418},
  pages = {523-532},
}

@ARTICLE{Gel.D:94,
  author = {Gelfand, A. E. G. and Dey, D. K.},
  title = {Bayesian model choice: asymptotics and exact calculations},
  journal = {Journal of the Royal Statistical Society B},
  year = {1994},
  volume = {56},
  pages = {501-514},
}

@ARTICLE{Gel.H.R.S:90,
  author = {Gelfand, A. E. G. and Hills, S. E. and Racine-Poon, A. and Smith, A. F. M.},
  title = {Illustration of Bayesian inference in normal data models using Gibbs sampling},
  journal = {Journal of the American Statistical Association},
  year = {1990},
  volume = {85},
  pages = {972-985},
}

@INCOLLECTION{GelMen:96,
  author = {Gelman, A. and Meng, X.-L.},
  title = {Model checking and model improvement},
  booktitle = {Markov Chain Monte Carlo in Practice},
  publisher = {Chapman and Hall, London},
  year = {1996},
  editor = {Gilks, W. R. and Richardson, S. and Spiegelhalter, D. J.},
  pages = {189-202},
}

@ARTICLE{Gem.G:84,
  author = {Geman, S. and Geman, D.},
  title = {Stochastic relaxation, Gibbs distributions, and the Bayesian restoration of images},
  journal = {IEEE Transactions on Pattern Analysis and Machine Intelligence},
  year = {1984},
  volume = {6},
  pages = {721-741},
}

@INPROCEEDINGS{Gew:92,
  author = {Geweke, J.},
  title = {Evaluating the accuracy of sampling-based approaches to calculating posterior moments},
  booktitle = {Bayesian Statistics 4},
  year = {1992},
  editor = {Bernardo, J. M. and Berger, J. O. and Dawid, A. P. and Smith, A. F. M.},
  pages = {169-193},
  address = {Oxford},
  publisher = {University Press},
}

@ARTICLE{Gey:92,
  author = {Geyer, C. J.},
  title = {Pratical Markov Chain Monte Carlo},
  journal = {Statistical Science},
  year = {1992},
  volume = {7},
  number = {4},
  pages = {473-511},
}

@ARTICLE{Gil.C.S.B.M.S.K:93,
  author = {Gilks, W. R. and Clayton, D. G. and Spiegelhalter, D. J. and Best, N. G. and McNeil, A. J. and Sharples, L. D. and Kirby, A. J.},
  title = {Modelling complexity: applications of Gibbs sampling in medicine},
  journal = {Journal of the Royal Statistical Society B},
  year = {1993},
  volume = {55},
  pages = {39-52},
}

@ARTICLE{GilTS:94,
  author = {Gilks, W. R. and Thomas, A. and Spiegelhalter, D. J.},
  title = {A language and program for complex Bayesian modelling},
  journal = {The Statistician},
  year = {1994},
  volume = {43},
  pages = {169-178},
}

@ARTICLE{Gil.B.T:95,
  author = {Gilks, W.R. and Best, N.G. and Tan, K.K.C.},
  title = {Adaptive rejection Metropolis sampling within Gibbs sampling},
  journal = {Applied Statistics},
  year = {1995},
  volume = {44},
  pages = {455-472},
}

@ARTICLE{Gil.W:92,
  author = {Gilks, W.R. and Wild, P.},
  title = {Adaptive rejection sampling for Gibbs sampling},
  journal = {Applied Statistics},
  year = {1992},
  volume = {41},
  pages = {337-348},
}

@TECHREPORT{GreMir,
  author = {Green, P. J. and Mira, A.},
  title = {Delayed Rejection in Reversible Jump Metropolis-Hastings},
}

@ARTICLE{HanCar:01,
  author = {Han, C. and Carlin, B. R.},
  title = {Markov Chain Monte Carlo Methods for Computing Bayes Factors: A Comparative Review},
  journal = {Journal of the American Statistical Association},
  year = {2001},
  volume = {96},
  number = {455},
  pages = {1122-1132},
}

@ARTICLE{Has:70,
  author = {Hastings, W.K.},
  title = {Monte Carlo sampling methods using Markov chains and their applications},
  journal = {Biometrika},
  year = {1970},
  volume = {57},
  pages = {97-109},
}

@ARTICLE{Hei.W:83,
  author = {Heidelberger, P. and Welch, P.},
  title = {Simulation run length control in the presence of an initial transient},
  journal = {Operations Research},
  year = {1983},
  volume = {31},
  pages = {1109-1144},
}

@TECHREPORT{Hig:96,
  author = {Higdon, D. M.},
  title = {Auxiliary Variable Methods for Markov Chain Monte Carlo with Applications},
  institution = {Jasa},
  year = {1996},
  journal = {Jasa Theory and Methods},
}

@INPROCEEDINGS{Hil.S:92,
  author = {Hills, S.E. and Smith, A.F.M.},
  title = {Parameterization issues in Bayesian inference},
  booktitle = {Bayesian Statistics 4},
  year = {1992},
  editor = {Bernardo, J.M. and Berger, J.O. and Dawid, A.P. and Smith, A.F.M.},
  pages = {227-246},
  publisher = {Oxford University Press},
}

@ARTICLE{IhaGen:96,
  author = {Ihaka, R. and Gentleman, R.},
  title = {R: A Language for Data Analysis and Graphics},
  journal = {Journal of Computational and Graphical Statistics},
  year = {1996},
  volume = {5},
  number = {3},
  pages = {299-314},
}

@ARTICLE{Ing:94,
  author = {Ingrassia, S.},
  title = {On the rate of convergence of the Metropolis algorithm and Gibbs sampler by geometric bounds},
  journal = {The Annals of Applied Probability},
  year = {1994},
  volume = {31},
  pages = {347-389},
}

@ARTICLE{JonHob:01,
  author = {Jones, G. L. and Hobert, J. P.},
  title = {Honest Exploration of Intractable Probability Distributions via Markov Chain Monte Carlo},
  journal = {Statistical Science},
  year = {2001},
  volume = {16},
  number = {4},
  pages = {312-334},
}

@ARTICLE{KasRaf:95,
  author = {Kass, R. E. and Raftery, A.E.},
  title = {Bayes Factors},
  journal = {Journal of the American Statistical Association},
  year = {1995},
  volume = {90},
  number = {430},
  pages = {773-795},
}

@ARTICLE{Kas.C.G.N:98,
  author = {Kass, R.E. and Carlin, B.P. and Gelman, A. and Neal, R.M.},
  title = {Markov chain Monte Carlo in practice: a roundtable discussion},
  journal = {The American Statistician},
  year = {1998},
  volume = {52},
  pages = {93-100},
}

@INPROCEEDINGS{Key.P.S:98,
  author = {Key, J.T. and Pericchi, L.R. and Smith, A.F.M.},
  title = {Bayesian model choice: what and why?},
  booktitle = {Bayesian Statistics 6},
  year = {1998},
  editor = {Bernardo, J.M. and Berger, J.O. and Dawid, A.P. and Smith, A.F.M.},
  pages = {0-0},
  publisher = {Oxford University Press},
}

@ARTICLE{Leo:78,
  author = {Leonard, T.},
  title = {Density estimation, stochastic processes and prior information},
  journal = {Journal of the Royal Statistical Society B},
  year = {1978},
  volume = {40},
  pages = {113-146},
}

@TECHREPORT{Liu,
  author = {Liu, J. S.},
  title = {Metropolized Independent Sampling with Comparisons to Rejection Sampling and Importance Sampling},
  institution = {Department of Statistics, Stanford University},
}

@TECHREPORT{Liu2,
  author = {Liu, J. S.},
  title = {Markov Chain Monte Carlo and Related Topics},
  institution = {Department of Statistics, Stanford University},
}

@TECHREPORT{MacPer:96,
  author = {MacEachern, S. N. and Peruggia, M.},
  title = {Subsampling the Gibbs Sampler: Variance Reduction},
  institution = {Department of Statistics, The Ohio State University},
  year = {1996},
}

@ARTICLE{Mac.B:94,
  author = {MacEachern, S.N. and Berliner, L.M.},
  title = {Subsampling the Gibbs sampler},
  journal = {The American Statistician},
  year = {1994},
  volume = {48},
  pages = {188-190},
}

@MANUAL{Splus:98,
  title = {S-Plus: Version 4.5},
  author = {MathSoft},
  organization = {Data Analysis Products Division, MathSoft, Inc.},
  address = {Seatle},
  year = {1998},
}

@TECHREPORT{WWW,
  author = {Mengersen, K.L. and Robert, C.P. and Guihenneuc-Jouyaux},
  title = {MCMC convergence diagnostics: a Rclassification},
  institution = {Laboratoire de Statistique, CREST, INSEE, Paris},
  year = {1998},
  number = {16},
}

@ARTICLE{Met:87,
  author = {Metropolis, N.},
  title = {The beginning of the Monte Carlo method},
  journal = {Los Alamos Science},
  year = {1987},
  number = {Special issue},
  pages = {125-130},
}

@ARTICLE{Met.R.R.T.T:53,
  author = {Metropolis, N. and Rosenbluth, A.W. and Rosenbluth, M.N. and Teller, A.H. and Teller, E.},
  title = {Equations of state calculations by fast computing machine},
  journal = {J. Chem. Phys.},
  year = {1953},
  volume = {21},
  pages = {1087-1091},
}

@ARTICLE{MirTie,
  author = {Mira, A. and Tierney, L.},
  title = {Efficiency and Convergence Properties of Slice Samplers},
  journal = {Scand. J. Statist.},
  year = {2002},
  volume = {29},
  pages = {1-12},
  institution = {School of Statistics, University of Minnesota},
}

@ARTICLE{Nea:03,
  author = {Neal, R. M.},
  title = {Slice Sampling},
  journal = {The Annals of Statistics},
  year = {2003},
  volume = {31},
  number = {3},
  pages = {705-767},
}

@ARTICLE{Nea:01,
  author = {Neal, R. M.},
  title = {Annealed importance sampling},
  journal = {Statistics and Computing},
  year = {2001},
  volume = {11},
  pages = {125-139},
}

@TECHREPORT{Nea:93,
  author = {Neal, R. M.},
  title = {Probabilistic Inference Using Markov Chain Monte Carlo Methods},
  institution = {Department of Computer Science, University of Toronto},
  year = {1993},
}

@ARTICLE{NeaSam:97,
  author = {Neath, A. A. and Samaniego, F. J.},
  title = {On the Efficacy of Bayesian Inference for Nonidentifiable Models},
  journal = {The American Statistician},
  year = {1997},
  volume = {51},
  number = {3},
  pages = {225-232},
}

@MANUAL{Fbayes:96,
  title = {First Bayes: Version 1.3},
  author = {O'Hagan, A.},
  organization = {Data Analysis Products Division, MathSoft, Inc.},
  address = {Nottingham},
  year = {1996},
}

@ARTICLE{PauPer:94,
  author = {Paulino, C. D. M. and Pereira, C. A. B.},
  title = {On Identifiability of Parametric Statistical Models},
  journal = {Journal of the Italian Statistical Society},
  year = {1994},
  volume = {3},
  number = {1},
  pages = {125-151},
}

@ARTICLE{Pes:73,
  author = {Peskun, P. H.},
  title = {Optimum Monte-Carlo sampling using Markov chains},
  journal = {Biometrika},
  year = {1973},
  volume = {60},
  number = {3},
  pages = {607},
}

@INPROCEEDINGS{Raf.L:92,
  author = {Raftery, A.L. and Lewis, S.},
  title = {How many iterations in the Gibbs sampler?},
  booktitle = {Bayesian Statistics 4},
  year = {1992},
  editor = {Bernardo, J.M. and Berger,J.O. and Dawid, A.P. and Smith, A.F.M.},
  pages = {763-774},
  address = {Oxford},
  publisher = {University Press},
}

@ARTICLE{Rit.T:92,
  author = {Ritter, C. and Tanner, M.A.},
  title = {Facilitating the Gibbs sampler: the Gibbs stopper and the Griddy-Gibbs sampler},
  journal = {Journal of the American Statistical Association},
  year = {1992},
  volume = {87},
  pages = {861-868},
}

@ARTICLE{Rob:92,
  author = {Roberts, G. O.},
  title = {Convergence Diagnostics of the Gibbs Sampler},
  journal = {Bayesian Statistics},
  year = {1992},
  volume = {4},
  pages = {775-782},
}

@ARTICLE{RobRos:99,
  author = {Roberts, G. O. and Rosenthal, J. S.},
  title = {Convergence of slice sampler Markov chains},
  journal = {Journal of the Royal Statistical Society B},
  year = {1999},
  volume = {61},
  pages = {643-660},
}

@ARTICLE{RobSmi:94,
  author = {Roberts, G. O. and Smith, A. F. M.},
  title = {Simple conditions for the convergence of the Gibbs sampler and Metropolis-Hastings algorithms},
  journal = {Stochastic Processes and their Applications},
  year = {1994},
  volume = {49},
  pages = {207-216},
}

@ARTICLE{Rob.P:94,
  author = {Roberts, G.O. and Polson, N.G.},
  title = {On the geometric convergence of the Gibbs sampler},
  journal = {Journal of the Royal Statistical Society B},
  year = {1994},
  volume = {56},
  pages = {377-384},
}

@ARTICLE{Smi.G:92,
  author = {Smith, A.F.M. and Gelfand, A.E.},
  title = {Bayesian statistics without tears: a sampling-resampling perspective},
  journal = {The American Statistician},
  year = {1992},
  volume = {46},
  pages = {84-88},
}

@ARTICLE{Smi.R:93,
  author = {Smith, A.F.M. and Roberts, G.O.},
  title = {Bayesian computation via the Gibbs sampler and related Markov chain Monte Carlo methods},
  journal = {Journal of the Royal Statistical Society B},
  year = {1993},
  volume = {55},
  pages = {3-23},
}

@MANUAL{BOA,
  title = {Bayesian Output Analysis Program (BOA), Version 1.1 User's manual},
  author = {Smith, B. J. },
  year = {2004},
}

@TECHREPORT{Spi.B.C:98,
  author = {Spiegelhalter, D. and Best, N. and Carlin, B.P.},
  title = {Bayesian deviance, the effective number of parameters, and the comparison of arbitrarily complex models},
  institution = {Division of Biostatiscs, University of Minneasota},
  year = {1998},
  number = {9},
}

@MANUAL{Winbugs:98,
  title = {WinBUGS - Bayesian inference using Gibbs sampling for Windows: Version 1.1.1},
  author = {Spiegelhalter, D. and Thomas, A. and Best, N.},
  organization = {MRC Biostatistics Unit},
  address = {Cambrigde},
  year = {1998},
}

@MANUAL{Bugs:97,
  title = {BUGS - Bayesian inference using Gibbs sampling: Version 0.6},
  author = {Spiegelhalter, D. and Thomas, A. and Best, N. and Gilks, W.},
  organization = {MRC Biostatistics Unit},
  address = {Cambrigde},
  year = {1997},
}

@ARTICLE{Spial:02,
  author = {Spiegelhalter, D. J. and Best, N. G. and Carlin, B. P. and van der Linde, A.},
  title = {Bayesian Measures of model complexity and fit},
  journal = {Journal of the Royal Statistical Society B},
  year = {2002},
  number = {64},
  pages = {583-639},
}

@MANUAL{Stata:97,
  title = {Stata Statistical Software: Release 5.0},
  author = {Stata-Corporation},
  organization = {College Station, Stata Corporation},
  address = {Texas},
  year = {1997},
}

@UNPUBLISHED{Ste:03,
  author = {Steinhaus, S.},
  title = {Comparison of mathematical programs for data analysis},
  year = {2003},
  url = {http://www.scientificweb.com/ncrunch/ncrunch4.pdf},
}

@TECHREPORT{StrTwe:98,
  author = {Stramer, O. and Tweedie, R. L.},
  title = {Self-Targeting Candidates for Metropolis-Hastings Algorithms },
  institution = {University of Iowa and Colorado State University },
  year = {1998},
}

@ARTICLE{Tan.W:87,
  author = {Tanner, M.A. and Wong, W.H.},
  title = {The calculation of posterior distributions by data augmentation (with discussion)},
  journal = {Journal of the American Statistical Association},
  year = {1987},
  volume = {82},
  pages = {528-550},
}

@INPROCEEDINGS{Tho.S.G:92,
  author = {Thomas, A. and Spiegelhalter, D.J. and Gilks, W.R.},
  title = {BUGS: a program to perform Bayesian inference using Gibbs sampling},
  booktitle = {Bayesian Statistics 4},
  year = {1992},
  editor = {Bernardo, J.M. and Berger, J.O. and Dawid, A.P. and Smith, A.F.M.},
  pages = {837-842},
  publisher = {Oxford University Press},
}

@ARTICLE{Tie:94,
  author = {Tierney, L.},
  title = {Markov chains for exploring posterior distributions},
  journal = {The Annals of Statistics},
  year = {1994},
  volume = {22},
  pages = {1701-1762},
}

@ARTICLE{TieMir:99,
  author = {Tierney, L. and Mira, A.},
  title = {Some Adaptive Monte Carlo Methods For Bayesian Inference},
  journal = {Statistics in Medicine},
  year = {1999},
  number = {18},
  pages = {2507-2515},
}

@ARTICLE{VanMen:01,
  author = {Van Dyk, D. A. and Meng, X.},
  title = {The Art of Data Augmentation},
  journal = {Journal of the American Statistical Association},
  year = {2001},
  volume = {10},
  number = {1},
  pages = {1-50},
}

@ARTICLE{Wil.G:93,
  author = {Wild, P. and Gilks, W.R.},
  title = {Adaptive rejection sampling for log-concave density functions},
  journal = {Applied Statistics},
  year = {1993},
  volume = {42},
  pages = {701-709},
}

@BOOK{Wol:03,
  title = {The Mathematica Book},
  publisher = {Wolfram Media/Cambridge University Press},
  year = {2003},
  author = {Wolfram, S.},
  edition = {Fifth},
}

@ARTICLE{Zel.M:95,
  author = {Zellner, A. and Min, C.},
  title = {Gibbs sampler convergence criteria},
  journal = {Journal of the American Statistical Association},
  year = {1995},
  volume = {90},
  pages = {921-927},
}
}}}
Como se pode ver em <<cite AgaGel:03 bibliography:Bibliography>> o exemplo não é muito feliz <<cite CasLAvRob:01>> é uma referência obrigatória <<cite CheShaIbr:00>>, <<cite Coda:97 showAll:true>> <<cite Coda:97>>, <<cite Gew:92>>, <<cite GelMen:96>>, <<cite Ste:03>>
<<bibliography Bibliography>>
/***
|''Name:''|CryptoFunctionsPlugin|
|''Description:''|Support for cryptographic functions|
***/
//{{{
if(!version.extensions.CryptoFunctionsPlugin) {
version.extensions.CryptoFunctionsPlugin = {installed:true};

//--
//-- Crypto functions and associated conversion routines
//--

// Crypto "namespace"
function Crypto() {}

// Convert a string to an array of big-endian 32-bit words
Crypto.strToBe32s = function(str)
{
	var be = Array();
	var len = Math.floor(str.length/4);
	var i, j;
	for(i=0, j=0; i<len; i++, j+=4) {
		be[i] = ((str.charCodeAt(j)&0xff) << 24)|((str.charCodeAt(j+1)&0xff) << 16)|((str.charCodeAt(j+2)&0xff) << 8)|(str.charCodeAt(j+3)&0xff);
	}
	while (j<str.length) {
		be[j>>2] |= (str.charCodeAt(j)&0xff)<<(24-(j*8)%32);
		j++;
	}
	return be;
};

// Convert an array of big-endian 32-bit words to a string
Crypto.be32sToStr = function(be)
{
	var str = "";
	for(var i=0;i<be.length*32;i+=8)
		str += String.fromCharCode((be[i>>5]>>>(24-i%32)) & 0xff);
	return str;
};

// Convert an array of big-endian 32-bit words to a hex string
Crypto.be32sToHex = function(be)
{
	var hex = "0123456789ABCDEF";
	var str = "";
	for(var i=0;i<be.length*4;i++)
		str += hex.charAt((be[i>>2]>>((3-i%4)*8+4))&0xF) + hex.charAt((be[i>>2]>>((3-i%4)*8))&0xF);
	return str;
};

// Return, in hex, the SHA-1 hash of a string
Crypto.hexSha1Str = function(str)
{
	return Crypto.be32sToHex(Crypto.sha1Str(str));
};

// Return the SHA-1 hash of a string
Crypto.sha1Str = function(str)
{
	return Crypto.sha1(Crypto.strToBe32s(str),str.length);
};

// Calculate the SHA-1 hash of an array of blen bytes of big-endian 32-bit words
Crypto.sha1 = function(x,blen)
{
	// Add 32-bit integers, wrapping at 32 bits
	add32 = function(a,b)
	{
		var lsw = (a&0xFFFF)+(b&0xFFFF);
		var msw = (a>>16)+(b>>16)+(lsw>>16);
		return (msw<<16)|(lsw&0xFFFF);
	};
	// Add five 32-bit integers, wrapping at 32 bits
	add32x5 = function(a,b,c,d,e)
	{
		var lsw = (a&0xFFFF)+(b&0xFFFF)+(c&0xFFFF)+(d&0xFFFF)+(e&0xFFFF);
		var msw = (a>>16)+(b>>16)+(c>>16)+(d>>16)+(e>>16)+(lsw>>16);
		return (msw<<16)|(lsw&0xFFFF);
	};
	// Bitwise rotate left a 32-bit integer by 1 bit
	rol32 = function(n)
	{
		return (n>>>31)|(n<<1);
	};

	var len = blen*8;
	// Append padding so length in bits is 448 mod 512
	x[len>>5] |= 0x80 << (24-len%32);
	// Append length
	x[((len+64>>9)<<4)+15] = len;
	var w = Array(80);

	var k1 = 0x5A827999;
	var k2 = 0x6ED9EBA1;
	var k3 = 0x8F1BBCDC;
	var k4 = 0xCA62C1D6;

	var h0 = 0x67452301;
	var h1 = 0xEFCDAB89;
	var h2 = 0x98BADCFE;
	var h3 = 0x10325476;
	var h4 = 0xC3D2E1F0;

	for(var i=0;i<x.length;i+=16) {
		var j,t;
		var a = h0;
		var b = h1;
		var c = h2;
		var d = h3;
		var e = h4;
		for(j = 0;j<16;j++) {
			w[j] = x[i+j];
			t = add32x5(e,(a>>>27)|(a<<5),d^(b&(c^d)),w[j],k1);
			e=d; d=c; c=(b>>>2)|(b<<30); b=a; a = t;
		}
		for(j=16;j<20;j++) {
			w[j] = rol32(w[j-3]^w[j-8]^w[j-14]^w[j-16]);
			t = add32x5(e,(a>>>27)|(a<<5),d^(b&(c^d)),w[j],k1);
			e=d; d=c; c=(b>>>2)|(b<<30); b=a; a = t;
		}
		for(j=20;j<40;j++) {
			w[j] = rol32(w[j-3]^w[j-8]^w[j-14]^w[j-16]);
			t = add32x5(e,(a>>>27)|(a<<5),b^c^d,w[j],k2);
			e=d; d=c; c=(b>>>2)|(b<<30); b=a; a = t;
		}
		for(j=40;j<60;j++) {
			w[j] = rol32(w[j-3]^w[j-8]^w[j-14]^w[j-16]);
			t = add32x5(e,(a>>>27)|(a<<5),(b&c)|(d&(b|c)),w[j],k3);
			e=d; d=c; c=(b>>>2)|(b<<30); b=a; a = t;
		}
		for(j=60;j<80;j++) {
			w[j] = rol32(w[j-3]^w[j-8]^w[j-14]^w[j-16]);
			t = add32x5(e,(a>>>27)|(a<<5),b^c^d,w[j],k4);
			e=d; d=c; c=(b>>>2)|(b<<30); b=a; a = t;
		}

		h0 = add32(h0,a);
		h1 = add32(h1,b);
		h2 = add32(h2,c);
		h3 = add32(h3,d);
		h4 = add32(h4,e);
	}
	return Array(h0,h1,h2,h3,h4);
};


}
//}}}
/***
|''Name:''|DataTiddlerPlugin|
|''Version:''|1.0.6 (2006-08-26)|
|''Source:''|http://tiddlywiki.abego-software.de/#DataTiddlerPlugin|
|''Author:''|UdoBorkowski (ub [at] abego-software [dot] de)|
|''Licence:''|[[BSD open source license]]|
|''TiddlyWiki:''|1.2.38+, 2.0|
|''Browser:''|Firefox 1.0.4+; InternetExplorer 6.0|
!Description
Enhance your tiddlers with structured data (such as strings, booleans, numbers, or even arrays and compound objects) that can be easily accessed and modified through named fields (in JavaScript code).

Such tiddler data can be used in various applications. E.g. you may create tables that collect data from various tiddlers. 

''//Example: "Table with all December Expenses"//''
{{{
<<forEachTiddler
    where
        'tiddler.tags.contains("expense") && tiddler.data("month") == "Dec"'
    write
        '"|[["+tiddler.title+"]]|"+tiddler.data("descr")+"| "+tiddler.data("amount")+"|\n"'
>>
}}}
//(This assumes that expenses are stored in tiddlers tagged with "expense".)//
<<forEachTiddler
    where
        'tiddler.tags.contains("expense") && tiddler.data("month") == "Dec"'
    write
        '"|[["+tiddler.title+"]]|"+tiddler.data("descr")+"| "+tiddler.data("amount")+"|\n"'
>>
For other examples see DataTiddlerExamples.




''Access and Modify Tiddler Data''

You can "attach" data to every tiddler by assigning a JavaScript value (such as a string, boolean, number, or even arrays and compound objects) to named fields. 

These values can be accessed and modified through the following Tiddler methods:
|!Method|!Example|!Description|
|{{{data(field)}}}|{{{t.data("age")}}}|Returns the value of the given data field of the tiddler. When no such field is defined or its value is undefined {{{undefined}}} is returned.|
|{{{data(field,defaultValue)}}}|{{{t.data("isVIP",false)}}}|Returns the value of the given data field of the tiddler. When no such field is defined or its value is undefined the defaultValue is returned.|
|{{{data()}}}|{{{t.data()}}}|Returns the data object of the tiddler, with a property for every field. The properties of the returned data object may only be read and not be modified. To modify the data use DataTiddler.setData(...) or the corresponding Tiddler method.|
|{{{setData(field,value)}}}|{{{t.setData("age",42)}}}|Sets the value of the given data field of the tiddler to the value. When the value is {{{undefined}}} the field is removed.|
|{{{setData(field,value,defaultValue)}}}|{{{t.setData("isVIP",flag,false)}}}|Sets the value of the given data field of the tiddler to the value. When the value is equal to the defaultValue no value is set (and the field is removed).|

Alternatively you may use the following functions to access and modify the data. In this case the tiddler argument is either a tiddler or the name of a tiddler.
|!Method|!Description|
|{{{DataTiddler.getData(tiddler,field)}}}|Returns the value of the given data field of the tiddler. When no such field is defined or its value is undefined {{{undefined}}} is returned.|
|{{{DataTiddler.getData(tiddler,field,defaultValue)}}}|Returns the value of the given data field of the tiddler. When no such field is defined or its value is undefined the defaultValue is returned.|
|{{{DataTiddler.getDataObject(tiddler)}}}|Returns the data object of the tiddler, with a property for every field. The properties of the returned data object may only be read and not be modified. To modify the data use DataTiddler.setData(...) or the corresponding Tiddler method.|
|{{{DataTiddler.setData(tiddler,field,value)}}}|Sets the value of the given data field of the tiddler to the value. When the value is {{{undefined}}} the field is removed.|
|{{{DataTiddler.setData(tiddler,field,value,defaultValue)}}}|Sets the value of the given data field of the tiddler to the value. When the value is equal to the defaultValue no value is set (and the field is removed).|
//(For details on the various functions see the detailed comments in the source code.)//


''Data Representation in a Tiddler''

The data of a tiddler is stored as plain text in the tiddler's content/text, inside a "data" section that is framed by a {{{<data>...</data>}}} block. Inside the data section the information is stored in the [[JSON format|http://www.crockford.com/JSON/index.html]]. 

//''Data Section Example:''//
{{{
<data>{"isVIP":true,"user":"John Brown","age":34}</data>
}}}

The data section is not displayed when viewing the tiddler (see also "The showData Macro").

Beside the data section a tiddler may have all kind of other content.

Typically you will not access the data section text directly but use the methods given above. Nevertheless you may retrieve the text of the data section's content through the {{{DataTiddler.getDataText(tiddler)}}} function.


''Saving Changes''

The "setData" methods respect the "ForceMinorUpdate" and "AutoSave" configuration values. I.e. when "ForceMinorUpdate" is true changing a value using setData will not affect the "modifier" and "modified" attributes. With "AutoSave" set to true every setData will directly save the changes after a setData.


''Notifications''

No notifications are sent when a tiddler's data value is changed through the "setData" methods. 

''Escape Data Section''
In case that you want to use the text {{{<data>}}} or {{{</data>}}} in a tiddler text you must prefix the text with a tilde ('~'). Otherwise it may be wrongly considered as the data section. The tiddler text {{{~<data>}}} is displayed as {{{<data>}}}.


''The showData Macro''

By default the data of a tiddler (that is stored in the {{{<data>...</data>}}} section of the tiddler) is not displayed. If you want to display this data you may used the {{{<<showData ...>>}}} macro:

''Syntax:'' 
|>|{{{<<}}}''showData '' [''JSON''] [//tiddlerName//] {{{>>}}}|
|''JSON''|By default the data is rendered as a table with a "Name" and "Value" column. When defining ''JSON'' the data is rendered in JSON format|
|//tiddlerName//|Defines the tiddler holding the data to be displayed. When no tiddler is given the tiddler containing the showData macro is used. When the tiddler name contains spaces you must quote the name (or use the {{{[[...]]}}} syntax.)|
|>|~~Syntax formatting: Keywords in ''bold'', optional parts in [...]. 'or' means that exactly one of the two alternatives must exist.~~|


!Revision history
* v1.0.6 (2006-08-26) 
** Removed misleading comment
* v1.0.5 (2006-02-27) (Internal Release Only)
** Internal
*** Make "JSLint" conform
* v1.0.4 (2006-02-05)
** Bugfix: showData fails in TiddlyWiki 2.0
* v1.0.3 (2006-01-06)
** Support TiddlyWiki 2.0
* v1.0.2 (2005-12-22)
** Enhancements:
*** Handle texts "<data>" or "</data>" more robust when used in a tiddler text or as a field value.
*** Improved (JSON) error messages.
** Bugs fixed: 
*** References are not updated when using the DataTiddler.
*** Changes to compound objects are not always saved.
*** "~</data>" is not rendered correctly (expected "</data>")
* v1.0.1 (2005-12-13)
** Features: 
*** The showData macro supports an optional "tiddlername" argument to specify the tiddler containing the data to be displayed
** Bugs fixed: 
*** A script immediately following a data section is deleted when the data is changed. (Thanks to GeoffS for reporting.)
* v1.0.0 (2005-12-12)
** initial version

!Code
***/
//{{{
//============================================================================
//============================================================================
//                           DataTiddlerPlugin
//============================================================================
//============================================================================

// Ensure that the DataTiddler Plugin is only installed once.
//
if (!version.extensions.DataTiddlerPlugin) {



version.extensions.DataTiddlerPlugin = {
    major: 1, minor: 0, revision: 6,
    date: new Date(2006, 7, 26), 
    type: 'plugin',
    source: "http://tiddlywiki.abego-software.de/#DataTiddlerPlugin"
};

// For backward compatibility with v1.2.x
//
if (!window.story) window.story=window; 
if (!TiddlyWiki.prototype.getTiddler) {
	TiddlyWiki.prototype.getTiddler = function(title) { 
		var t = this.tiddlers[title]; 
		return (t !== undefined && t instanceof Tiddler) ? t : null; 
	};
}

//============================================================================
// DataTiddler Class
//============================================================================

// ---------------------------------------------------------------------------
// Configurations and constants 
// ---------------------------------------------------------------------------

function DataTiddler() {
}

DataTiddler = {
    // Function to stringify a JavaScript value, producing the text for the data section content.
    // (Must match the implementation of DataTiddler.parse.)
    //
    stringify : null,
    

    // Function to parse the text for the data section content, producing a JavaScript value.
    // (Must match the implementation of DataTiddler.stringify.)
    //
    parse : null
};

// Ensure access for IE
window.DataTiddler = DataTiddler;

// ---------------------------------------------------------------------------
// Data Accessor and Mutator
// ---------------------------------------------------------------------------


// Returns the value of the given data field of the tiddler.
// When no such field is defined or its value is undefined
// the defaultValue is returned.
// 
// @param tiddler either a tiddler name or a tiddler
//
DataTiddler.getData = function(tiddler, field, defaultValue) {
    var t = (typeof tiddler == "string") ? store.getTiddler(tiddler) : tiddler;
    if (!(t instanceof Tiddler)) {
        throw "Tiddler expected. Got "+tiddler;
    }

    return DataTiddler.getTiddlerDataValue(t, field, defaultValue);
};


// Sets the value of the given data field of the tiddler to
// the value. When the value is equal to the defaultValue
// no value is set (and the field is removed)
//
// Changing data of a tiddler will not trigger notifications.
// 
// @param tiddler either a tiddler name or a tiddler
//
DataTiddler.setData = function(tiddler, field, value, defaultValue) {
    var t = (typeof tiddler == "string") ? store.getTiddler(tiddler) : tiddler;
    if (!(t instanceof Tiddler)) {
        throw "Tiddler expected. Got "+tiddler+ "("+t+")";
    }

    DataTiddler.setTiddlerDataValue(t, field, value, defaultValue);
};


// Returns the data object of the tiddler, with a property for every field.
//
// The properties of the returned data object may only be read and
// not be modified. To modify the data use DataTiddler.setData(...) 
// or the corresponding Tiddler method.
//
// If no data section is defined a new (empty) object is returned.
//
// @param tiddler either a tiddler name or a Tiddler
//
DataTiddler.getDataObject = function(tiddler) {
    var t = (typeof tiddler == "string") ? store.getTiddler(tiddler) : tiddler;
    if (!(t instanceof Tiddler)) {
        throw "Tiddler expected. Got "+tiddler;
    }

    return DataTiddler.getTiddlerDataObject(t);
};

// Returns the text of the content of the data section of the tiddler.
//
// When no data section is defined for the tiddler null is returned 
//
// @param tiddler either a tiddler name or a Tiddler
// @return [may be null]
//
DataTiddler.getDataText = function(tiddler) {
    var t = (typeof tiddler == "string") ? store.getTiddler(tiddler) : tiddler;
    if (!(t instanceof Tiddler)) {
        throw "Tiddler expected. Got "+tiddler;
    }

    return DataTiddler.readDataSectionText(t);
};


// ---------------------------------------------------------------------------
// Internal helper methods (must not be used by code from outside this plugin)
// ---------------------------------------------------------------------------

// Internal.
//
// The original JSONError is not very user friendly, 
// especially it does not define a toString() method
// Therefore we extend it here.
//
DataTiddler.extendJSONError = function(ex) {
	if (ex.name == 'JSONError') {
        ex.toString = function() {
			return ex.name + ": "+ex.message+" ("+ex.text+")";
		};
	}
	return ex;
};

// Internal.
//
// @param t a Tiddler
//
DataTiddler.getTiddlerDataObject = function(t) {
    if (t.dataObject === undefined) {
        var data = DataTiddler.readData(t);
        t.dataObject = (data) ? data : {};
    }
    
    return t.dataObject;
};


// Internal.
//
// @param tiddler a Tiddler
//
DataTiddler.getTiddlerDataValue = function(tiddler, field, defaultValue) {
    var value = DataTiddler.getTiddlerDataObject(tiddler)[field];
    return (value === undefined) ? defaultValue : value;
};


// Internal.
//
// @param tiddler a Tiddler
//
DataTiddler.setTiddlerDataValue = function(tiddler, field, value, defaultValue) {
    var data = DataTiddler.getTiddlerDataObject(tiddler);
    var oldValue = data[field];
	
    if (value == defaultValue) {
        if (oldValue !== undefined) {
            delete data[field];
            DataTiddler.save(tiddler);
        }
        return;
    }
    data[field] = value;
    DataTiddler.save(tiddler);
};

// Internal.
//
// Reads the data section from the tiddler's content and returns its text
// (as a String).
//
// Returns null when no data is defined.
//
// @param tiddler a Tiddler
// @return [may be null]
//
DataTiddler.readDataSectionText = function(tiddler) {
    var matches = DataTiddler.getDataTiddlerMatches(tiddler);
    if (matches === null || !matches[2]) {
        return null;
    }
    return matches[2];
};

// Internal.
//
// Reads the data section from the tiddler's content and returns it
// (as an internalized object).
//
// Returns null when no data is defined.
//
// @param tiddler a Tiddler
// @return [may be null]
//
DataTiddler.readData = function(tiddler) {
    var text = DataTiddler.readDataSectionText(tiddler);
	try {
	    return text ? DataTiddler.parse(text) : null;
	} catch(ex) {
		throw DataTiddler.extendJSONError(ex);
	}
};

// Internal.
// 
// Returns the serialized text of the data of the given tiddler, as it
// should be stored in the data section.
//
// @param tiddler a Tiddler
//
DataTiddler.getDataTextOfTiddler = function(tiddler) {
    var data = DataTiddler.getTiddlerDataObject(tiddler);
    return DataTiddler.stringify(data);
};


// Internal.
// 
DataTiddler.indexOfNonEscapedText = function(s, subString, startIndex) {
	var index = s.indexOf(subString, startIndex);
	while ((index > 0) && (s[index-1] == '~')) { 
		index = s.indexOf(subString, index+1);
	}
	return index;
};

// Internal.
//
DataTiddler.getDataSectionInfo = function(text) {
	// Special care must be taken to handle "<data>" and "</data>" texts inside
	// a data section. 
	// Also take care not to use an escaped <data> (i.e. "~<data>") as the start 
	// of a data section. (Same for </data>)

    // NOTE: we are explicitly searching for a data section that contains a JSON
    // string, i.e. framed with braces. This way we are little bit more robust in
    // case the tiddler contains unescaped texts "<data>" or "</data>". This must
    // be changed when using a different stringifier.

	var startTagText = "<data>{";
	var endTagText = "}</data>";

	var startPos = 0;

	// Find the first not escaped "<data>".
	var startDataTagIndex = DataTiddler.indexOfNonEscapedText(text, startTagText, 0);
	if (startDataTagIndex < 0) {
		return null;
	}

	// Find the *last* not escaped "</data>".
	var endDataTagIndex = text.indexOf(endTagText, startDataTagIndex);
	if (endDataTagIndex < 0) {
		return null;
	}
	var nextEndDataTagIndex;
	while ((nextEndDataTagIndex = text.indexOf(endTagText, endDataTagIndex+1)) >= 0) {
		endDataTagIndex = nextEndDataTagIndex;
	}

	return {
		prefixEnd: startDataTagIndex, 
		dataStart: startDataTagIndex+(startTagText.length)-1, 
		dataEnd: endDataTagIndex, 
		suffixStart: endDataTagIndex+(endTagText.length)
	};
};

// Internal.
// 
// Returns the "matches" of a content of a DataTiddler on the
// "data" regular expression. Return null when no data is defined
// in the tiddler content.
//
// Group 1: text before data section (prefix)
// Group 2: content of data section
// Group 3: text behind data section (suffix)
//
// @param tiddler a Tiddler
// @return [may be null] null when the tiddler contains no data section, otherwise see above.
//
DataTiddler.getDataTiddlerMatches = function(tiddler) {
	var text = tiddler.text;
	var info = DataTiddler.getDataSectionInfo(text);
	if (!info) {
		return null;
	}

	var prefix = text.substr(0,info.prefixEnd);
	var data = text.substr(info.dataStart, info.dataEnd-info.dataStart+1);
	var suffix = text.substr(info.suffixStart);
	
	return [text, prefix, data, suffix];
};


// Internal.
//
// Saves the data in a <data> block of the given tiddler (as a minor change). 
//
// The "chkAutoSave" and "chkForceMinorUpdate" options are respected. 
// I.e. the TiddlyWiki *file* is only saved when AutoSave is on.
//
// Notifications are not send. 
//
// This method should only be called when the data really has changed. 
//
// @param tiddler
//             the tiddler to be saved.
//
DataTiddler.save = function(tiddler) {

    var matches = DataTiddler.getDataTiddlerMatches(tiddler);

    var prefix;
    var suffix;
    if (matches === null) {
        prefix = tiddler.text;
        suffix = "";
    } else {
        prefix = matches[1];
        suffix = matches[3];
    }

    var dataText = DataTiddler.getDataTextOfTiddler(tiddler);
    var newText = 
            (dataText !== null) 
                ? prefix + "<data>" + dataText + "</data>" + suffix
                : prefix + suffix;
    if (newText != tiddler.text) {
        // make the change in the tiddlers text
        
        // ... see DataTiddler.MyTiddlerChangedFunction
        tiddler.isDataTiddlerChange = true;
        
        // ... do the action change
        tiddler.set(
                tiddler.title,
                newText,
                config.options.txtUserName, 
                config.options.chkForceMinorUpdate? undefined : new Date(),
                tiddler.tags);

        // ... see DataTiddler.MyTiddlerChangedFunction
        delete tiddler.isDataTiddlerChange;

        // Mark the store as dirty.
        store.dirty = true;
 
        // AutoSave if option is selected
        if(config.options.chkAutoSave) {
           saveChanges();
        }
    }
};

// Internal.
//
DataTiddler.MyTiddlerChangedFunction = function() {
    // Remove the data object from the tiddler when the tiddler is changed
    // by code other than DataTiddler code. 
    //
    // This is necessary since the data object is just a "cached version" 
    // of the data defined in the data section of the tiddler and the 
    // "external" change may have changed the content of the data section.
    // Thus we are not sure if the data object reflects the data section 
    // contents. 
    // 
    // By deleting the data object we ensure that the data object is 
    // reconstructed the next time it is needed, with the data defined by
    // the data section in the tiddler's text.
    
    // To indicate that a change is a "DataTiddler change" a temporary
    // property "isDataTiddlerChange" is added to the tiddler.
    if (this.dataObject && !this.isDataTiddlerChange) {
        delete this.dataObject;
    }
    
    // call the original code.
	DataTiddler.originalTiddlerChangedFunction.apply(this, arguments);
};


//============================================================================
// Formatters
//============================================================================

// This formatter ensures that "~<data>" is rendered as "<data>". This is used to 
// escape the "<data>" of a data section, just in case someone really wants to use
// "<data>" as a text in a tiddler and not start a data section.
//
// Same for </data>.
//
config.formatters.push( {
    name: "data-escape",
    match: "~<\\/?data>",

    handler: function(w) {
            w.outputText(w.output,w.matchStart + 1,w.nextMatch);
    }
} );


// This formatter ensures that <data>...</data> sections are not rendered.
//
config.formatters.push( {
    name: "data",
    match: "<data>",

    handler: function(w) {
		var info = DataTiddler.getDataSectionInfo(w.source);
		if (info && info.prefixEnd == w.matchStart) {
            w.nextMatch = info.suffixStart;
		} else {
			w.outputText(w.output,w.matchStart,w.nextMatch);
		}
    }
} );


//============================================================================
// Tiddler Class Extension
//============================================================================

// "Hijack" the changed method ---------------------------------------------------

DataTiddler.originalTiddlerChangedFunction = Tiddler.prototype.changed;
Tiddler.prototype.changed = DataTiddler.MyTiddlerChangedFunction;

// Define accessor methods -------------------------------------------------------

// Returns the value of the given data field of the tiddler. When no such field 
// is defined or its value is undefined the defaultValue is returned.
//
// When field is undefined (or null) the data object is returned. (See 
// DataTiddler.getDataObject.)
//
// @param field [may be null, undefined]
// @param defaultValue [may be null, undefined]
// @return [may be null, undefined]
//
Tiddler.prototype.data = function(field, defaultValue) {
    return (field) 
         ? DataTiddler.getTiddlerDataValue(this, field, defaultValue)
         : DataTiddler.getTiddlerDataObject(this);
};

// Sets the value of the given data field of the tiddler to the value. When the 
// value is equal to the defaultValue no value is set (and the field is removed).
//
// @param value [may be null, undefined]
// @param defaultValue [may be null, undefined]
//
Tiddler.prototype.setData = function(field, value, defaultValue) {
    DataTiddler.setTiddlerDataValue(this, field, value, defaultValue);
};


//============================================================================
// showData Macro
//============================================================================

config.macros.showData = {
     // Standard Properties
     label: "showData",
     prompt: "Display the values stored in the data section of the tiddler"
};

config.macros.showData.handler = function(place,macroName,params) {
    // --- Parsing ------------------------------------------

    var i = 0; // index running over the params
    // Parse the optional "JSON"
    var showInJSONFormat = false;
    if ((i < params.length) && params[i] == "JSON") {
        i++;
        showInJSONFormat = true;
    }
    
    var tiddlerName = story.findContainingTiddler(place).id.substr(7);
    if (i < params.length) {
        tiddlerName = params[i];
        i++;
    }

    // --- Processing ------------------------------------------
    try {
        if (showInJSONFormat) {
            this.renderDataInJSONFormat(place, tiddlerName);
        } else {
            this.renderDataAsTable(place, tiddlerName);
        }
    } catch (e) {
        this.createErrorElement(place, e);
    }
};

config.macros.showData.renderDataInJSONFormat = function(place,tiddlerName) {
    var text = DataTiddler.getDataText(tiddlerName);
    if (text) {
        createTiddlyElement(place,"pre",null,null,text);
    }
};

config.macros.showData.renderDataAsTable = function(place,tiddlerName) {
    var text = "|!Name|!Value|\n";
    var data = DataTiddler.getDataObject(tiddlerName);
    if (data) {
        for (var i in data) {
            var value = data[i];
            text += "|"+i+"|"+DataTiddler.stringify(value)+"|\n";
        }
    }
    
    wikify(text, place);
};


// Internal.
//
// Creates an element that holds an error message
// 
config.macros.showData.createErrorElement = function(place, exception) {
    var message = (exception.description) ? exception.description : exception.toString();
    return createTiddlyElement(place,"span",null,"showDataError","<<showData ...>>: "+message);
};

// ---------------------------------------------------------------------------
// Stylesheet Extensions (may be overridden by local StyleSheet)
// ---------------------------------------------------------------------------
//
setStylesheet(
    ".showDataError{color: #ffffff;background-color: #880000;}",
    "showData");


} // of "install only once"
// Used Globals (for JSLint) ==============

// ... TiddlyWiki Core
/*global 	createTiddlyElement, saveChanges, store, story, wikify */
// ... DataTiddler
/*global 	DataTiddler */
// ... JSON
/*global 	JSON */
			

/***
!JSON Code, used to serialize the data
***/
/*
Copyright (c) 2005 JSON.org

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The Software shall be used for Good, not Evil.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

/*
    The global object JSON contains two methods.

    JSON.stringify(value) takes a JavaScript value and produces a JSON text.
    The value must not be cyclical.

    JSON.parse(text) takes a JSON text and produces a JavaScript value. It will
    throw a 'JSONError' exception if there is an error.
*/
var JSON = {
    copyright: '(c)2005 JSON.org',
    license: 'http://www.crockford.com/JSON/license.html',
/*
    Stringify a JavaScript value, producing a JSON text.
*/
    stringify: function (v) {
        var a = [];

/*
    Emit a string.
*/
        function e(s) {
            a[a.length] = s;
        }

/*
    Convert a value.
*/
        function g(x) {
            var c, i, l, v;

            switch (typeof x) {
            case 'object':
                if (x) {
                    if (x instanceof Array) {
                        e('[');
                        l = a.length;
                        for (i = 0; i < x.length; i += 1) {
                            v = x[i];
                            if (typeof v != 'undefined' &&
                                    typeof v != 'function') {
                                if (l < a.length) {
                                    e(',');
                                }
                                g(v);
                            }
                        }
                        e(']');
                        return;
                    } else if (typeof x.toString != 'undefined') {
                        e('{');
                        l = a.length;
                        for (i in x) {
                            v = x[i];
                            if (x.hasOwnProperty(i) &&
                                    typeof v != 'undefined' &&
                                    typeof v != 'function') {
                                if (l < a.length) {
                                    e(',');
                                }
                                g(i);
                                e(':');
                                g(v);
                            }
                        }
                        return e('}');
                    }
                }
                e('null');
                return;
            case 'number':
                e(isFinite(x) ? +x : 'null');
                return;
            case 'string':
                l = x.length;
                e('"');
                for (i = 0; i < l; i += 1) {
                    c = x.charAt(i);
                    if (c >= ' ') {
                        if (c == '\\' || c == '"') {
                            e('\\');
                        }
                        e(c);
                    } else {
                        switch (c) {
                            case '\b':
                                e('\\b');
                                break;
                            case '\f':
                                e('\\f');
                                break;
                            case '\n':
                                e('\\n');
                                break;
                            case '\r':
                                e('\\r');
                                break;
                            case '\t':
                                e('\\t');
                                break;
                            default:
                                c = c.charCodeAt();
                                e('\\u00' + Math.floor(c / 16).toString(16) +
                                    (c % 16).toString(16));
                        }
                    }
                }
                e('"');
                return;
            case 'boolean':
                e(String(x));
                return;
            default:
                e('null');
                return;
            }
        }
        g(v);
        return a.join('');
    },
/*
    Parse a JSON text, producing a JavaScript value.
*/
    parse: function (text) {
        var p = /^\s*(([,:{}\[\]])|"(\\.|[^\x00-\x1f"\\])*"|-?\d+(\.\d*)?([eE][+-]?\d+)?|true|false|null)\s*/,
            token,
            operator;

        function error(m, t) {
            throw {
                name: 'JSONError',
                message: m,
                text: t || operator || token
            };
        }

        function next(b) {
            if (b && b != operator) {
                error("Expected '" + b + "'");
            }
            if (text) {
                var t = p.exec(text);
                if (t) {
                    if (t[2]) {
                        token = null;
                        operator = t[2];
                    } else {
                        operator = null;
                        try {
                            token = eval(t[1]);
                        } catch (e) {
                            error("Bad token", t[1]);
                        }
                    }
                    text = text.substring(t[0].length);
                } else {
                    error("Unrecognized token", text);
                }
            } else {
                token = operator = undefined;
            }
        }


        function val() {
            var k, o;
            switch (operator) {
            case '{':
                next('{');
                o = {};
                if (operator != '}') {
                    for (;;) {
                        if (operator || typeof token != 'string') {
                            error("Missing key");
                        }
                        k = token;
                        next();
                        next(':');
                        o[k] = val();
                        if (operator != ',') {
                            break;
                        }
                        next(',');
                    }
                }
                next('}');
                return o;
            case '[':
                next('[');
                o = [];
                if (operator != ']') {
                    for (;;) {
                        o.push(val());
                        if (operator != ',') {
                            break;
                        }
                        next(',');
                    }
                }
                next(']');
                return o;
            default:
                if (operator !== null) {
                    error("Missing value");
                }
                k = token;
                next();
                return k;
            }
        }
        next();
        return val();
    }
};

/***
!Setup the data serialization
***/

DataTiddler.format = "JSON";
DataTiddler.stringify = JSON.stringify;
DataTiddler.parse = JSON.parse;

//}}}

[[Achille cattura la tartaruga]]
/***
|''Name:''|DeprecatedFunctionsPlugin|
|''Description:''|Support for deprecated functions removed from core|
***/
//{{{
if(!version.extensions.DeprecatedFunctionsPlugin) {
version.extensions.DeprecatedFunctionsPlugin = {installed:true};

//--
//-- Deprecated code
//--

// @Deprecated: Use createElementAndWikify and this.termRegExp instead
config.formatterHelpers.charFormatHelper = function(w)
{
	w.subWikify(createTiddlyElement(w.output,this.element),this.terminator);
};

// @Deprecated: Use enclosedTextHelper and this.lookaheadRegExp instead
config.formatterHelpers.monospacedByLineHelper = function(w)
{
	var lookaheadRegExp = new RegExp(this.lookahead,"mg");
	lookaheadRegExp.lastIndex = w.matchStart;
	var lookaheadMatch = lookaheadRegExp.exec(w.source);
	if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
		var text = lookaheadMatch[1];
		if(config.browser.isIE)
			text = text.replace(/\n/g,"\r");
		createTiddlyElement(w.output,"pre",null,null,text);
		w.nextMatch = lookaheadRegExp.lastIndex;
	}
};

// @Deprecated: Use <br> or <br /> instead of <<br>>
config.macros.br = {};
config.macros.br.handler = function(place)
{
	createTiddlyElement(place,"br");
};

// Find an entry in an array. Returns the array index or null
// @Deprecated: Use indexOf instead
Array.prototype.find = function(item)
{
	var i = this.indexOf(item);
	return i == -1 ? null : i;
};

// Load a tiddler from an HTML DIV. The caller should make sure to later call Tiddler.changed()
// @Deprecated: Use store.getLoader().internalizeTiddler instead
Tiddler.prototype.loadFromDiv = function(divRef,title)
{
	return store.getLoader().internalizeTiddler(store,this,title,divRef);
};

// Format the text for storage in an HTML DIV
// @Deprecated Use store.getSaver().externalizeTiddler instead.
Tiddler.prototype.saveToDiv = function()
{
	return store.getSaver().externalizeTiddler(store,this);
};

// @Deprecated: Use store.allTiddlersAsHtml() instead
function allTiddlersAsHtml()
{
	return store.allTiddlersAsHtml();
}

// @Deprecated: Use refreshPageTemplate instead
function applyPageTemplate(title)
{
	refreshPageTemplate(title);
}

// @Deprecated: Use story.displayTiddlers instead
function displayTiddlers(srcElement,titles,template,unused1,unused2,animate,unused3)
{
	story.displayTiddlers(srcElement,titles,template,animate);
}

// @Deprecated: Use story.displayTiddler instead
function displayTiddler(srcElement,title,template,unused1,unused2,animate,unused3)
{
	story.displayTiddler(srcElement,title,template,animate);
}

// @Deprecated: Use functions on right hand side directly instead
var createTiddlerPopup = Popup.create;
var scrollToTiddlerPopup = Popup.show;
var hideTiddlerPopup = Popup.remove;

// @Deprecated: Use right hand side directly instead
var regexpBackSlashEn = new RegExp("\\\\n","mg");
var regexpBackSlash = new RegExp("\\\\","mg");
var regexpBackSlashEss = new RegExp("\\\\s","mg");
var regexpNewLine = new RegExp("\n","mg");
var regexpCarriageReturn = new RegExp("\r","mg");

}
//}}}
Abbiamo calcolato che Achille impiega $t=\frac{a}{v(1-q)}$ secondi per raggiungere la tartaruga.  Alla velocità $v$, significa che Achille percorre metri:
$$vt=\frac{a}{v(1-q)}v=\frac{a}{1-q}$$
per raggiungere la tartaruga, dato che $v$ si semplifica. 
//~~(Part of the [[ForEachTiddlerPlugin]])~~//

Create customizable lists, tables etc. for your selections of tiddlers. Specify the tiddlers to include and their order through a powerful language.

''Syntax:'' 
|>|{{{<<}}}''forEachTiddler'' [''in'' //tiddlyWikiPath//] [''where'' //whereCondition//] [''sortBy'' //sortExpression// [''ascending'' //or// ''descending'']] [''script'' //scriptText//] [//action// [//actionParameters//]]{{{>>}}}|
|//tiddlyWikiPath//|The filepath to the TiddlyWiki the macro should work on. When missing the current TiddlyWiki is used.|
|//whereCondition//|(quoted) JavaScript boolean expression. May refer to the build-in variables {{{tiddler}}} and {{{context}}}.|
|//sortExpression//|(quoted) JavaScript expression returning "comparable" objects (using '{{{<}}}','{{{>}}}','{{{==}}}'. May refer to the build-in variables {{{tiddler}}} and {{{context}}}.|
|//scriptText//|(quoted) JavaScript text. Typically defines JavaScript functions that are called by the various JavaScript expressions (whereClause, sortClause, action arguments,...)|
|//action//|The action that should be performed on every selected tiddler, in the given order. By default the actions [[addToList|AddToListAction]] and [[write|WriteAction]] are supported. When no action is specified [[addToList|AddToListAction]] is used.|
|//actionParameters//|(action specific) parameters the action may refer while processing the tiddlers (see action descriptions for details). <<tiddler [[JavaScript in actionParameters]]>>|
|>|~~Syntax formatting: Keywords in ''bold'', optional parts in [...]. 'or' means that exactly one of the two alternatives must exist.~~|


''Using JavaScript''

To give you a lot of flexibility the [[ForEachTiddlerMacro]] uses JavaScript in its arguments. Even if you are not that familiar with JavaScript you may find forEachTiddler useful. Just have a look at the various ready-to-use [[ForEachTiddlerExamples]] and adapt them to your needs.

''The Elements of the Macro''

The arguments of the ForEachTiddlerMacro consist of multiple parts, each of them being optional.

<<slider chkFETInClause [[inClause]] "inClause" "inClause">>
<<slider chkFETWhereClause [[whereClause]] "whereClause" "whereClause">>
<<slider chkFETSortClause [[sortClause]] "sortClause" "sortClause">>
<<slider chkFETScriptClause [[scriptClause]] "scriptClause" "scriptClause">>
<<slider chkFETActions [[Action Specification]] "Action Specification" "Action Specification">>

''Using Macros and ">" inside the forEachTiddler Macro''

You may use other macro calls into the expression, especially in the actionParameters. To avoid that the {{{>>}}} of such a macro call is misinterpreted as the end of the {{{<<forEachTiddler...>>}}} macro you must escape the {{{>>}}} of the inner macro with {{{$))}}} E.g. if you want to use {{{<<tiddler ...>>}}} inside the {{{forEachTiddler}}} macro you have to write {{{<<tiddler ...$))}}}.

In addition it is necessary to escape single {{{>}}} with the text {{{$)}}}.

''Using {{{<<tiddler ... with: ...>>}}} to re-use ForEachTiddler definitions''

Sometimes you may want to use a certain ForEachTiddler definition in slight variations. E.g. you may want to list either the tiddlers tagged with "ToDo" and in the other case with "Done". To do so you may use "Tiddler parameters". Here an example:

Replace the variable part of the ForEachTiddler definition with $1 ($2,... $9 are supported). E.g. you may create the tiddler "ListTaggedTiddlers" like this
{{{
<<forEachTiddler 
 where 
 'tiddler.tags.contains("$1")'
>>
}}}

Now you can use the ListTaggedTiddlers for various specific tags, using the {{{<<tiddler ...>>}}} macro:
{{{
<<tiddler ListTaggedTiddlers with: "systemConfig">>
}}}
{{{
<<tiddler ListTaggedTiddlers with: "Plugin">>
}}}


See also [[ForEachTiddlerExamples]].
/***
|''Name:''|ForEachTiddlerPlugin|
|''Version:''|1.0.8 (2007-04-12)|
|''Source:''|http://tiddlywiki.abego-software.de/#ForEachTiddlerPlugin|
|''Author:''|UdoBorkowski (ub [at] abego-software [dot] de)|
|''Licence:''|[[BSD open source license (abego Software)|http://www.abego-software.de/legal/apl-v10.html]]|
|''Copyright:''|&copy; 2005-2007 [[abego Software|http://www.abego-software.de]]|
|''TiddlyWiki:''|1.2.38+, 2.0|
|''Browser:''|Firefox 1.0.4+; Firefox 1.5; InternetExplorer 6.0|
!Description

Create customizable lists, tables etc. for your selections of tiddlers. Specify the tiddlers to include and their order through a powerful language.

''Syntax:'' 
|>|{{{<<}}}''forEachTiddler'' [''in'' //tiddlyWikiPath//] [''where'' //whereCondition//] [''sortBy'' //sortExpression// [''ascending'' //or// ''descending'']] [''script'' //scriptText//] [//action// [//actionParameters//]]{{{>>}}}|
|//tiddlyWikiPath//|The filepath to the TiddlyWiki the macro should work on. When missing the current TiddlyWiki is used.|
|//whereCondition//|(quoted) JavaScript boolean expression. May refer to the build-in variables {{{tiddler}}} and  {{{context}}}.|
|//sortExpression//|(quoted) JavaScript expression returning "comparable" objects (using '{{{<}}}','{{{>}}}','{{{==}}}'. May refer to the build-in variables {{{tiddler}}} and  {{{context}}}.|
|//scriptText//|(quoted) JavaScript text. Typically defines JavaScript functions that are called by the various JavaScript expressions (whereClause, sortClause, action arguments,...)|
|//action//|The action that should be performed on every selected tiddler, in the given order. By default the actions [[addToList|AddToListAction]] and [[write|WriteAction]] are supported. When no action is specified [[addToList|AddToListAction]]  is used.|
|//actionParameters//|(action specific) parameters the action may refer while processing the tiddlers (see action descriptions for details). <<tiddler [[JavaScript in actionParameters]]>>|
|>|~~Syntax formatting: Keywords in ''bold'', optional parts in [...]. 'or' means that exactly one of the two alternatives must exist.~~|

See details see [[ForEachTiddlerMacro]] and [[ForEachTiddlerExamples]].

!Revision history
* v1.0.8 (2007-04-12)
** Adapted to latest TiddlyWiki 2.2 Beta importTiddlyWiki API (introduced with changeset 2004). TiddlyWiki 2.2 Beta builds prior to changeset 2004 are no longer supported (but TiddlyWiki 2.1 and earlier, of cause)
* v1.0.7 (2007-03-28)
** Also support "pre" formatted TiddlyWikis (introduced with TW 2.2) (when using "in" clause to work on external tiddlers)
* v1.0.6 (2006-09-16)
** Context provides "viewerTiddler", i.e. the tiddler used to view the macro. Most times this is equal to the "inTiddler", but when using the "tiddler" macro both may be different.
** Support "begin", "end" and "none" expressions in "write" action
* v1.0.5 (2006-02-05)
** Pass tiddler containing the macro with wikify, context object also holds reference to tiddler containing the macro ("inTiddler"). Thanks to SimonBaird.
** Support Firefox 1.5.0.1
** Internal
*** Make "JSLint" conform
*** "Only install once"
* v1.0.4 (2006-01-06)
** Support TiddlyWiki 2.0
* v1.0.3 (2005-12-22)
** Features: 
*** Write output to a file supports multi-byte environments (Thanks to Bram Chen) 
*** Provide API to access the forEachTiddler functionality directly through JavaScript (see getTiddlers and performMacro)
** Enhancements:
*** Improved error messages on InternetExplorer.
* v1.0.2 (2005-12-10)
** Features: 
*** context object also holds reference to store (TiddlyWiki)
** Fixed Bugs: 
*** ForEachTiddler 1.0.1 has broken support on win32 Opera 8.51 (Thanks to BrunoSabin for reporting)
* v1.0.1 (2005-12-08)
** Features: 
*** Access tiddlers stored in separated TiddlyWikis through the "in" option. I.e. you are no longer limited to only work on the "current TiddlyWiki".
*** Write output to an external file using the "toFile" option of the "write" action. With this option you may write your customized tiddler exports.
*** Use the "script" section to define "helper" JavaScript functions etc. to be used in the various JavaScript expressions (whereClause, sortClause, action arguments,...).
*** Access and store context information for the current forEachTiddler invocation (through the build-in "context" object) .
*** Improved script evaluation (for where/sort clause and write scripts).
* v1.0.0 (2005-11-20)
** initial version

!Code
***/
//{{{

	
//============================================================================
//============================================================================
//		   ForEachTiddlerPlugin
//============================================================================
//============================================================================

// Only install once
if (!version.extensions.ForEachTiddlerPlugin) {

if (!window.abego) window.abego = {};

version.extensions.ForEachTiddlerPlugin = {
	major: 1, minor: 0, revision: 8, 
	date: new Date(2007,3,12), 
	source: "http://tiddlywiki.abego-software.de/#ForEachTiddlerPlugin",
	licence: "[[BSD open source license (abego Software)|http://www.abego-software.de/legal/apl-v10.html]]",
	copyright: "Copyright (c) abego Software GmbH, 2005-2007 (www.abego-software.de)"
};

// For backward compatibility with TW 1.2.x
//
if (!TiddlyWiki.prototype.forEachTiddler) {
	TiddlyWiki.prototype.forEachTiddler = function(callback) {
		for(var t in this.tiddlers) {
			callback.call(this,t,this.tiddlers[t]);
		}
	};
}

//============================================================================
// forEachTiddler Macro
//============================================================================

version.extensions.forEachTiddler = {
	major: 1, minor: 0, revision: 8, date: new Date(2007,3,12), provider: "http://tiddlywiki.abego-software.de"};

// ---------------------------------------------------------------------------
// Configurations and constants 
// ---------------------------------------------------------------------------

config.macros.forEachTiddler = {
	 // Standard Properties
	 label: "forEachTiddler",
	 prompt: "Perform actions on a (sorted) selection of tiddlers",

	 // actions
	 actions: {
		 addToList: {},
		 write: {}
	 }
};

// ---------------------------------------------------------------------------
//  The forEachTiddler Macro Handler 
// ---------------------------------------------------------------------------

config.macros.forEachTiddler.getContainingTiddler = function(e) {
	while(e && !hasClass(e,"tiddler"))
		e = e.parentNode;
	var title = e ? e.getAttribute("tiddler") : null; 
	return title ? store.getTiddler(title) : null;
};

config.macros.forEachTiddler.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
	// config.macros.forEachTiddler.traceMacroCall(place,macroName,params,wikifier,paramString,tiddler);

	if (!tiddler) tiddler = config.macros.forEachTiddler.getContainingTiddler(place);
	// --- Parsing ------------------------------------------

	var i = 0; // index running over the params
	// Parse the "in" clause
	var tiddlyWikiPath = undefined;
	if ((i < params.length) && params[i] == "in") {
		i++;
		if (i >= params.length) {
			this.handleError(place, "TiddlyWiki path expected behind 'in'.");
			return;
		}
		tiddlyWikiPath = this.paramEncode((i < params.length) ? params[i] : "");
		i++;
	}

	// Parse the where clause
	var whereClause ="true";
	if ((i < params.length) && params[i] == "where") {
		i++;
		whereClause = this.paramEncode((i < params.length) ? params[i] : "");
		i++;
	}

	// Parse the sort stuff
	var sortClause = null;
	var sortAscending = true; 
	if ((i < params.length) && params[i] == "sortBy") {
		i++;
		if (i >= params.length) {
			this.handleError(place, "sortClause missing behind 'sortBy'.");
			return;
		}
		sortClause = this.paramEncode(params[i]);
		i++;

		if ((i < params.length) && (params[i] == "ascending" || params[i] == "descending")) {
			 sortAscending = params[i] == "ascending";
			 i++;
		}
	}

	// Parse the script
	var scriptText = null;
	if ((i < params.length) && params[i] == "script") {
		i++;
		scriptText = this.paramEncode((i < params.length) ? params[i] : "");
		i++;
	}

	// Parse the action. 
	// When we are already at the end use the default action
	var actionName = "addToList";
	if (i < params.length) {
	   if (!config.macros.forEachTiddler.actions[params[i]]) {
			this.handleError(place, "Unknown action '"+params[i]+"'.");
			return;
		} else {
			actionName = params[i]; 
			i++;
		}
	} 
	
	// Get the action parameter
	// (the parsing is done inside the individual action implementation.)
	var actionParameter = params.slice(i);


	// --- Processing ------------------------------------------
	try {
		this.performMacro({
				place: place, 
				inTiddler: tiddler,
				whereClause: whereClause, 
				sortClause: sortClause, 
				sortAscending: sortAscending, 
				actionName: actionName, 
				actionParameter: actionParameter, 
				scriptText: scriptText, 
				tiddlyWikiPath: tiddlyWikiPath});

	} catch (e) {
		this.handleError(place, e);
	}
};

// Returns an object with properties "tiddlers" and "context".
// tiddlers holds the (sorted) tiddlers selected by the parameter,
// context the context of the execution of the macro.
//
// The action is not yet performed.
//
// @parameter see performMacro
//
config.macros.forEachTiddler.getTiddlersAndContext = function(parameter) {

	var context = config.macros.forEachTiddler.createContext(parameter.place, parameter.whereClause, parameter.sortClause, parameter.sortAscending, parameter.actionName, parameter.actionParameter, parameter.scriptText, parameter.tiddlyWikiPath, parameter.inTiddler);

	var tiddlyWiki = parameter.tiddlyWikiPath ? this.loadTiddlyWiki(parameter.tiddlyWikiPath) : store;
	context["tiddlyWiki"] = tiddlyWiki;
	
	// Get the tiddlers, as defined by the whereClause
	var tiddlers = this.findTiddlers(parameter.whereClause, context, tiddlyWiki);
	context["tiddlers"] = tiddlers;

	// Sort the tiddlers, when sorting is required.
	if (parameter.sortClause) {
		this.sortTiddlers(tiddlers, parameter.sortClause, parameter.sortAscending, context);
	}

	return {tiddlers: tiddlers, context: context};
};

// Returns the (sorted) tiddlers selected by the parameter.
//
// The action is not yet performed.
//
// @parameter see performMacro
//
config.macros.forEachTiddler.getTiddlers = function(parameter) {
	return this.getTiddlersAndContext(parameter).tiddlers;
};

// Performs the macros with the given parameter.
//
// @param parameter holds the parameter of the macro as separate properties.
//				  The following properties are supported:
//
//						place
//						whereClause
//						sortClause
//						sortAscending
//						actionName
//						actionParameter
//						scriptText
//						tiddlyWikiPath
//
//					All properties are optional. 
//					For most actions the place property must be defined.
//
config.macros.forEachTiddler.performMacro = function(parameter) {
	var tiddlersAndContext = this.getTiddlersAndContext(parameter);

	// Perform the action
	var actionName = parameter.actionName ? parameter.actionName : "addToList";
	var action = config.macros.forEachTiddler.actions[actionName];
	if (!action) {
		this.handleError(parameter.place, "Unknown action '"+actionName+"'.");
		return;
	}

	var actionHandler = action.handler;
	actionHandler(parameter.place, tiddlersAndContext.tiddlers, parameter.actionParameter, tiddlersAndContext.context);
};

// ---------------------------------------------------------------------------
//  The actions 
// ---------------------------------------------------------------------------

// Internal.
//
// --- The addToList Action -----------------------------------------------
//
config.macros.forEachTiddler.actions.addToList.handler = function(place, tiddlers, parameter, context) {
	// Parse the parameter
	var p = 0;

	// Check for extra parameters
	if (parameter.length > p) {
		config.macros.forEachTiddler.createExtraParameterErrorElement(place, "addToList", parameter, p);
		return;
	}

	// Perform the action.
	var list = document.createElement("ul");
	place.appendChild(list);
	for (var i = 0; i < tiddlers.length; i++) {
		var tiddler = tiddlers[i];
		var listItem = document.createElement("li");
		list.appendChild(listItem);
		createTiddlyLink(listItem, tiddler.title, true);
	}
};

abego.parseNamedParameter = function(name, parameter, i) {
	var beginExpression = null;
	if ((i < parameter.length) && parameter[i] == name) {
		i++;
		if (i >= parameter.length) {
			throw "Missing text behind '%0'".format([name]);
		}
		
		return config.macros.forEachTiddler.paramEncode(parameter[i]);
	}
	return null;
}

// Internal.
//
// --- The write Action ---------------------------------------------------
//
config.macros.forEachTiddler.actions.write.handler = function(place, tiddlers, parameter, context) {
	// Parse the parameter
	var p = 0;
	if (p >= parameter.length) {
		this.handleError(place, "Missing expression behind 'write'.");
		return;
	}

	var textExpression = config.macros.forEachTiddler.paramEncode(parameter[p]);
	p++;

	// Parse the "begin" option
	var beginExpression = abego.parseNamedParameter("begin", parameter, p);
	if (beginExpression !== null) 
		p += 2;
	var endExpression = abego.parseNamedParameter("end", parameter, p);
	if (endExpression !== null) 
		p += 2;
	var noneExpression = abego.parseNamedParameter("none", parameter, p);
	if (noneExpression !== null) 
		p += 2;

	// Parse the "toFile" option
	var filename = null;
	var lineSeparator = undefined;
	if ((p < parameter.length) && parameter[p] == "toFile") {
		p++;
		if (p >= parameter.length) {
			this.handleError(place, "Filename expected behind 'toFile' of 'write' action.");
			return;
		}
		
		filename = config.macros.forEachTiddler.getLocalPath(config.macros.forEachTiddler.paramEncode(parameter[p]));
		p++;
		if ((p < parameter.length) && parameter[p] == "withLineSeparator") {
			p++;
			if (p >= parameter.length) {
				this.handleError(place, "Line separator text expected behind 'withLineSeparator' of 'write' action.");
				return;
			}
			lineSeparator = config.macros.forEachTiddler.paramEncode(parameter[p]);
			p++;
		}
	}
	
	// Check for extra parameters
	if (parameter.length > p) {
		config.macros.forEachTiddler.createExtraParameterErrorElement(place, "write", parameter, p);
		return;
	}

	// Perform the action.
	var func = config.macros.forEachTiddler.getEvalTiddlerFunction(textExpression, context);
	var count = tiddlers.length;
	var text = "";
	if (count > 0 && beginExpression)
		text += config.macros.forEachTiddler.getEvalTiddlerFunction(beginExpression, context)(undefined, context, count, undefined);
	
	for (var i = 0; i < count; i++) {
		var tiddler = tiddlers[i];
		text += func(tiddler, context, count, i);
	}
	
	if (count > 0 && endExpression)
		text += config.macros.forEachTiddler.getEvalTiddlerFunction(endExpression, context)(undefined, context, count, undefined);

	if (count == 0 && noneExpression) 
		text += config.macros.forEachTiddler.getEvalTiddlerFunction(noneExpression, context)(undefined, context, count, undefined);
		

	if (filename) {
		if (lineSeparator !== undefined) {
			lineSeparator = lineSeparator.replace(/\\n/mg, "\n").replace(/\\r/mg, "\r");
			text = text.replace(/\n/mg,lineSeparator);
		}
		saveFile(filename, convertUnicodeToUTF8(text));
	} else {
		var wrapper = createTiddlyElement(place, "span");
		wikify(text, wrapper, null/* highlightRegExp */, context.inTiddler);
	}
};


// ---------------------------------------------------------------------------
//  Helpers
// ---------------------------------------------------------------------------

// Internal.
//
config.macros.forEachTiddler.createContext = function(placeParam, whereClauseParam, sortClauseParam, sortAscendingParam, actionNameParam, actionParameterParam, scriptText, tiddlyWikiPathParam, inTiddlerParam) {
	return {
		place : placeParam, 
		whereClause : whereClauseParam, 
		sortClause : sortClauseParam, 
		sortAscending : sortAscendingParam, 
		script : scriptText,
		actionName : actionNameParam, 
		actionParameter : actionParameterParam,
		tiddlyWikiPath : tiddlyWikiPathParam,
		inTiddler : inTiddlerParam, // the tiddler containing the <<forEachTiddler ...>> macro call.
		viewerTiddler : config.macros.forEachTiddler.getContainingTiddler(placeParam) // the tiddler showing the forEachTiddler result
	};
};

// Internal.
//
// Returns a TiddlyWiki with the tiddlers loaded from the TiddlyWiki of 
// the given path.
//
config.macros.forEachTiddler.loadTiddlyWiki = function(path, idPrefix) {
	if (!idPrefix) {
		idPrefix = "store";
	}
	var lenPrefix = idPrefix.length;
	
	// Read the content of the given file
	var content = loadFile(this.getLocalPath(path));
	if(content === null) {
		throw "TiddlyWiki '"+path+"' not found.";
	}
	
	var tiddlyWiki = new TiddlyWiki();

	// Starting with TW 2.2 there is a helper function to import the tiddlers
	if (tiddlyWiki.importTiddlyWiki) {
		if (!tiddlyWiki.importTiddlyWiki(content))
			throw "File '"+path+"' is not a TiddlyWiki.";
		tiddlyWiki.dirty = false;
		return tiddlyWiki;
	}
	
	// The legacy code, for TW < 2.2
	
	// Locate the storeArea div's
	var posOpeningDiv = content.indexOf(startSaveArea);
	var posClosingDiv = content.lastIndexOf(endSaveArea);
	if((posOpeningDiv == -1) || (posClosingDiv == -1)) {
		throw "File '"+path+"' is not a TiddlyWiki.";
	}
	var storageText = content.substr(posOpeningDiv + startSaveArea.length, posClosingDiv);
	
	// Create a "div" element that contains the storage text
	var myStorageDiv = document.createElement("div");
	myStorageDiv.innerHTML = storageText;
	myStorageDiv.normalize();
	
	// Create all tiddlers in a new TiddlyWiki
	// (following code is modified copy of TiddlyWiki.prototype.loadFromDiv)
	var store = myStorageDiv.childNodes;
	for(var t = 0; t < store.length; t++) {
		var e = store[t];
		var title = null;
		if(e.getAttribute)
			title = e.getAttribute("tiddler");
		if(!title && e.id && e.id.substr(0,lenPrefix) == idPrefix)
			title = e.id.substr(lenPrefix);
		if(title && title !== "") {
			var tiddler = tiddlyWiki.createTiddler(title);
			tiddler.loadFromDiv(e,title);
		}
	}
	tiddlyWiki.dirty = false;

	return tiddlyWiki;
};


	
// Internal.
//
// Returns a function that has a function body returning the given javaScriptExpression.
// The function has the parameters:
// 
//	 (tiddler, context, count, index)
//
config.macros.forEachTiddler.getEvalTiddlerFunction = function (javaScriptExpression, context) {
	var script = context["script"];
	var functionText = "var theFunction = function(tiddler, context, count, index) { return "+javaScriptExpression+"}";
	var fullText = (script ? script+";" : "")+functionText+";theFunction;";
	return eval(fullText);
};

// Internal.
//
config.macros.forEachTiddler.findTiddlers = function(whereClause, context, tiddlyWiki) {
	var result = [];
	var func = config.macros.forEachTiddler.getEvalTiddlerFunction(whereClause, context);
	tiddlyWiki.forEachTiddler(function(title,tiddler) {
		if (func(tiddler, context, undefined, undefined)) {
			result.push(tiddler);
		}
	});
	return result;
};

// Internal.
//
config.macros.forEachTiddler.createExtraParameterErrorElement = function(place, actionName, parameter, firstUnusedIndex) {
	var message = "Extra parameter behind '"+actionName+"':";
	for (var i = firstUnusedIndex; i < parameter.length; i++) {
		message += " "+parameter[i];
	}
	this.handleError(place, mess