Welcome to TiddlyWiki created by Jeremy Ruston, Copyright © 2007 UnaMesa Association
Calls to make, or tasks that require a phone.
Items that require a computer, or computer related tasks.
Items that can be done at home.
Items that require internet access.
Items that can be done at work.
|>|>| !Selectors |
| ''Selector'' | ''Sample'' | ''Description'' |
| tag | H1 { color: blue ; } |Selects all of the specified HTML tags |
| class | .myClass { color: blue; } |Selects all HTML tags with the attribute class="myClass" specified |
| ID | #tag56 { color: blue; } |Selects the single HTML tag with the attibute ID="tag56" specified |
| Grouping | H1, H2, H3 { color: blue ; } | selects all specified selectors (tags, class, or ID can be specified) |
| Contextual | H1 B { color: red; } |selects all 'B' tags in H1. Context selectors can be tag, class, or ID selectors |
|>|>|>| !Units |
| ''Type'' | ''Unit'' | ''Description'' |
| Length | mm, cm, in |millimeters, centimeters, inches |
|~| pt, pc |point size, pica |
|~| em, ex |relative to the point size of the font, relative to x-height of the font |
|~| px |pixel (device dependent) |
| Percentage | % |calculated as a percentage of their default size used in context |
| Keywords | .. | ... |
| Color | <name> |Color names ex: green see: ColorNames |
|~| rgb() |specify number or percengate rgb(100%, 0, 100%) |
|~| <hex value> |specify hex RGB number of color ex: #00FF00 see: ColorChart |
|>|>|>| !Font Properties |
| ''Property'' | ''Valid Values'' | ''Example'' | ''Inherited?'' |
| font-family |[font name or type] | font-family: Verdana, Arial; | Y |
| font-style |normal, italic | font-style:italic; | Y |
| font-variant |normal, small-cap | font-variant:small-caps; | Y |
| font-weight |normal, bold | font-weight:bold; | Y |
| font-size |[ xx-large, x-large, large, medium, small, x-small, xx-small ], [ larger, smaller ], \\percentage'\\, //length// | font-size:12pt; | Y |
| font |[//font-style// / //font-variant// / //font-weight//] ? //font-size// [//line-height//] ? //font-family// | font: bold 12pt Arial; | Y |
|>|>|>| !Color and Background Properties |
| ''Property'' | ''Valid Values'' | ''Example'' | ''Inherited?'' |
| color |//color // | color: red | Y |
| background-color |//color//, transparent | background-color: yellow | N* |
| background-image |//url//, none | background-image: url(house.jpg)| N* |
| background-repeat |repeat, repeat-x, repeat-y, no-repeat | background-repeat: no-repeat | N* |
| background-attachment |scroll, fixed | background-attachment: fixed | N* |
| background-position |[ //position// , //length// ], {1,2}, [ top, center, bottom ] -or- [ left, center, right ] | background-position: top center | N* |
| background |transparent, //color// -or- //url// -or- repeat -or- scroll -or- //position// | background: silver url(house.jpg) repeat-y | N* |
|>|>|>| !*Starting in CSS2, these properties are inherited. |
|>|>|>| !Text Properties |
| ''Property'' | ''Valid Values'' | ''Example'' | ''Inherited?'' |
| letter-spacing |normal, //length// | letter-spacing:5pt | Y |
| text-decoration |none, underline, overline, line-through | text-decoration:underline | N |
| vertical-align |sub, super, | vertical-align:sub | N |
| text-transform |capitalize, uppercase, lowercase, none | text-transform:lowercase | N |
| text-align |left, right, center, justify | text-align:center | N |
| text-indent |//length//, //percentage// | text-indent:25px | N |
| line-height |normal, //number//, //length//, //percentage// | line-height:15pt | N |
''The //CSS Box//''
<html>
<div style="color:black;background-color:#FFFFCC;padding:1em;border:thin solid black;text-align:center;width=30%">margin
<div style="color:white;background-color:black;padding:1em;border:thin solid black;text-align:center;width=100%">border
<div style="color:black;background-color:#FFCC99;padding:1em;border:thin solid black;text-align:center;width=100%">padding
<div style="color:black;background-color:white;border:thin solid black;text-align:center;width=100%">content<br/>
<div style="float:left"><-</div><div style="float:right">-></div>CSS 'width'
</div>
</div>
</div>
</div>
</html>
|>|>|>| !Box Properties |
| ''Property'' | ''Valid Values'' | ''Example'' | ''Inherited?'' |
| margin-top |//length//, //percentage//, auto | margin-top:5px | N |
| margin-right |//length//, //percentage//, auto | margin-right:5px | N |
| margin-bottom |//length//, //percentage//, auto | margin-bottom:1em | N |
| margin-left |//length//, //percentage//, auto | margin-left:5pt | N |
| margin |//length//, //percentage//, auto {1,4}| margin: 10px 5px 10px 5px | N |
| padding-top |//length//, //percentage// | padding-top:10%| N |
| padding-right |//length//, //percentage// | padding-right:15px | N |
| padding-bottom |//length//, //percentage// | padding-bottom:1.2em | N |
| padding-left |//length//, //percentage// | padding-left:10pt; } | N |
| padding |//length//, //percentage// {1,4}| padding: 10px 10px 10px 15px | N |
| border-top-width |thin, medium, thick, //length// | border-top-width:thin | N |
| border-right-width |thin, medium, thick, //length// | border-right-width:medium | N |
| border-bottom-width |thin, medium, thick, //length// | border-bottom-width:thick | N |
| border-left-width |thin, medium, thick, //length// | border-left-width:15px | N |
| border-width |thin, medium, thick, //length// {1,4}| border-width: 3px 5px 3px 5px | N |
| border-top-color |//color // | border-top-color:navajowhite | N |
| border-right-color |//color// | border-right-color:whitesmoke | N |
| border-bottom-color |//color// | border-bottom-color:black | N |
| border-left-color |//color// | border-left-color:#C0C0C0 | N |
| border-color |//color// {1,4} | border-color: green red white blue; } | N |
| border-top-style |none, solid, double, groove, ridge, inset, outset | border-top-style:solid | N |
| border-right-style |none, solid, double, groove, ridge, inset, outset | border-right-style:double | N |
| border-bottom-style |none, solid, double, groove, ridge, inset, outset | border-bottom-style:groove | N |
| border-left-style |none, solid, double, groove, ridge, inset, outset | border-left-style:none | N |
| border-style |none, solid, double, groove, ridge, inset, outset | border-style:ridge; }| N |
| border-top |//border-width//, //border-style//, //border-color// | border-top: medium outset red | N |
| border-right |//border-width//, //border-style//, //border-color// | border-right: thick inset maroon | N |
| border-bottom |//border-width//, //border-style//, //border-color// | border-bottom: 10px ridge gray | N |
| border-left |//border-width//, //border-style//, //border-color// | border-left: 1px groove red | N |
| border |//border-width//, //border-style//, //border-color// | border: thin solid blue | N |
| float |none, left, right | float:none | N |
| clear |none, left, right, both | clear:left | N |
|>|>|>| !Classification Properties |
| ''Property'' | ''Valid Values'' | ''Example'' | ''Inherited?'' |
| display |none, block, inline, list-item | display:none | N |
| list-style-type |disk, circle, square, decimal, lower-roman, upper-roman, lower-alpha, upper-alpha, none | list-style-type:upper-alpha | Y |
| list-style-image |//url//, none | list-style-image:url(icFile.gif) | Y |
| list-style-position |inside, outside | list-style-position:inside | Y |
| list-style |//keyword// -or- //position// -or- //url// | list-style: square outside url(icFolder.gif) | Y |
|>|>|>| !Positioning Properties |
| ''Property'' | ''Valid Values'' | ''Example'' | ''Applies Too'' | ''Inherited?'' |
| clip |//shape//, auto | clip:rect(0px 200px 200px 0px) | all element | N |
| height |//length//, auto | height:200px | DIV, SPAN and replaced element | N |
| left |//length//, //percentage//, auto | left:0px | absolutely and relatively positioned element | N |
| overflow |visible, hidden, scroll, auto | overflow:scroll | all element | N |
| position |absolute, relative, static | position:absolute | all element | N |
| top |//length//, //percentage//, auto | top:0px | absolutely and relatively positioned element | N |
| visibility |visible, hidden, inherit | visibility:visible | all element | N |
| width |//length//, //percentage//, auto | width:80%| DIV, SPAN and replaced element | N |
| z-index |auto, //integer// | z-index:-1| absolutely and relatively positioned element | N |
|>|>|>| !Printing Properties |
| ''Property'' | ''Valid Values'' | ''Example'' | ''Inherited?'' |
| page-break-before |auto, always -or- left, right | page-break-before:alway | N |
| page-break-after |auto, always -or- left, right | page-break-before:auto | N |
|>|>|>| !Pseudo Classes |
| ''Property'' | ''Valid Values'' | ''Example'' | ''Inherited?'' |
| cursor |auto, crosshair, default, hand, move, e-resize, ne-resize, nw-resize, n-resize, se-resize, sw-resize, s-resize, w-resize, text, wait, help | { cursor:hand; } | Y |
| active, hover, link, visited | n/a | a:hover { color:red; } | Y |
| first-letter, first-line |any font manipulating declaration | p:first-letter{ float:left;color:blue } | N |
/***
|''Name:''|CalendarMakerPlugin |
|''Version:''|$Revision: 1 $ |
|''Source:''|http://thePettersons.org/tiddlywiki.html#CalendarMakerPlugin |
|''Author:''|[[Paul Petterson]] |
|''Type:''|Macro Extension |
|''Requires:''|TiddlyWiki 1.2.33 or higher and the newerTiddler macro |
!Description
Builds a simple calendar that can be used to access tiddlers with date formatted names.
!Syntax
* {{{<<calendarMaker>>}}} - generates a calendar for this month
* {{{<<calendarMaker 2005 10>>}}} - generates a calendar for a particular month/year
!Sample Output
<<calendarMaker>>
!Sample Small Calendar (my target)
| !< |>|>|>|>| !October 2005 | !> |
| !Mon | !Tue | !Wed | !Thu | !Fri | !Sat | !Sun |
|>|>|>|>|bgcolor(gray): | 01 | 02 |
| 03 | 04 | 05 | 06 | 07 | 08 | 09 |
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |
| 31 |>|>|>|>|>|bgcolor(gray): |
!Known issues
* Must have the new wikifier introduced in version 1.2.33, won't work at all in older version of TW...
!Notes
* cleanup the dowIndex stuff - you don't really need it...
* Current Limitations (Stuff I plan on implementing)
** You can't set the first day of the week for display
** You can't change the size of the calendar
** You can't //browse// the calendar
** You can't change the button features
!Revision history
$History: CalendarMakerPlugin.js $
*
* ***************** Version 1 *****************
* User: paulpet Date: 2/26/06 Time: 7:44p
* Created in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* dusted it off!
v0.1 - October 4th, 2005 - initial public release (beta)
!Code
***/
//{{{
config.macros.calendarMaker = {
days:["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
shortDays:["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
months:["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
shortMonths:["Jan", "Feb", "Mar", "Apr", "May", "Jun", "July", "Aug", "Sept", "Oct", "Nov", "Dec"],
makeButton: function( d ) {
var y = d.getFullYear() ;
var m = d.getMonth() ;
var date = d.getDate();
var dateString = y + "/" + (m+1) + "/" + date ;
return "<<newerTiddler button:\"" + date + "\" name:\"Inbox " + dateString + "\" tags:\"[[My Inbox]] [[" + dateString + "]]\" text:\"!Today: " + d + "\">>" ;
},
handler: function(place,macroName,params) {
var dateNow = new Date() ;
var year = params[0] ? params[0] : dateNow.getFullYear() ;
var month = params[1] ? params[1] - 1 : dateNow.getMonth() ;
// validation
// if ( year < 100 ) year += 1900 ;
var start = null ;
try {
start = new Date( year, month, 1 ) ;
} catch(e) {
displayMessage( "Invalid Date year:" + year + " month:" + month ) ;
displayMessage( "Date Error: " + e ) ;
}
if ( start == null ) throw "Invalid Date Error" ;
var calendarOutput = "| !< |>|>|>|>| !" + config.macros.calendarMaker.months[ month ] + ", " + year + " | !> |\n"
calendarOutput += "|" ;
for( var i=0; i<config.macros.calendarMaker.shortDays.length; i++ )
calendarOutput += " !" + config.macros.calendarMaker.shortDays[i] + " |" ;
calendarOutput += "\n"
// skip weekdays until the 1st of the month
var dowIndex = 0 ;
if ( start.getDay() > 0 ) {
calendarOutput += "|" ;
while( ++dowIndex <= start.getDay()-1 )
calendarOutput += ">|" ;
calendarOutput += "bgcolor(gray): | " ;
}
while( start.getMonth() == month ) {
// if we start a new week, open up the table...
if ( dowIndex == 0 )
calendarOutput += "|" ;
// append the date to the calendar, increment the date, increment the day of the week index
calendarOutput += " " + this.makeButton( start ) + " |" ;
start.setDate( start.getDate() + 1 ) ;
dowIndex++ ;
// if we finished the week, close it off...
if ( dowIndex > 6 ) {
calendarOutput += "\n" ;
dowIndex = 0 ;
}
}
// fill in the unused weekdays of the last week
if ( dowIndex != 0 ) {
while( dowIndex++ < 6 )
calendarOutput += ">|" ;
calendarOutput += "bgcolor(gray): |\n" ;
}
wikify( calendarOutput, place, null, null ) ;
}}
//}}}
/***
This plugin is released under the [[Creative Commons Attribution 2.5 License|http://creativecommons.org/licenses/by/2.5/]]
***/
!Palette
| !Name | !Color & Usage |
|Background |bgcolor(#fff): [[ColorPalette::Background]] #fff |
|Foreground |bgcolor(#000): [[ColorPalette::Foreground]] #000 |
|PrimaryPale |bgcolor(#8cf): [[ColorPalette::PrimaryPale]] #8cf |
|PrimaryLight |bgcolor(#18f): [[ColorPalette::PrimaryLight]] #18f |
|PrimaryMid |bgcolor(#04b): [[ColorPalette::PrimaryMid]] #04b |
|PrimaryDark |bgcolor(#014): [[ColorPalette::PrimaryDark]] #014 |
|SecondaryPale |bgcolor(#ffc): [[ColorPalette::SecondaryPale]] #ffc |
|SecondaryLight |bgcolor(#fe8): [[ColorPalette::SecondaryLight]] #fe8 |
|SecondaryMid |bgcolor(#db4): [[ColorPalette::SecondaryMid]] #db4 |
|SecondaryDark |bgcolor(#841): [[ColorPalette::SecondaryDark]] #841 |
|TertiaryPale |bgcolor(#eee): [[ColorPalette::TertiaryPale]] #eee |
|TertiaryLight |bgcolor(#ccc): [[ColorPalette::TertiaryLight]] #ccc |
|TertiaryMid |bgcolor(#999): [[ColorPalette::TertiaryMid]] #999 |
|TertiaryDark |bgcolor(#666): [[ColorPalette::TertiaryDark]] #666 |
|Error |bgcolor(#f88): [[ColorPalette::Error]] #f88 |
!ColorCard
|>|>|bgcolor(#FFFFFF): @@color(#000000):Primary@@ |
|bgcolor(#006699): ~PrimaryPale |bgcolor(#6699CC): ~PrimaryMid |bgcolor(#99CCFF): ~PrimaryDark |
|bgcolor(#006699): #006699 |bgcolor(#6699CC): #6699CC |bgcolor(#99CCFF): #99CCFF |
|>|>|bgcolor(#000000): @@color(#FFFFFF):Secondary@@ |
|bgcolor(#FFFFFF):FFF FFF |bgcolor(#CCCCCC):CCC CCC |bgcolor(#999999):999 999 |bgcolor(#666666):@@color(white):666 666@@ |bgcolor(#333333):@@color(white):333 333@@ |bgcolor(#000000):@@color(white):000 000@@ |bgcolor(#FFCC00):FFC C00 |bgcolor(#FF9900):~FF9 900 |bgcolor(#FF6600):@@color(white):~FF6 600@@ |bgcolor(#FF3300):@@color(white):~FF3 300@@ |>|>|>|>|>| |
|bgcolor(#99CC00):99C C00 |>|>|>| |bgcolor(#CC9900):~CC9 900 |bgcolor(#FFCC33):FFC C33 |bgcolor(#FFCC66):FFC C66 |bgcolor(#FF9966):~FF9 966 |bgcolor(#FF6633):@@color(white):~FF6 633@@ |bgcolor(#CC3300):@@color(white):~CC3 300@@ |>|>|>| |bgcolor(#CC0033):@@color(white):~CC0 033@@ |
|bgcolor(#CCFF00):CCF F00 |bgcolor(#CCFF33):CCF F33 |bgcolor(#333300):@@color(white):333 300@@ |bgcolor(#666600):@@color(white):666 600@@ |bgcolor(#999900):999 900 |bgcolor(#CCCC00):CCC C00 |bgcolor(#FFFF00):FFF F00 |bgcolor(#CC9933):~CC9 933 |bgcolor(#CC6633):@@color(white):~CC6 633@@ |bgcolor(#330000):@@color(white):330 000@@ |bgcolor(#660000):@@color(white):660 000@@ |bgcolor(#990000):@@color(white):990 000@@ |bgcolor(#CC0000):@@color(white):~CC0 000@@ |bgcolor(#FF0000):@@color(white):~FF0 000@@ |bgcolor(#FF3366):@@color(white):~FF3 366@@ |bgcolor(#FF0033):@@color(white):~FF0 033@@ |
|bgcolor(#99FF00):99F F00 |bgcolor(#CCFF66):CCF F66 |bgcolor(#99CC33):99C C33 |bgcolor(#666633):@@color(white):666 633@@ |bgcolor(#999933):999 933 |bgcolor(#CCCC33):CCC C33 |bgcolor(#FFFF33):FFF F33 |bgcolor(#996600):@@color(white):996 600@@ |bgcolor(#993300):@@color(white):993 300@@ |bgcolor(#663333):@@color(white):663 333@@ |bgcolor(#993333):@@color(white):993 333@@ |bgcolor(#CC3333):@@color(white):~CC3 333@@ |bgcolor(#FF3333):@@color(white):~FF3 333@@ |bgcolor(#CC3366):@@color(white):~CC3 366@@ |bgcolor(#FF6699):@@color(white):~FF6 699@@ |bgcolor(#FF0066):@@color(white):~FF0 066@@ |
|bgcolor(#66FF00):66F F00 |bgcolor(#99FF66):99F F66 |bgcolor(#66CC33):66C C33 |bgcolor(#669900):669 900 |bgcolor(#999966):999 966 |bgcolor(#CCCC66):CCC C66 |bgcolor(#FFFF66):FFF F66 |bgcolor(#996633):@@color(white):996 633@@ |bgcolor(#663300):@@color(white):663 300@@ |bgcolor(#996666):@@color(white):996 666@@ |bgcolor(#CC6666):@@color(white):~CC6 666@@ |bgcolor(#FF6666):@@color(white):~FF6 666@@ |bgcolor(#990033):@@color(white):990 033@@ |bgcolor(#CC3399):@@color(white):~CC3 399@@ |bgcolor(#FF66CC):@@color(white):~FF6 6CC@@ |bgcolor(#FF0099):@@color(white):~FF0 099@@ |
|bgcolor(#33FF00):33F F00 |bgcolor(#66FF33):66F F33 |bgcolor(#339900):339 900 |bgcolor(#66CC00):66C C00 |bgcolor(#99FF33):99F F33 |bgcolor(#CCCC99):CCC C99 |bgcolor(#FFFF99):FFF F99 |bgcolor(#CC9966):~CC9 966 |bgcolor(#CC6600):@@color(white):~CC6 600@@ |bgcolor(#CC9999):~CC9 999 |bgcolor(#FF9999):~FF9 999 |bgcolor(#FF3399):@@color(white):~FF3 399@@ |bgcolor(#CC0066):@@color(white):~CC0 066@@ |bgcolor(#990066):@@color(white):990 066@@ |bgcolor(#FF33CC):@@color(white):~FF3 3CC@@ |bgcolor(#FF00CC):@@color(white):~FF0 0CC@@ |
|bgcolor(#00CC00):00C C00 |bgcolor(#33CC00):33C C00 |bgcolor(#336600):@@color(white):336 600@@ |bgcolor(#669933):669 933 |bgcolor(#99CC66):99C C66 |bgcolor(#CCFF99):CCF F99 |bgcolor(#FFFFCC):FFF FCC |bgcolor(#FFCC99):FFC C99 |bgcolor(#FF9933):~FF9 933 |bgcolor(#FFCCCC):FFC CCC |bgcolor(#FF99CC):~FF9 9CC |bgcolor(#CC6699):@@color(white):~CC6 699@@ |bgcolor(#993366):@@color(white):993 366@@ |bgcolor(#660033):@@color(white):660 033@@ |bgcolor(#CC0099):@@color(white):~CC0 099@@ |bgcolor(#330033):@@color(white):330 033@@ |
|bgcolor(#33CC33):33C C33 |bgcolor(#66CC66):66C C66 |bgcolor(#00FF00):00F F00 |bgcolor(#33FF33):33F F33 |bgcolor(#66FF66):66F F66 |bgcolor(#99FF99):99F F99 |bgcolor(#CCFFCC):CCF FCC |>|>| |bgcolor(#CC99CC):~CC9 9CC |bgcolor(#996699):@@color(white):996 699@@ |bgcolor(#993399):@@color(white):993 399@@ |bgcolor(#990099):@@color(white):990 099@@ |bgcolor(#663366):@@color(white):663 366@@ |bgcolor(#660066):@@color(white):660 066@@ |
|bgcolor(#006600):@@color(white):006 600@@ |bgcolor(#336633):@@color(white):336 633@@ |bgcolor(#009900):009 900 |bgcolor(#339933):339 933 |bgcolor(#669966):669 966 |bgcolor(#99CC99):99C C99 |>|>| |bgcolor(#FFCCFF):FFC CFF |bgcolor(#FF99FF):~FF9 9FF |bgcolor(#FF66FF):@@color(white):~FF6 6FF@@ |bgcolor(#FF33FF):@@color(white):~FF3 3FF@@ |bgcolor(#FF00FF):@@color(white):~FF0 0FF@@ |bgcolor(#CC66CC):@@color(white):~CC6 6CC@@ |bgcolor(#CC33CC):@@color(white):~CC3 3CC@@ |
|bgcolor(#003300):@@color(white):003 300@@ |bgcolor(#00CC33):00C C33 |bgcolor(#006633):@@color(white):006 633@@ |bgcolor(#339966):339 966 |bgcolor(#66CC99):66C C99 |bgcolor(#99FFCC):99F FCC |bgcolor(#CCFFFF):CCF FFF |bgcolor(#3399FF):339 9FF |bgcolor(#99CCFF):99C CFF |bgcolor(#CCCCFF):CCC CFF |bgcolor(#CC99FF):~CC9 9FF |bgcolor(#9966CC):@@color(white):996 6CC@@ |bgcolor(#663399):@@color(white):663 399@@ |bgcolor(#330066):@@color(white):330 066@@ |bgcolor(#9900CC):@@color(white):990 0CC@@ |bgcolor(#CC00CC):@@color(white):~CC0 0CC@@ |
|bgcolor(#00FF33):00F F33 |bgcolor(#33FF66):33F F66 |bgcolor(#009933):009 933 |bgcolor(#00CC66):00C C66 |bgcolor(#33FF99):33F F99 |bgcolor(#99FFFF):99F FFF |bgcolor(#99CCCC):99C CCC |bgcolor(#0066CC):@@color(white):006 6CC@@ |bgcolor(#6699CC):669 9CC |bgcolor(#9999FF):999 9FF |bgcolor(#9999CC):999 9CC |bgcolor(#9933FF):@@color(white):993 3FF@@ |bgcolor(#6600CC):@@color(white):660 0CC@@ |bgcolor(#660099):@@color(white):660 099@@ |bgcolor(#CC33FF):@@color(white):~CC3 3FF@@ |bgcolor(#CC00FF):@@color(white):~CC0 0FF@@ |
|bgcolor(#00FF66):00F F66 |bgcolor(#66FF99):66F F99 |bgcolor(#33CC66):33C C66 |bgcolor(#009966):009 966 |bgcolor(#66FFFF):66F FFF |bgcolor(#66CCCC):66C CCC |bgcolor(#669999):669 999 |bgcolor(#003366):@@color(white):003 366@@ |bgcolor(#336699):@@color(white):336 699@@ |bgcolor(#6666FF):@@color(white):666 6FF@@ |bgcolor(#6666CC):@@color(white):666 6CC@@ |bgcolor(#666699):@@color(white):666 699@@ |bgcolor(#330099):@@color(white):330 099@@ |bgcolor(#9933CC):@@color(white):993 3CC@@ |bgcolor(#CC66FF):@@color(white):~CC6 6FF@@ |bgcolor(#9900FF):@@color(white):990 0FF@@ |
|bgcolor(#00FF99):00F F99 |bgcolor(#66FFCC):66F FCC |bgcolor(#33CC99):33C C99 |bgcolor(#33FFFF):33F FFF |bgcolor(#33CCCC):33C CCC |bgcolor(#339999):339 999 |bgcolor(#336666):@@color(white):336 666@@ |bgcolor(#006699):@@color(white):006 699@@ |bgcolor(#003399):@@color(white):003 399@@ |bgcolor(#3333FF):@@color(white):333 3FF@@ |bgcolor(#3333CC):@@color(white):333 3CC@@ |bgcolor(#333399):@@color(white):333 399@@ |bgcolor(#333366):@@color(white):333 366@@ |bgcolor(#6633CC):@@color(white):663 3CC@@ |bgcolor(#9966FF):@@color(white):996 6FF@@ |bgcolor(#6600FF):@@color(white):660 0FF@@ |
|bgcolor(#00FFCC):00F FCC |bgcolor(#33FFCC):33F FCC |bgcolor(#00FFFF):00F FFF |bgcolor(#00CCCC):00C CCC |bgcolor(#009999):009 999 |bgcolor(#006666):@@color(white):006 666@@ |bgcolor(#003333):@@color(white):003 333@@ |bgcolor(#3399CC):339 9CC |bgcolor(#3366CC):@@color(white):336 6CC@@ |bgcolor(#0000FF):@@color(white):000 0FF@@ |bgcolor(#0000CC):@@color(white):000 0CC@@ |bgcolor(#000099):@@color(white):000 099@@ |bgcolor(#000066):@@color(white):000 066@@ |bgcolor(#000033):@@color(white):000 033@@ |bgcolor(#6633FF):@@color(white):663 3FF@@ |bgcolor(#3300FF):@@color(white):330 0FF@@ |
|bgcolor(#00CC99):00C C99 |>|>|>| |bgcolor(#0099CC):009 9CC |bgcolor(#33CCFF):33C CFF |bgcolor(#66CCFF):66C CFF |bgcolor(#6699FF):669 9FF |bgcolor(#3366FF):@@color(white):336 6FF@@ |bgcolor(#0033CC):@@color(white):003 3CC@@ |>|>|>| |bgcolor(#3300CC):@@color(white):330 0CC@@ |
|>|>|>|>|>| |bgcolor(#00CCFF):00C CFF |bgcolor(#0099FF):009 9FF |bgcolor(#0066FF):@@color(white):006 6FF@@ |bgcolor(#0033FF):@@color(white):003 3FF@@ |>|>|>|>|>| |
!Activities <<newActivity>>
<<list activities>>
!GTD Dashboard
<<GTDDashboard>>
See Also: [[My Projects]] and [[My Activities]]
PaulsNotepad PaulsPlugins Sandbox
|''Type:''|file|
|''URL:''|file://C:\Users\Paul\Documents\Visual Studio 2005\Projects\PaulsNotepad3.0.root\PaulsNotepad3.0\PaulsNotepad.html|
|''Workspace:''|(default)|
This tiddler was automatically created to record the details of this server
!Overview
''{{{<<forEach}}}''
//{{{listquery}}}// - what tiddlers you want to display
//{{{[listquery-parameters...]}}}// - the parameters, if any, required by the list function
//{{{[output]}}}// - a template to display output with *see output formatting
//{{{[forEach...]}}}// - a nested foreach statement which runs for each element in the previous list.
''{{{>>}}}''
# {{{listquery}}} - what tiddlers you want to display
#* {{{this}}} - the current tiddler only
#* any valid list function (all, missing, orphans, shadowed, touched, withTag, withTags, search)
#* //{{{[[tiddlerName]]}}} - the named tiddler//
#* //{{{[[tiddler::slice]]}}} - the tiddler referenced by the slice name//
# {{{listquery-parameter}}} - the parameters, if any, required by the list function
#* {{{literal-parameter}}} - any parameters are passed directly to the list query
#* //{{{[[tiddlerName]]}}} - the value of the named tiddler is passed as the parameter//
#* //{{{[[tiddler::slice]]}}} - the value of the slice is passed as the parameter//
#* {{{$variable}}} - any of the predefined forEach variables
# {{{output}}} - a template to display output with *see output formatting
#* //{{{NULL}}} - don't output anything//
#* {{{literal-output-string}}} - the literal string value is used as the template for the output. The literal output string can contain
#** {{{$variables}}} - any of the defined $variables
#** //{{{[[tiddler::slice]]}}} - the value of the slice//
#** //{{{[[$variable::slice]]}}} - the value of the slice of the tiddler referenced by the $variable (typically $title)//
#* //{{{[[tiddlerName]]}}} - the value of the named tiddler is used as the template for the output//
#* //{{{[[tiddler::slice]]}}} - the value of the slice is used as the template for the output//
# {{{[foreach...]}}} - a nested foreach statement, using the already defined formats to run for each element in the previous list.
!!Output Formatting
After forEach gets the list of tiddlers to process it starts to loop through them. For each tiddler it has, it will output one {{{output}}} formatted line of text to the wikifier for display. This {{{output}}} line can have $variables, slices, or """$variable:slices""" in it which will be substituted with values from the current (or upper) tiddler.
!!$variables
There are special variables that take on the value of the currently displaying tiddler content, they take on values from the currently listing tiddler. Note the '$$' variable - this is a special variable that's used when nesting forEach calls to display the attributes of 'deeper' listed tiddlers.
| !name | !description |
| $title |The title of the tiddler |
| $text |The Body of the tiddler |
| $modifier |Who last modified the tiddler |
| $modified |When the tiddler was last modified |
| $tags |The tags of the tiddler |
| $size |The size in characters of the body of the tiddler |
| $n |inserts a carrage return |
| $$ |inserts a $ |
!Using different list queries
# {{{<<forEach touched "* \"\"\"[[$title]]\"\"\" ">>}}} - Simple query displays the locally modified tiddlers
# {{{<<forEach search 'named tiddler' "* [[$title]]">>}}} - lists all tiddlers that contain the phrase 'named tiddler'
# {{{<<forEach this "| !\"\"\"$title\"\"\" |">>}}} - displays ''//this//'' tiddler as a table header
!Nesting forEach
!!Nesting Samples
# Simple Nesting - this lists all tiddlers tagged with ''systemConfig'' and then for each one of those, lists all the tiddlers that mention the title of this tiddler.
{{{
<<forEach withTags systemConfig "# [[$title]]"
forEach search $title "#* [[$$title]]"
>>
}}}
Notice that on the inner list, we use ''$title'' as a parameter to the search query and then ''$$title'' in the output. The single-$ $title refers to the first level tiddler title - in this case, the title of the tiddler with the systemConfig tag. The double-$ $$title refers to the second level tiddler title - in this example that is the title of the tiddler that contains the name of the tiddler that has the systemConfig tag.
# Nesting using ''//this//'' - you can use the ''//this//'' keyword as shown above in Using different list queries as the starting point for //taggly tagging// like queries.
//example to follow//
!Fancy Formatting
!!Creating Nested lists
!!Creating Tables
Here's a handy table that shows my task list:
{{{
<<forEach withTag Context "| !\"\"\"$title\"\"\" | \<\<newerTiddler button:'new' name:'New Task $title'\>\> |
|>|$text |"
forEach withTags [[$title]] AND NOT Complete "|[[$$title]] |\<\<newerTiddler button:'edit' name:'$$title'\>\> |"
>>
}}}
Each of my tasks is tagged with where I can or what I need to do the task, for example: @Calls - means I need a phone, @Work - means I do this at work, etc... I've created these different task 'contexts' an tagged them all with the tag Context. This way if I ned a new place or tool - I can easily create a new context - just create a new tiddler!
This sample displays each context title & description, along with a 'new' button to create a new task for that context. Then for each context, lists all the tasks that are also not tagged with 'Complete' - each task has an associated 'edit' button so I can easily open it (click on the title) or edit it (click on the button)
!!Nested Stuff in Tables - //this shouldn't be possible!//
Here's a fun one - we embed a second call to forEach as a macro-call in a table cell. This lets us put a list inside a table cell. Cool huh? //Becareful not to put a stace at the end of the output formattn lines for the tables - it will break TW's table formating.//
{{{
<<forEach withTag PaulsPlugins "| [[$title]] | $tags | $modified | $modifier | $size |
|>|>|>|>| children of $title |
|>|>|>|>|\<\<forEach withTag [[$title]] '* [[$$title]] '\>\>|">>
}}}
/***
|''Name:''|ForEachPlugin |
|''Version:''|$Revision: 8 $ |
|''Source:''|http://thePettersons.org/PaulsNotepad.html#ForEachPlugin |
|''Author:''|[[Paul Petterson]] |
|''Type:''|Macro Extension |
|''Requires:''|TiddlyWiki 1.2.36 or higher |
!Description
!!Syntax
''{{{<<forEach}}}''
//{{{listquery}}}// - what tiddlers you want to display
//{{{[listquery-parameters...]}}}// - the parameters, if any, required by the list function
//{{{[output]}}}// - a template to display output with *see output formatting
//{{{[forEach...]}}}// - a nested foreach statement which runs for each element in the previous list.
''{{{>>}}}''
''Special fields:''
| !name | !description |
| $title |The title of the tiddler |
| $text |The Body of the tiddler |
| $modifier |Who last modified the tiddler |
| $modified |When the tiddler was last modified |
| $tags |The tags of the tiddler |
| $size |The size in characters of the body of the tiddler |
| $n |inserts a carrage return |
| $$ |inserts a {{{$}}} |
To insert < and > characters, //quote// them like this: \< \>
!!Samples
{{{<<forEach>>}}}
{{{<<forEach orphans>>}}}
{{{<<forEach orphans "# [[$title]], $modified, $size">>}}}
{{{<<forEach withTag systemTiddlers "| $title | $tags | $modified | $modifier | $size |$n|$)|$)|$)|$)|$text |">>}}}
''Note:'' it is possible to call macros from within forEach by using \<\<macro\>\> more complicated examples available on the ForEachPluginTests page.
See [[ForEachDocumentation]] for more information
!Todo
<<projectTemplate>>
!Revision history
$History: ForEachPlugin.js $
*
* ***************** Version 8 *****************
* User: paulpet Date: 7/08/07 Time: 5:48p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* removed un-needed newlines when nothing is output - now nesting looks
* nicer.
*
* ***************** Version 7 *****************
* User: paulpet Date: 3/03/06 Time: 1:13p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* removed need for all them $n's
*
* ***************** Version 6 *****************
* User: paulpet Date: 2/28/06 Time: 1:49p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* fixed this bug referencing inner most tiddler instead of outer most
* tiddler...
*
* ***************** Version 5 *****************
* User: paulpet Date: 2/27/06 Time: 4:47p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* added some better documentation.
*
* ***************** Version 4 *****************
* User: paulpet Date: 2/27/06 Time: 4:02p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* added THIS support
*
* ***************** Version 3 *****************
* User: paulpet Date: 2/27/06 Time: 3:57p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* added self recursion (not wikifier recursion)
*
* ***************** Version 2 *****************
* User: paulpet Date: 2/26/06 Time: 1:49p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* ported to TW 2.0
v0.1 - October 28th 2005 - it works so far...
!Code
***/
//{{{
// Code...
config.macros.forEach = {
parser: function( params ) {
var res = new Object() ;
res.listTypeName = params[0]?params[0]:"all";
var next = params.length-1 ;
if ( params.length > 1 )
for( var i=0; i<params.length; i++ )
if ( params[i].toUpperCase() == "FOREACH" ) {
next = i-1;
break;
}
res.listTypeParams = (( next > 0 )?params.slice( 0, next ):[]) ;
res.formatter = (next>0)?params[next]:"* [[$title]]" ;
res.next = (next<(params.length-1))?params.slice(next+2):[]
return res ;
},
displayFieldValue: function( t, p ) {
try {
if (typeof(t) == "string" ) {
var t1 = store.tiddlers[t] ;
if ( t1 == null ) return p+":"+t ;
if ( p == "size" ) return t1.text.length ;
return t1[p] ;
} else {
if ( p == "size" ) return t.text.length ;
return t[p] ;
}
} catch( e ) {
displayMessage("Error while displaying tiddler: " + e.description ) ;
return "//error on " + t + "[" + p + "]//" ;
}
},
specialCharacters: function( d, t, str, p1 ) {
var r = "?" ;
switch( p1 ) {
case "title":
case "text":
case "modified":
case "modifier":
case "size":
case "tags": r = d( t, p1 ) ; break ;
case "(": r = "<" ; break ;
case ")": r = ">" ; break ;
case "n": r = "\n" ; break ;
case "$": r = "$" ; break ;
default:
r = p1 ;
}
return r ;
},
formatter: function( t, fmt ) {
var result = fmt.replace(/([^\\])|\\([\\]*[^nr])/ig, "$1$2");
var d = this.displayFieldValue;
var sc = this.specialCharacters;
result = result.replace( /\$([\$]*(?:title|text|modified|modifier|size|tags|\(|\)|n|\$))/ig, function(s,p1) { return sc( d, t, s, p1 ); });
return result ;
},
fixupParams: function( t, next ) {
var newNext = new Array();
for( var i=0; i<next.length; i++ )
newNext.push( this.formatter( t, next[i] ));
return newNext ;
},
runner: function( params, tiddler ) {
var outStr = "", sep = "" ;
var p = this.parser( params ) ;
var results;
if ( p.listTypeName.toUpperCase() == "THIS" ) {
results = [ tiddler ] ;
} else {
if ( config.macros.list[ p.listTypeName ] )
results = config.macros.list[ p.listTypeName ].handler( p.listTypeParams ) ;
}
if ( results )
for ( var ti = 0; ti < results.length; ti++) {
var t = results[ti] ;
var o = this.formatter( t, p.formatter ) ;
// var lc = outStr.substring(outStr.length-1)
if ( o != null && o.length > 0 ) {
outStr += sep + o ;
sep = "\n" ;
}
if ( p.next.length > 0 ) {
var subResults = this.runner( this.fixupParams( t, p.next ), t );
if ( subResults != null && subResults.length > 0 )
outStr += sep + subResults ;
sep = "\n" ;
}
}
return outStr ;
},
handler: function( place, macroName, params, wikifier,paramString,tiddler ) {
var t = story.findContainingTiddler( place ) ;
var name = (t?t.id.substr(story.idPrefix.length):"NA") ;
var realTiddler = store.fetchTiddler( name ) ;
if ( realTiddler == null )
realTiddler = tiddler ;
var outStr = this.runner( params, realTiddler ) ;
wikify( outStr, place ) ;
}}
//}}}
/***
This plugin is released under the [[Creative Commons Attribution 2.5 License|http://creativecommons.org/licenses/by/2.5/]]
***/
!Simple
<<forEach withTag systemConfig "| [[$title]] | $modified | $size |">>
!Complex Nested List
<<forEach withTag PaulsPlugins "| [[$title]] | $tags | $modified | $modifier | $size |
|$)|$)|$)|$)| children of $title |
|$)|$)|$)|$)|\<\<forEach withTag [[$title]] '| [[$$title]] | $$tags | $$modified | $$modifier | $$size |'\>\>|">>
!Recursive Test 1
<<forEach withTag PaulsPlugins "|>| ![[$title]] | $tags | $modified |$n|\>|\>|\>| children of $title |"
foreach withTag [[$title]] "| [[$title]] | [[$$title]] | $$tags | $$modified |">>
!THIS test
<<forEach this "Name: $title$nSize: $size$nModified: $modified">>
Note: it is possible to call macros from within forEach by using $($(macro$)$) more complicated examples available on the ForEachPluginTests page.
!Wacky one for the GTD plugin...
{{{<<forEach withTag [[My Activities]] "|>|![[$title]] |$n|$($(forEach withTags Test1 AND $title '|| [[$$title]] |'$)$)|">>}}}
!New Ideas...
{{{
<<foreach this "|>|>| !Project: $title |\n"
forEach withTag [[My Activities]] "|>| Activity: $title | Created |\n"
forEach withTag $title "|$title |$$title |$$created |$n">>
}}}
For Each parser:
* Searches for a single nested ''forEach'' - saves it's position in 'nextThing' or sets it too params.length
* Builds call to list handler
** If handler is THIS
*** return something special to signify we're not using list, like NULL
** Else
*** everything from 'handler' to nextThing -1 (or -2... not sure) becomes handler parameters array
*** params[0] == "list", params[1] == "handler", params[2]... handler parameters
* saves 'next thing' -1 as the output string
* Saves 'next thing' and on as parameters array ot next call
For Each Runner:
* call the for each parser with parameters
* if we're running list
** executes list handler getting results array
* else
** create an array with 'tiddler' in it (from handler() parameters)
* for each item in results array
** perform parameter substitution on the output string, append it to the output string
** if next thing exists
*** perform parameter subsititution on the 'next thing' array elements
*** recursively call For Each Runner with the new 'next thing' array as parameters.
**** append it's results to the output string
* finally - return the output string.
For Each:
* call For Each Runnier with parameters, tiddler, place, etc...
* get return string and call wikify() on it.
!Simple
{{{
<<forEach withTag systemConfig "| [[$title]] | $modified | $size |">>
}}}
!Complex Nested List
{{{
<<forEach withTag PaulsPlugins "| [[$title]] | $tags | $modified | $modifier | $size |
|$)|$)|$)|$)| children of $title |
|$)|$)|$)|$)|\<\<forEach withTag [[$title]] '| [[$$title]] | $$tags | $$modified | $$modifier | $$size |'\>\>|">>
}}}
!Recursive Test 1
{{{
<<forEach withTag PaulsPlugins "|>| ![[$title]] | $tags | $modified |$n|\>|\>|\>| children of $title |"
foreach withTag [[$title]] "| [[$title]] | [[$$title]] | $$tags | $$modified |">>
}}}
!THIS test
{{{<<forEach this "Name: $title$nSize: $size$nModified: $modified">>}}}
Note: it is possible to call macros from within forEach by using $($(macro$)$) more complicated examples available on the ForEachPluginTests page.
!Wacky one for the GTD plugin...
{{{<<forEach withTag [[My Activities]] "|>|![[$title]] |$n|$($(forEach withTags Test1 AND $title '|| [[$$title]] |'$)$)|">>}}}
The center of my organizing world... that's GTD - this project is all about writing some simple TW things to do just that!
Plugin: GettingThingsDonePlugin
Tests: GettingThingsDoneTests & GTDTests1
<<projectTemplate>>
----
{{{<<GTDDashboard>>}}}
<<GTDDashboard>>
{{{<<projectTemplate>>}}}
<<projectTemplate>>
{{{<<quickActions>>}}}
<<quickActions>>
{{{<<quickActions foo1>>}}}
<<quickActions foo1>>
/***
|''Name:''|GettingThingsDonePlugin |
|''Version:''|$Revision: 4 $ |
|''Source:''|http://thePettersons.org/tiddlywiki.html#GettingThingsDonePlugin |
|''Author:''|[[Paul Petterson]] |
|''Type:''|TiddlyWiki Application Package |
|''Requires:''|TiddlyWiki 2.2.X or higher, NewerTiddler Plugin, and ListWithTagsPlugin |
!Description
Getting Things Done - my way of managing the workload.
A Project is any tiddler tagged with 'My Projects' (or whatever you have set
as your project tag).
Contexts - or task types are any tags that are themselves tiddlers with the
'Context' tag associated with them.
An activity is any tiddler that is assigned a Context tag. If an activity
also has a Project tag, then it's an activity assigned to a project - otherwise
it's a global/project-less activity.
If an activity is assigned the tag 'NA' then it becomes the 'next action' this
is the thing you should do next.
!Todo
See: GTDProject
!Revision history
$History: GettingThingsDonePlugin.js $
*
* ***************** Version 4 *****************
* User: paulpet Date: 7/13/07 Time: 9:33p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/GTD/systemConfig
* Removed all the un-needed macros, now most GTD stuff is done in forEach
* and stored in shadow tiddlers. Reference data is not done yet. Found a
* weird bug in ListWithTags.
*
* ***************** Version 3 *****************
* User: paulpet Date: 7/08/07 Time: 6:09p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/GTD/systemConfig
* GTD Checkpoint - project templates all converted over to forEach macro,
* nice looking stuff! :)
*
* ***************** Version 2 *****************
* User: paulpet Date: 3/06/06 Time: 7:20a
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/GTD/systemConfig
*
* ***************** Version 1 *****************
* User: paulpet Date: 2/26/06 Time: 9:53p
* Created in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/GTD/systemConfig
* checkpoint
! Your GTD Configuration
Edit these to match the way you think - if you call a Project something else,
like 'Job' then rename the project related settings to be Job centric. When you
reload you TW you'll be using the new settings. If you have customized any
shadow tiddlers, then you will have to re-customize them again.
***/
//{{{
config.GTD = {
ed:"edit",
projectHeader: "!My Projects",
projectsTag: "My Projects",
newProjectButton: "New Project",
contextHeader: "!Contexts",
contextTag: "Context",
newContextButton: "New Context",
inboxHeader: "!Inbox",
newInboxButton: "Edit Today",
inboxTiddlerName: "$title - Inbox for MMM DD, YYYY",
dashboardInboxTiddlerName: "Inbox for MMM DD, YYYY",
inboxTag: "Inbox",
additionalGlobalInboxTags: "OR [[Journal]] OR [[TiddlySnip]]",
nextActionHeader: "!Next Actions",
actionHeader: "!Actions",
nextActionTag: "NA",
completeHeader: "!Complete Actions",
completeTag: "Complete",
quickActionLabel: "New Activity: ",
txtNew: "New ",
txtNewAction: "All Actions should be physical in nature (ie: you must DO something) and can be completed in 1 sitting."
};
//}}}
/***
----
! Shadow Tiddlers
These shadow tiddlers are really the heart & soul of this GTD implementation. They all use the ForEachPlugin to show the appropriate information and functions. To customize these, don't edit them here but edit the shadow tiddler itself in you TW. That way if you mess it up, you can just delete it and get the working version back.
***/
//{{{
config.GTD.shadowTiddlers = {
MyProjectsShadow: [
"<<forEach this ",
" \"" + config.GTD.projectHeader + " - \\<\\<newerTiddler button:'" + config.GTD.newProjectButton + "' tags:'[[$title]]' template:'DefaultProjectTemplate'\\>\\>\" ",
" foreach withTag [[$title]] \"* [[$$title]] \\<\\<newerTiddler button:'" + config.GTD.ed + "' name:'$$title'\\>\\>\" ",
">>"
].join("\n"),
ContextShadow: [
"<<forEach this ",
" \"" + config.GTD.contextHeader + " - \\<\\<newerTiddler button:'" + config.GTD.newContextButton + "' tags:'[[$title]]'\\>\\>\" ",
" foreach withTag [[$title]] \"* [[$$title]] \\<\\<newerTiddler button:'" + config.GTD.ed + "' name:'$$title'\\>\\>\" ",
">>"
].join("\n"),
ProjectDashboard: [
"<<forEach this \"\\<\\<tabs 'tab$title' ",
" 'Inbox' 'Items to be processed for this project' ProjectTemplateInbox ",
" 'Next Actions' 'Next Actions for this project' ProjectTemplateActions ",
" 'Reference' 'Reference materials for this project' ProjectTemplateReferences ",
" 'Completed' 'Completed Actions for this project' ProjectTemplateComplete\\>\\>\" ",
">>"
].join("\n"),
GTDDashboard:[
"<<tabs tabDashboard ",
" 'Projects' 'All Projects' DashboardTemplateProjects ",
" 'Inbox' 'All Items to be processed' DashboardTemplateInbox ",
" 'Next Actions' 'All Next Actions' DashboardTemplateActions ",
" 'Reference' 'All Reference Materials' DashboardTemplateReferences ",
" 'Completed' 'All Completed Actions' DashboardTemplateComplete",
">>"
].join("\n"),
DefaultProjectTemplate: [
"Describe Project Here...",
"----",
"<<projectTemplate>>"
].join("\n"),
ProjectTemplateInbox: [
"<<forEach this ",
" \"" + config.GTD.inboxHeader + " - \\<\\<newerTiddler button:'" + config.GTD.newInboxButton + "' name:'" + config.GTD.inboxTiddlerName + "' tags:'" + config.GTD.inboxTag + " [[$title]]'\\>\\>\"",
" forEach withTags [[$title]] and " + config.GTD.inboxTag + " \"* [[$$title]] \\<\\<newerTiddler button:'" + config.GTD.ed + "' name:'$$title'\\>\\>\"",
">>"
].join("\n"),
ProjectTemplateActions:[
"<<forEach this \"" + config.GTD.nextActionHeader + "\" forEach withTag [[" + config.GTD.contextTag + "]] \"\"",
" forEach withTags [[$title]] and [[$$title]] and [[" + config.GTD.nextActionTag + "]] and not [[" + config.GTD.completeTag + "]]",
" \"* $$title - [[$$$title]] \\<\\<newerTiddler button:'" + config.GTD.ed + "' name:'$$$title'\\>\\>\"",
">>",
"<<forEach this \"" + config.GTD.actionHeader + "$n\\<\\<quickActions [[$title]]\\>\\>\"",
" forEach withTag [[" + config.GTD.contextTag + "]] \"\" ",
" forEach withTags [[$title]] and [[$$title]] and not [[" + config.GTD.nextActionTag + "]] and not [[" + config.GTD.completeTag + "]]",
" \"|[[$$title]] |[[$$$title]] |\\<\\<newerTiddler button:'" + config.GTD.ed + "' name:'$$$title'\\>\\> |\"",
">>"
].join("\n"),
ProjectTemplateComplete:[
"<<forEach this \"" + config.GTD.completeHeader + "\" ",
" forEach withTag [[" + config.GTD.contextTag + "]] \"\" ",
" forEach withTags [[$title]] and [[$$title]] and [[" + config.GTD.completeTag + "]]",
" \"|$$title |[[$$$title]] | \\<\\<newerTiddler button:'edit' name:'$$$title'\\>\\> |\"",
">>"
].join("\n"),
ProjectTemplateReferences:[
""
].join("\n"),
DashboardTemplateProjects:[
"<<forEach this \"" + config.GTD.projectHeader + " - \\<\\<newerTiddler button:'" + config.GTD.newProjectButton + "' tags:'[[" + config.GTD.projectsTag + "]]' template:'DefaultProjectTemplate'\\>\\>\"",
" foreach withTag [[" + config.GTD.projectsTag + "]] \"* [[$$title]] \\<\\<newerTiddler button:'edit' name:'$$title'\\>\\>\"",
">>"
].join("\n"),
DashboardTemplateInbox:[
"<<forEach this \"" + config.GTD.inboxHeader + " - \\<\\<newerTiddler button:'" + config.GTD.newInboxButton + "' name:'" + config.GTD.dashboardInboxTiddlerName + "' tags:'[[" + config.GTD.inboxTag + "]]'\\>\\>\" ",
" forEach withTags [[" + config.GTD.inboxTag + "]] " + config.GTD.additionalGlobalInboxTags,
" \"* [[$$title]] \\<\\<newerTiddler button:'" + config.GTD.ed + "' name:'$$title'\\>\\>\"",
">>"
].join("\n"),
DashboardTemplateActions:[
config.GTD.nextActionHeader,
"<<forEach withTag [[" + config.GTD.contextTag + "]] \"\" ",
" forEach withTags [[$title]] and [[" + config.GTD.nextActionTag + "]] and not [[" + config.GTD.completeTag + "]]",
" \"* $title - [[$$title]] \\<\\<newerTiddler button:'" + config.GTD.ed + "' name:'$$title'\\>\\>\"",
">>",
config.GTD.actionHeader,
"<<quickActions>>",
"<<forEach withTag [[" + config.GTD.contextTag + "]] \"\" ",
" forEach withTags [[$title]] and not [[" + config.GTD.completeTag + "]] and not [[" + config.GTD.nextActionTag + "]] \"|[[$title]] |[[$$title]] |\\<\\<newerTiddler button:'" + config.GTD.ed + "' name:'$$title'\\>\\> |\"",
">>"
].join("\n"),
DashboardTemplateComplete:[
config.GTD.completeHeader,
"<<forEach withTag [[" + config.GTD.contextTag + "]] \"\" ",
" forEach withTags [[$title]] and [[" + config.GTD.completeTag + "]]",
" \"|$title |[[$$title]] | \\<\\<newerTiddler button:'" + config.GTD.ed + "' name:'$$title'\\>\\> |\"",
">>"
].join("\n"),
DashboardTemplateReferences:[
""
].join("\n")
};
// now bootstrap the shadow tiddlers
merge( config.shadowTiddlers, config.GTD.shadowTiddlers );
// shadow tiddlers for the special tags - "My Projects" and "Context" - copy them from the default shadow tiddlers
config.GTD.shadowTiddlers[config.GTD.projectsTag] = config.GTD.shadowTiddlers.MyProjectsShadow ;
config.GTD.shadowTiddlers[config.GTD.contextTag] = config.GTD.shadowTiddlers.ContextShadow;
//}}}
/***
----
|''Name:''|quickActions |
|''Type:''|Macro Extension |
|''Requires:''|TiddlyWiki 1.2.36 or higher |
!Description
Creates a set of buttons, one for each activity type, which in turn create a new tiddler tagged appropriately to be a new action of the specified type for the specified project.
!!Parameters
(optional) the name of the project to add as a tag.
!!Samples
{{{<<quickActions>>}}}
{{{<<quickActions someProject>>}}}
!!Code
***/
//{{{
config.macros.quickActions= {
handler: function(place,macroName,params) {
var project = params[0] ;
var wikiText = config.GTD.quickActionLabel ;
var button = "<<newerTiddler button:\"%0\" name:\"%1\" tags:\"%2\" text:\"%3\">>" ;
var actions = store.getTaggedTiddlers(config.GTD.contextTag) ;
//for( var action in actions ) {
for (var a = 0; a < actions.length; a++) {
var action = actions[a] ;
if ( action instanceof Tiddler ) {
var buttonText = config.GTD.txtNew + action.title ;
var defaultText = config.GTD.txtNewAction ;
var tags = (project?(String.encodeTiddlyLink(project)+" "+String.encodeTiddlyLink(action.title)):String.encodeTiddlyLink(action.title)) ;
var b = button.format( [buttonText, buttonText, tags, defaultText] );
wikiText += b ;
}
}
wikify( wikiText, place ) ;
}} ;
//}}}
/***
----
|''Name:''|GTD Dashboard |
|''Type:''|Macro Extension |
|''Requires:''|TiddlyWiki 1.2.36 or higher |
!Description
Shows the GTD Dashboard, which is a set of tabs containing your projects, inbox, actions, reference marerial, and accomplishments.
The dashboard is stored in the shadow tiddler [[GTDDashboard]] - edit this to customize your dashboard
!!Samples
{{{<<GTDDashboard>>}}}
!!Code
***/
//{{{
config.macros.GTDDashboard = {
handler: function(place, macroName, params) {
var wikiText = "<<tiddler GTDDashboard>>";
wikify( wikiText, place ) ;
}} ;
//}}}
/***
----
|''Name:''|Project Template |
|''Type:''|Macro Extension |
|''Requires:''|TiddlyWiki 1.2.36 or higher |
!Description
Shows a project specific Dashboard.
The dashboard is stored in the shadow tiddler ProjectDashboard - edit this to customize your dashboard.
!!Samples
{{{<<projectTemplate>>}}}
!!Code
***/
//{{{
config.macros.projectTemplate= {
handler: function(place, macroName, params) {
var wikiText = "<<tiddler ProjectDashboard>>" ;
wikify( wikiText, place ) ;
}} ;
//}}}
/***
This plugin is released under the [[Creative Commons Attribution 2.5 License|http://creativecommons.org/licenses/by/2.5/]]
***/
//{{{
! TBD
So how do you test a tagging system?
Beats me...
|>|>| !Greek Letters |
| !Symbol | !upper-case | !lower-case |
| Alpha | Α | α |
| Beta | Β | β |
| Gamma | Γ | γ |
| Delta | Δ | δ |
| Epsilon | Ε | ε |
| Zeta | Ζ | ζ |
| Eta | Η | η |
| Theta | Θ | θ |
| Thetasym | ϑ | |
| Iota | Ι | ι |
| Kappa | Κ | κ |
| Lambda | Λ | λ |
| Mu | Μ | μ |
| Nu | Ν | ν |
| Xi | Ξ | ξ |
| Omicron | Ο | ο |
| Pi | Π | π |
| Pi | π | |
| Rho | Ρ | ρ |
| Sigma | Σ | σ |
| Tau | Τ | τ |
| Upsilon | Υ | υ |
| Upsilon | ϒ | |
| Phi | Φ | φ |
| Chi | Χ | χ |
| Psi | Ψ | ψ |
| Omega | Ω | ω |
/***
|''Name:''|HorizontalMainMenuStyleSheet |
|''Version:''|$Revision: 2 $ |
|''Source:''|http://thePettersons.org/PaulsNotepad.html#HorizontalMainMenuStyleSheet |
|''Author:''|[[Paul Petterson]] |
|''Type:''|Style Sheet Extension |
|''Requires:''|TiddlyWiki 2.0.0 or higher |
!Description
Styles used to in support of a modified PageTemplate that moves the
main menu into the header of the page and makes it's horizontal instead
of vertical.
!Revision history
$History: HorizontalMainMenuStyleSheet.css $
*
* ***************** Version 2 *****************
* User: paulpet Date: 12/10/06 Time: 9:44p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsNotepad/excludeLists
* checkpoint
*
* ***************** Version 1 *****************
* User: paulpet Date: 12/09/06 Time: 9:43p
* Created in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsNotepad/excludeLists
* checkpoint
*
* ***************** Version 2 *****************
* User: paulpet Date: 2/22/06 Time: 12:33p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsNotepad
* look and feel beginning to take shape!
!Rules
***/
/*{{{*/
#mainMenu {
padding: 2px;
position: static;
width: auto;
text-align: left;
}
#mainMenu a, #mainMenu .button {
text-decoration: none;
line-height: 100%;
margin: 0;
padding: 0;
}
#mainMenu ul {
margin: .25em;
}
#mainMenu li {
display: inline;
list-style-type: none;
margin: 0em .5em 0em .5em;
line-height: 100%;
}
#mainMenu br {
display: none;
}
/* resize the display area to allow for no left column */
#displayArea {
margin: .5em 19em 0 1em;
}
/* Widen up the right column */
#sidebar {
position: absolute;
right: 3px;
width: 20em;
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: 19em;
overflow: hidden;
}
/*}}}*/
|>|>| !Whitespace |
| !Symbol | !Character | !Description |
| nbsp | |non-breaking space |
| ensp |   |en space |
| emsp |   |em space |
| thinsp |   |thin space |
| zwnj | ‌ |zero width non-joiner |
| zwj | ‍ |zero width joiner |
| lrm | ‎ |left-to-right mark |
| rlm | ‏ |right-to-left mark |
| shy | ­ |soft hyphen |
|>|>| !Money |
| !Symbol | !Character | !Description |
| cent | ¢ |cent sign |
| pound | £ |pound sign |
| curren | ¤ |currency sign |
| yen | ¥ |yen sign |
| euro | € |euro sign |
|>|>| !Symbols |
| !Symbol | !Character | !Description |
| copy | © |copyright sign |
| reg | ® |registered trade mark |
| trade | ™ |trade mark sign |
| ordm | º |masculine ordinal indicator |
| ordf | ª |feminine ordinal indicator |
| dagger | † |dagger |
| Dagger | ‡ |double dagger |
| bull | • |bullet |
| spades | ♠ |spade |
| clubs | ♣ |club |
| hearts | ♥ |heart |
| diams | ♦ |diamond |
|>|>| !Lines |
| !Symbol | !Character | !Description |
| macr | ¯ |overline |
| brvbar | ¦ |broken vertical bar |
| ndash | – |en dash |
| mdash | — |em dash |
| oline | ‾ |overline |
| lceil | ⌈ |left ceiling |
| rceil | ⌉ |right ceiling |
| lfloor | ⌊ |left floor |
| rfloor | ⌋ |right floor |
|>|>| !Arrows |
| !Symbol | !Character | !Description |
| larr | ← |left arrow |
| uarr | ↑ |up arrow |
| rarr | → |right arrow |
| darr | ↓ |down arrow |
| harr | ↔ |left right arrow |
| crarr | ↵ |down arrow with corner leftwards / carriage return |
| lArr | ⇐ |left double arrow |
| uArr | ⇑ |up double arrow |
| rArr | ⇒ |right double arrow |
| dArr | ⇓ |down double arrow |
| hArr | ⇔ |left right double arrow |
|>|>| !Punctuation |
| !Symbol | !Character | !Description |
| iexcl | ¡ |inverted exclamation mark |
| iquest | ¿ |inverted question mark |
| uml | ¨ |diaeresis |
| acute | ´ |acute accent |
| para | ¶ |paragraph sign |
| sect | § |section sign |
| cedil | ¸ |cedilla |
| amp | & |ampersand |
| apos | ' |apostrophe mark |
| circ | ˆ |circumflex accent |
| tilde | ˜ |small tilde |
| hellip | … |horizontal ellipsis |
|>|>| !Quotations |
| !Symbol | !Character | !Description |
| quot | " |quotation mark |
| raquo | » |right double angle quotation mark |
| laquo | « |left double angle quotation mark |
| lsquo | ‘ |left single quotation mark |
| rsquo | ’ |right single quotation mark |
| sbquo | ‚ |single low-9 quotation mark |
| ldquo | “ |left double quotation mark |
| rdquo | ” |right double quotation mark |
| bdquo | „ |double low-9 quotation mark |
| lsaquo | ‹ |single left-pointing angle quotation mark |
| rsaquo | › |single right-pointing angle quotation mark |
<<forEach this "!Journal Entries - \<\<newJournal 'DD MMM YYYY' [[$title]]\>\>$n"
foreach withTag [[$title]] OR [[Inbox]]"* [[$$title]] last updated: $modified by $modifier$n">>
|>|>| !Latin Letters |
| !Symbol | !upper-case | !lower-case |
| Agrave | À | à |
| Aacute | Á | á |
| Acirc | Â | â |
| Atilde | Ã | ã |
| Auml | Ä | ä |
| Aring | Å | å |
| ~AElig | Æ | æ |
| Ccedil | Ç | ç |
| Egrave | È | è |
| Eacute | É | é |
| Ecirc | Ê | ê |
| Euml | Ë | ë |
| Igrave | Ì | ì |
| Iacute | Í | í |
| Icirc | Î | î |
| Iuml | Ï | ï |
| ETH | Ð | ð |
| Ntilde | Ñ | ñ |
| Ograve | Ò | ò |
| Oacute | Ó | ó |
| Ocirc | Ô | ô |
| Otilde | Õ | õ |
| Ouml | Ö | ö |
| Oslash | Ø | ø |
| Ugrave | Ù | ù |
| Uacute | Ú | ú |
| Ucirc | Û | û |
| Uuml | Ü | ü |
| Yacute | Ý | ý |
| THORN | Þ | þ |
| Yuml | Ÿ | ÿ |
| ~OElig | Œ | œ |
| Scaron | Š | š |
| szlig | ß | |
[img[http://creativecommons.org/images/public/somerights20.png][http://creativecommons.org/licenses/by/2.5/]]
This work is licensed under a [[Creative Commons Attribution 2.5 License|http://creativecommons.org/licenses/by/2.5/]]
Like life, the [[plugins|PaulsPlugins]] in this TiddlyWiki come with no guarantees, use at your own risk.
----
Also available here is code contributed by the following people:
TiddlyWiki is Copyright (c) [[Osmosoft Limited|http://www.osmosoft.com]] 2004-2006 and released under the BSD license (available in the source)
<html><!-- <rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><Work rdf:about=""><license rdf:resource="http://creativecommons.org/licenses/by/2.5/" /><dc:type rdf:resource="http://purl.org/dc/dcmitype/InteractiveResource" /></Work><License rdf:about="http://creativecommons.org/licenses/by/2.5/"><permits rdf:resource="http://web.resource.org/cc/Reproduction"/><permits rdf:resource="http://web.resource.org/cc/Distribution"/><requires rdf:resource="http://web.resource.org/cc/Notice"/><requires rdf:resource="http://web.resource.org/cc/Attribution"/><permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/></License></rdf:RDF> --></html>
/***
|''Name:''|ListSearchPlugin |
|''Version:''|$Revision: 2 $ |
|''Source:''|http://thePettersons.org/tiddlywiki.html#ListWithTagsPlugin |
|''Author:''|[[Paul Petterson]] |
|''Type:''|List Macro Extension |
|''Requires:''|TiddlyWiki 2.0.0 or higher |
!Description
Extends the TiddlyWiki ''list'' macro by adding the capability to list tiddlers that have a word or phrase in them.
!Syntax
* {{{<<list search foo>>}}}
* {{{<<list search "and or">>}}}
!Sample Output
* {{{<<list search paul>>}}}
<<list search paul>>
!Revision history
$History: ListSearchPlugin.js $
*
* ***************** Version 2 *****************
* User: paulpet Date: 2/25/06 Time: 7:33p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* ported to TW 2.0
*
* ***************** Version 1 *****************
* User: paulpet Date: 2/24/06 Time: 1:40p
* Created in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
v0.0.1 - October 19th 2005 - oneliner 'lookie this' release.
!Code
***/
//{{{
config.macros.list.search = {
handler: function(params) {
return store.search( params[1], "title", "excludeSearch");
}}
//}}}
/***
This plugin is released under the [[Creative Commons Attribution 2.5 License|http://creativecommons.org/licenses/by/2.5/]]
***/
/***
|''Name:''|ListWithTagPlugin |
|''Version:''|$Revision: 2 $ |
|''Source:''|http://thePettersons.org/tiddlywiki.html#ListWithTagPlugin |
|''Author:''|[[Paul Petterson]] |
|''Type:''|List Macro Extension |
|''Requires:''|TiddlyWiki 1.2.32 or higher |
!Description
Extends the TiddlyWiki ''list'' macro by adding the capability to list all tiddlers with a given tag.
!Syntax
{{{<<list withTag systemConfig>>}}}
!Sample Output
<<list withTag systemConfig>>
!Known issues
!Notes
!Revision history
$History: ListWithTagPlugin.js $
*
* ***************** Version 2 *****************
* User: paulpet Date: 2/22/06 Time: 11:10a
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
!Code
***/
//{{{
config.macros.list.withTag = {
handler: function(params) {
return store.getTaggedTiddlers(params[1]);
}}
//}}}
/***
This plugin is released under the [[Creative Commons Attribution 2.5 License|http://creativecommons.org/licenses/by/2.5/]]
***/
/***
|''Name:''|ListWithTagsPlugin |
|''Version:''|$Revision: 7 $ |
|''Source:''|http://thePettersons.org/tiddlywiki.html#ListWithTagsPlugin |
|''Author:''|[[Paul Petterson]] |
|''Type:''|List Macro Extension |
|''Requires:''|TiddlyWiki 1.2.32 or higher |
!Description
Extends the TiddlyWiki ''list'' macro by adding the capability to list tiddlers that have a tag, a set of tags, or a complex criteria of tags. You can use tags, AND, OR, NOT (or && for AND, || for OR, and ! for NOT) as well as paranthese when building your expression.
!Syntax
* {{{<<list withTags Projects and Todo and not done>>}}}
* {{{<<list withTags Tasks and (Urgent or Important)>>}}}
!Sample Output
''Example:'' lists all systemConfig that aren't also tagged with system (tests shorter/longer bug) and aren't also tagged with a big ugly non-existant tag. - so it should list systemTiddlers only!
{{{<<list withTags systemConfig and not OIJDSFOIJSDFOIJSDFOIJSDF and not system>>}}}
<<list withTags systemConfig and not OIJDSFOIJSDFOIJSDFOIJSDF and not system>>
!Known Issues
* Any tags that contain a logical keyword (and, or, not) aren't recognized as tags.
!Revision history
$History: ListWithTagsPlugin.js $
*
* ***************** Version 7 *****************
* User: paulpet Date: 7/08/07 Time: 5:52p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* fixed special character bug & bug when removing some unknown words at
* EOL or BOL from the query
*
* ***************** Version 6 *****************
* User: paulpet Date: 7/03/07 Time: 10:05p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* added twRunner support - fixed documentation
*
* ***************** Version 5 *****************
* User: paulpet Date: 7/03/07 Time: 6:21p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* fixed space in non-existant tag (ala: withTags no such tag and
* systemConfig) - fixed longer/shorter tag bug
*
* ***************** Version 4 *****************
* User: paulpet Date: 7/02/07 Time: 7:14a
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* still broke :(
*
* ***************** Version 3 *****************
* User: paulpet Date: 2/26/06 Time: 1:49p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* ported to TW 2.0
*
* ***************** Version 2 *****************
* User: paulpet Date: 2/26/06 Time: 8:47a
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
*
!Older Revision History
v1.0.2 November 5th 2005 - fixed bugs arounding handling non-existing tags sometimes screwing up the expression.
v1.0.1 October 12th 2005 - fixed bugs with single char tags, and tags with symbols in them showing up as non-existant tags.
v1.0 October 11th, 2005 - Fixed all known bugs!
<<<
''Fixed:''
* If a tag used in the expression doesn't exist (no tiddlers have that tag) then nothing will get listed.
* If a tag //contains// another tag, then using the shorter tag will list results from the shorter and longer tags. For example if you have the tags ''test'' and ''testing'' and use ''test'' in an expression it will match tiddlers with both ''test'' and ''testing'' tags.
* {{{<<list withTags not systemConfig>>}}} doesn't work but {{{<<list withTags !systemConfig>>}}} does.
<<<
v0.8 first public release (on purpose!)
v0.7.5 fixed some bugs relating to non-existant tags throwing exceptions (simple comment block)
v0.7 first accidental public release (no comment block on that one)
!Unit Tests
See: ListWithTagsTests
<<twRunner ListWithTagsTests>>
!Code
***/
//{{{
version.extensions.ListWithTags = {
major: 1,
minor: 0,
revision: new Number( '$Revision: 7 $'.match( /\$[^\d]+([\d]+)[^\$]*\$/im )[1] ) ,
date: new Date( '$JustDate: 7/08/07 $'.match( /\$[^\d]+([\d\/\/]+)[^\$]*\$/im )[1].replace(/(\d+\/\d+\/)(\d+)/img, "$120$2") )
};
config.macros.list.withTags = {
makeTagRegexp: function() {
// build us a regex of all our tags as a big-old regex that
// OR's the tags together (tag1|tag2|tag3...) in length order
var tgs = store.getTags();
if ( tgs.length == 0 ) return null ;
var tags = tgs.sort( function(a,b) { return (a[0].length < b[0].length) - (a[0].length > b[0].length) ; } );
var tags2 = [];
for( var i=0; i<tags.length; i++ )
tags2[i] = tags[i][0].replace( /\s/g, "\\\\s" );
var exp = "(\\s|^)(" + tags2.join("|") + ")(\\s|$)" ; // use tag with space or BOL/EOL on either side.
exp = exp.replace( /(,[\d]+)/g, "" ) ;
return new RegExp( exp, "ig" );
},
newCleaner: function( params, cond ) {
var tags = config.macros.list.withTags.makeTagRegexp() ;
var step0 = params.slice(1).join(" ");
var step1 = step0.replace( tags, "$1|$3" ) ;
var step2 = step1.replace( /(?:^|\s|\||\(|\))(?:and)(?:\s|\||\(|\))/gi, "|" ) ;
var step2 = step2.replace( /(?:^|\s|\||\(|\))(?:or)(?:\s|\||\(|\))/gi, "|" ) ;
var step2 = step2.replace( /(?:^|\s|\||\(|\))(?:not)(?:\s|\||\(|\))/gi, "|" ) ;
var step3 = "|" + step2.replace( /[\(\)]+|[&\|]{2}|[!]{1}|[\s]+/gi, "|" ) + "|" ;
var step4 = step3.replace( /\|{2,}/g, "|" ) ;
var step5 ;
if (step4.length > 1 ) {
step5 = "(\\(|\\)|\\!|\\s|^)" + step4.substr(1, step4.length - 2) + "(\\(|\\)|\\!|\\s|\\n|$)" ;
} else {
step5 = null ;
}
var removedBadTags = cond.replace( new RegExp( step5, "g" ), "$1false$2" ) ;
return removedBadTags.replace( /(false\s?){2,}(\s?)/gi, "$1$2" );
},
regexpBuilder: function(params) {
var regex = this.makeTagRegexp() ;
// build us string such that an expression that looks like this:
// "tag1 AND tag2 OR NOT tag3" turns into :
// /tag1/.test(...) && /tag2/.test(...) || ! /tag2/.test(...)
var cond = params.slice(1).join(" ");
cond = cond.replace( regex, "$1/$2\\|/.test(tiddlerTags)$3" );
cond = cond.replace( /\sand\s/ig, " && " ) ;
cond = cond.replace( /\sor\s/ig, " || " ) ;
cond = cond.replace( /\s?not\s/ig, " ! " ) ;
return cond ;
},
handler: function(params) {
var results = [];
if ( !params || !params[1] ) return config.macros.list.all.handler( params );
var cond = this.newCleaner( params, this.regexpBuilder( params )) ;
if ( cond == null ) return results ;
// look through the tiddlers, make a string of the tags in the tiddler
// and eval the 'cond' string we made against that string -
// if it's TRUE then the tiddler qualifies!
store.forEachTiddler( function( title, tiddler ) {
var tiddlerTags = (tiddler.tags?tiddler.tags.join("|"):"")+"|" ;
try {
if ( eval( cond ) ) results.push( tiddler );
} catch( e ) {
//if ( this[twd-logger] ) this[twd-logger].logMsg( "exception on eval()=" + e.description ) ;
//displayMessage( "Exception = '" + e + "'" ) ;
}
});
return results.sort(function (a,b) { return (a[0] > b[0]) - (a[0] < b[0]); });
}}
//}}}
/***
This plugin is released under the [[Creative Commons Attribution 2.5 License|http://creativecommons.org/licenses/by/2.5/]]
***/
/***
| !Tests Round 1 |
| !not first |
|{{{<<list withTags not systemConfig>>}}} |
|<<dumpCondition withTags not systemConfig>> |
| !not nontag first |
|{{{<<list withTags not notatag>>}}} |
|<<dumpCondition withTags not notatag>> |
| !tag vs subtag |
|{{{<<list withTags systemConfig and not system>>}}} |
|<<dumpCondition withTags systemConfig and not system>> |
| !@symbols |
|{{{<<list withTags @Call and not Complete>>}}} |
|<<dumpCondition withTags @Call and not Complete>> |
| !nontags |
|{{{<<list withTags notatag and not Complete>>}}} |
|<<dumpCondition withTags notatag and not Complete>> |
| !paranthese #1 |
|{{{<<list withTags (@Call and not Complete)>>}}} |
|<<dumpCondition withTags (@Call and not Complete)>> |
| !paranthese #2 |
|{{{<<list withTags @Call and (not Complete)>>}}} |
|<<dumpCondition withTags @Call and (not Complete)>> |
| !paranthese #3 |
|{{{<<list withTags (@Call) and not (Complete)>>}}} |
|<<dumpCondition withTags (@Call) and not (Complete)>> |
| !paranthese & nontag #1 |
|{{{<<list withTags (notatag and not Complete)>>}}} |
|<<dumpCondition withTags (notatag and not Complete)>> |
| !paranthese & nontag #2 |
|{{{<<list withTags @Call and (not notatag)>>}}} |
|<<dumpCondition withTags @Call and (not notatag)>> |
| !paranthese & nontag #3 |
|{{{<<list withTags (notatag) and not (Complete)>>}}} |
|<<dumpCondition withTags (notatag) and not (Complete)>> |
| !spaces in tags |
|{{{<<list withTags My Projects>>}}} |
|<<dumpCondition withTags My Projects>> |
| !spaces in non-tags |
|{{{<<list withTags Big Dog>>}}} |
|<<dumpCondition withTags Big Dog>> |
| !Honken Big'un |
|{{{<<list withTags GTDPluginSampleOutput and ( (!@Agenda) and (!@Call) and (!@Computer) and (!@Errand) and (!@Home) and (!@Someday) and (!@Waiting) and (!@Work) )>>}}} |
|<<dumpCondition withTags GTDPluginSampleOutput and ( (!@Agenda) and (!@Call) and (!@Computer) and (!@Errand) and (!@Home) and (!@Someday) and (!@Waiting) and (!@Work) )>> |
|{{{<<list withTags GTDPluginSampleOutput and ((!@Agenda) and (!@Call) and (!@Computer) and (!@Errand) and (!@Home) and (!@Someday) and (!@Waiting) and (!@Work))>>}}} |
|<<dumpCondition withTags GTDPluginSampleOutput and ((!@Agenda) and (!@Call) and (!@Computer) and (!@Errand) and (!@Home) and (!@Someday) and (!@Waiting) and (!@Work))>> |
|{{{<<list withTags GTDPluginSampleOutput and (!@Agenda and !@Call and !@Computer and !@Errand and !@Home and !@Someday and !@Waiting and !@Work)>>}}} |
|<<dumpCondition withTags GTDPluginSampleOutput and (!@Agenda and !@Call and !@Computer and !@Errand and !@Home and !@Someday and !@Waiting and !@Work)>> |
|{{{<<list withTags GTDPluginSampleOutput and not (@Agenda or @Call or @Computer or @Errand or @Home or @Someday or @Waiting or @Work)>>}}} |
|<<dumpCondition withTags GTDPluginSampleOutput and not (@Agenda or @Call or @Computer or @Errand or @Home or @Someday or @Waiting or @Work)>> |
|{{{<<list withTags GTDPluginSampleOutput and not ( @Agenda or @Call or @Computer or @Errand or @Home or @Someday or @Waiting or @Work )>>}}} |
|<<dumpCondition withTags GTDPluginSampleOutput and not ( @Agenda or @Call or @Computer or @Errand or @Home or @Someday or @Waiting or @Work )>> |
!Test Code
***/
//{{{
config.macros.dumpCondition = {
handler: function( place, macroName, params ) {
var cond = params.slice(1).join(" ")
var tags = config.macros.list.withTags.makeTagRegexp().toString() ;
var preClean = config.macros.list.withTags.regexpBuilder( params ) ;
var postClean = config.macros.list.withTags.newCleaner(cond, preClean ) ;
tags=tags.replace(/\|/g, "| ");
var ol = createTiddlyElement( place, "ol", null, null, null ) ;
createTiddlyElement( ol, "li", null, null, "Condition: " + cond ) ;
createTiddlyElement( ol, "li", null, null, "Tags: " + tags ) ;
createTiddlyElement( ol, "li", null, null, "PreClean: " + preClean ) ;
createTiddlyElement( ol, "li", null, null, "PostClean: " + postClean ) ;
// var newCleaner = new RegExp( config.macros.lwtTry.makeCleaner( ol, cond ), "g" ) ;
// var newClean = preClean.replace( newCleaner, "$1false$2" ) ;
// createTiddlyElement( ol, "li", null, null, "NewCleaner: '" + newCleaner + "'" ) ;
// createTiddlyElement( ol, "li", null, null, "NewClean: '" + newClean + "'" ) ;
}
}
//}}}
!List withTags Testing
!!Simple Single Condition Parsing Tests
<<twUnit "single existing tag"
var paramStr = "withTags systemConfig";
var params = paramStr.readMacroParams();
var expected = '/systemConfig\\|/.test(tiddlerTags)' ;
var rx = config.macros.list.withTags.regexpBuilder( params );
var actual = config.macros.list.withTags.newCleaner( params , rx );
this.AssertSame( expected, actual, "Parse Failure." );
>>
<<twUnit "single non-existing tag"
var paramStr = "withTags somethingNotATag" ;
var params = paramStr.readMacroParams();
var expected = 'false' ;
var rx = config.macros.list.withTags.regexpBuilder( params );
var actual = config.macros.list.withTags.newCleaner( params , rx );
this.AssertSame( expected, actual, "Parse Failure." );
>>
<<twUnit "single quoted non-existing tag"
var paramStr = "withTags [[somethingNotATag]]" ;
var params = paramStr.readMacroParams();
var expected = 'false' ;
var rx = config.macros.list.withTags.regexpBuilder( params );
var actual = config.macros.list.withTags.newCleaner( params , rx );
this.AssertSame( expected, actual, "Parse Failure." );
>>
<<twUnit "negated single existing tag"
var paramStr = "withTags not systemConfig" ;
var params = paramStr.readMacroParams();
var expected = ' ! /systemConfig\\|/.test(tiddlerTags)' ;
var rx = config.macros.list.withTags.regexpBuilder( params );
var actual = config.macros.list.withTags.newCleaner( params , rx );
this.AssertSame( expected, actual, "Parse Failure." );
>>
<<twUnit "negated single non-existing tag"
var paramStr = "withTags not somethingNotATag" ;
var params = paramStr.readMacroParams();
var expected = ' ! false' ;
var rx = config.macros.list.withTags.regexpBuilder( params );
var actual = config.macros.list.withTags.newCleaner( params , rx );
this.AssertSame( expected, actual, "Parse Failure." );
>>
<<twUnit "single non-existing tag with space"
var paramStr = "withTags big dog" ;
var params = paramStr.readMacroParams();
var expected = 'false' ;
var rx = config.macros.list.withTags.regexpBuilder( params );
var actual = config.macros.list.withTags.newCleaner( params , rx );
this.AssertSame( expected, actual, "Parse Failure." );
>>
<<twUnit "single non-existing quoted tag with space"
var paramStr = "withTags [[big dog]]" ;
var params = paramStr.readMacroParams();
var expected = 'false' ;
var rx = config.macros.list.withTags.regexpBuilder( params );
var actual = config.macros.list.withTags.newCleaner( params , rx );
this.AssertSame( expected, actual, "Parse Failure." );
>>
!!Two Term Condition Parsing Tests
<<twUnit "two tags AND"
var paramStr = "withTags PaulsPlugins and systemConfig" ;
var params = paramStr.readMacroParams();
var expected = '/PaulsPlugins\\|/.test(tiddlerTags) && /systemConfig\\|/.test(tiddlerTags)' ;
var rx = config.macros.list.withTags.regexpBuilder( params );
var actual = config.macros.list.withTags.newCleaner( params , rx );
this.AssertSame( expected, actual, "Parse Failure." );
>>
<<twUnit "two tags NOT AND"
var paramStr = "withTags not PaulsPlugins and systemConfig" ;
var params = paramStr.readMacroParams();
var expected = ' ! /PaulsPlugins\\|/.test(tiddlerTags) && /systemConfig\\|/.test(tiddlerTags)' ;
var rx = config.macros.list.withTags.regexpBuilder( params );
var actual = config.macros.list.withTags.newCleaner( params , rx );
this.AssertSame( expected, actual, "Parse Failure." );
>>
<<twUnit "two tags (one doesn't exist) NOT AND"
var paramStr = "withTags not PauliesPlugins and systemConfig" ;
var params = paramStr.readMacroParams();
var expected = ' ! false && /systemConfig\\|/.test(tiddlerTags)' ;
var rx = config.macros.list.withTags.regexpBuilder( params );
var actual = config.macros.list.withTags.newCleaner( params , rx );
this.AssertSame( expected, actual, "Parse Failure." );
>>
<<twUnit "two tags (one with space doesn't exist) AND"
var paramStr = "withTags big dog and systemConfig" ;
var params = paramStr.readMacroParams();
var expected = 'false && /systemConfig\\|/.test(tiddlerTags)' ;
var rx = config.macros.list.withTags.regexpBuilder( params );
var actual = config.macros.list.withTags.newCleaner( params , rx );
this.AssertSame( expected, actual, "Parse Failure." );
>>
<<twUnit "two non-existant tags (one with space) OR"
var paramStr = "withTags big dog OR blahblah" ;
var params = paramStr.readMacroParams();
var expected = 'false || false' ;
var rx = config.macros.list.withTags.regexpBuilder( params );
var actual = config.macros.list.withTags.newCleaner( params , rx );
this.AssertSame( expected, actual, "Parse Failure." );
>>
<<twUnit "two non-existing multi-word tags"
var paramStr = "withTags big dog OR blah blah blah OR yadda yadda yadda blah blah blah" ;
var params = paramStr.readMacroParams();
var expected = 'false || false || false' ;
var rx = config.macros.list.withTags.regexpBuilder( params );
var actual = config.macros.list.withTags.newCleaner( params , rx );
this.AssertSame( expected, actual, "Parse Failure." );
>>
!shorter/longer tag bug
<<twUnit "short parameter longer tag bug"
var paramStr = "withTags system" ;
var params = paramStr.readMacroParams();
var expected = 'false' ;
var rx = config.macros.list.withTags.regexpBuilder( params );
var actual = config.macros.list.withTags.newCleaner( params , rx );
this.AssertSame( expected, actual, "Parse Failure." );
>>
<<twUnit "longer parameter shorter tag bug"
var paramStr = "withTags systemConfiguration" ;
var params = paramStr.readMacroParams();
var expected = 'false' ;
var rx = config.macros.list.withTags.regexpBuilder( params );
var actual = config.macros.list.withTags.newCleaner( params , rx );
this.AssertSame( expected, actual, "Parse Failure." );
>>
!! not tag bug
<<twUnit "not tag bug"
var paramStr = "withTags not systemConfig" ;
var params = paramStr.readMacroParams();
var expected = ' ! /systemConfig\\|/.test(tiddlerTags)' ;
var rx = config.macros.list.withTags.regexpBuilder( params );
var actual = config.macros.list.withTags.newCleaner( params , rx );
this.AssertSame( expected, actual, "Parse Failure." );
>>
!! special characters bug
<<twUnit "special characters bug"
var paramStr = "withTags @Work AND NOT something OR @Calls" ;
var params = paramStr.readMacroParams();
var expected = '/@Work\\|/.test(tiddlerTags) && ! false || /@Calls\\|/.test(tiddlerTags)' ;
var rx = config.macros.list.withTags.regexpBuilder( params );
var actual = config.macros.list.withTags.newCleaner( params , rx );
this.AssertSame( expected, actual, "Parse Failure." );
>>
<<twUnit "specialized withtags test"
var paramStr = "withTags @Calls OR @Home OR @Work and not Complete and not NA"
var params = paramStr.readMacroParams();
var expected = 'false || false || /@Work\\|/.test(tiddlerTags) && ! false && ! false' ;
var rx = config.macros.list.withTags.regexpBuilder( params );
var actual = config.macros.list.withTags.newCleaner( params , rx );
this.AssertSame( expected, actual, "Parse Failure." );
>>
<<twUnit "my projects bug?"
var paramStr = "withTags My Projects"
var params = paramStr.readMacroParams();
var expected = '/My Projects\\|/.test(tiddlerTags)';
var rx = config.macros.list.withTags.regexpBuilder( params );
var actual = config.macros.list.withTags.newCleaner( params , rx );
this.AssertSame( expected, actual, "Parse Failure." );
>>
* [[Home|PaulsNotepad]]
* [[Dashboard]]
* <<tag [[My Projects]]>>
* <<tag Context>>
* [[Journal]]
* [[Sandbox]]
* PaulsPlugins
* WorkInProgress
* <<newTiddler>>
* <<newJournal "DD MMM YYYY" Journal>>
* v<<version>>
|>|>| !Math |
| !Symbol | !Character | !Description |
| deg | ° |degree sign |
| plusmn | ± |plus or minus sign |
| times | × |multiplication sign |
| divide | ÷ |division sign |
| lt | < |less-than sign |
| gt | > |greater-than sign |
| lang | ⟨ |left angle bracket |
| rang | ⟩ |right angle bracket |
| not | ¬ |not sign |
| sup1 | ¹ |superscript one |
| sup2 | ² |superscript two |
| sup3 | ³ |superscript three |
| middot | · |middle dot |
| frac14 | ¼ |one quarter |
| frac12 | ½ |one half |
| frac34 | ¾ |three quarters |
| permil | ‰ |per mille sign |
| fnof | ƒ |latin small f with hook (function) |
| prime | ′ |prime / minutes / feet |
| Prime | ″ |double prime / seconds / inches |
| frasl | ⁄ |fraction slash |
| weierp | ℘ |script capital P |
| image | ℑ |bold I / imaginary part |
| real | ℜ |bold R / real part |
| alefsym | ℵ |first transfinite cardinal |
| micro | µ |micro sign |
| forall | ∀ |for all |
| part | ∂ |partial differential |
| exist | ∃ |there exists |
| empty | ∅ |empty set / diameter |
| nabla | ∇ |backward difference |
| isin | ∈ |element of |
| notin | ∉ |not an element of |
| ni | ∋ |contains as member |
| prod | ∏ |product sign |
| sum | ∑ |n-ary sumation |
| minus | − |minus sign |
| lowast | ∗ |asterisk operator |
| radic | √ |square root / radical |
| prop | ∝ |proportional to |
| infin | ∞ |infinity |
| ang | ∠ |angle |
| and | ∧ |logical and |
| or | ∨ |logical or |
| cap | ∩ |intersection |
| cup | ∪ |union |
| int | ∫ |integral |
| there4 | ∴ |therefore |
| sim | ∼ |similar to |
| cong | ≅ |approximately equal to |
| asymp | ≈ |almost equal to |
| ne | ≠ |not equal to |
| equiv | ≡ |identical to |
| le | ≤ |less-than or equal to |
| ge | ≥ |greater-than or equal to |
| sub | ⊂ |subset of |
| sup | ⊃ |superset of |
| nsub | ⊄ |not a subset of |
| sube | ⊆ |subset of or equal to |
| supe | ⊇ |superset of or equal to |
| oplus | ⊕ |direct sum |
| otimes | ⊗ |vector product |
| perp | ⊥ |orthogonal to / perpendicular |
| sdot | ⋅ |dot operator |
Using this you click on a special "bookmark" then you can move your mouse over any element and see details on it, its parents and children. You can also modify your page's DOM interactively. Very handy for tweaking your StyleSheet.
http://slayeroffice.com/tools/modi/v2.0/modi_help.html
!Activities <<newActivity>>
<<list activities>>
!Projects <<newProject>>
<<list projects>>
/***
|''Name:''|NewerTiddlerPlugin|
|''Version:''|$Revision: 2 $ |
|''Source:''|http://thePettersons.org/tiddlywiki.html#NewerTiddlerPlugin |
|''Author:''|[[Paul Petterson]] |
|''Type:''|Macro Extension |
|''Requires:''|TiddlyWiki 1.2.33 or higher |
!Description
Create a 'new tiddler' button with lots more options! Specify the text to show on the button, the name of the new tiddler (with date macro expansion), one or more tags for the new tiddlers, and what text if any to include in the new tiddler body! Uses a named parameter format, simalar to the reminder plugin.
Also - if the tiddler already exists it won't replace any of it's existing data (like tags).
!Syntax
* {{{<<newerTiddler button:"Inbox" name:"Inbox YYYY/MM/DD" tags:"Journal, inbox" text:"New stuff for today:">>}}}
* {{{<<newerTiddler button:"@Action" name:"Action: what" tags:"@Action" text:"Add project and describe action">>}}}
* {{{<<newerTiddler button:"New Project" name:"Project Name?" tags:"My Projects, My Inbox, Journal" template:"MyTemplate">>}}}
!!Parameters
* name:"Name of Tiddler"
* tags:"Tag1, Tag2, Tag3" - tags for new tiddler, comma seperated //don't use square brackets //({{{[[}}})// for tags!//
* button:"name for button" - the name to display instead of "new tiddler"
* body:"what to put in the tiddler body"
* template:"Name of a tiddler containing the text to use as the body of the new tiddler"
''Note:'' if you sepecify both body and template parameters, then template parameter will be used and the body parameter overridden.
!Sample Output
* <<newerTiddler button:"Inbox" name:"Inbox YYYY/MM/DD" tags:"Journal inbox" text:"New stuff for today:">>
* <<newerTiddler button:"@Action" name:"Action: what" tags:"@Action" text:"Add project and describe action">>
* <<newerTiddler button:"New Project" name:"Project Name?" tags:"[[My Projects]] [[My Inbox]] Journal" template:"MyTemplate">>
!Todo
<<projectTemplate>>
!Known issues
* Must use double quotes (") around parameter values if they contain a space, can't use single quotes (').
* can't use standard bracketted style tags, ust type in the tags space and all and put a comma between them. For example tags:"one big tag, another big tag" uses 2 tags ''one big tag'' and ''another big tag''.
!Notes
* It works fine, and I use it daily, however I haven't really tested edge cases or multiple platforms. If you run into bugs or problems, let me know!
!Requests
* Have delta-date specifiers on the name: name:"Inbox YYY/MM/DD+1" ( ceruleat@gmail.com )
* Option to just open the tiddler instead of immediately edit it ( ceruleat@gmail.com )
* Have date formatters in tags as well as in name (me)
!Revision history
$History: NewerTiddlerPlugin.js $
*
* ***************** Version 2 *****************
* User: paulpet Date: 2/26/06 Time: 7:25p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* Port to tw2.0, bug fixes, and simplification!
v1.0.2 (not released) - fixed small documentation issues.
v1.0.1 October 13th - fixed a bug occurring only in FF
v1.0 October 11th - Initial public release
v0.8 October 10th - Feature complete...
v0.7 Initial public preview
!Code
***/
//{{{
config.macros.newerTiddler = {
name:"New(er) Tiddler",
tags:"",
text:"Type Tiddler Contents Here.",
button:"new(er) tiddler",
reparse: function( params ) {
var re = /([^:\'\"\s]+)(?::([^\'\":\s]+)|:[\'\"]([^\'\"\\]*(?:\\.[^\'\"\\]*)*)[\'\"])?(?=\s|$)/g;
var ret = new Array() ;
var m ;
while( (m = re.exec( params )) != null )
ret[ m[1] ] = m[2]?m[2]:m[3]?m[3]:true ;
return ret ;
},
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
if ( readOnly ) return ;
var input = this.reparse( paramString ) ;
var tiddlerName = input["name"]?input["name"].trim():config.macros.newerTiddler.name ;
var tiddlerTags = input["tags"]?input["tags"]:config.macros.newerTiddler.tags ;
var tiddlerBody = input["text"]?input["text"]:config.macros.newerTiddler.text ;
var buttonText = input["button"]?input["button"]:config.macros.newerTiddler.button ;
var template = input["template"]?input["template"]:null;
// if there is a template, use it - otherwise use the tiddlerBody text
if ( template ) {
tiddlerBody = store.getTiddlerText( template );
}
if ( tiddlerBody == null || tiddlerBody.length == 0 )
tiddlerBody = config.macros.newerTiddler.text ;
var now = new Date() ;
tiddlerName = now.formatString( tiddlerName ) ;
createTiddlyButton( place, buttonText, "", function() {
var exists = store.tiddlerExists( tiddlerName );
var t = store.createTiddler( tiddlerName );
if ( ! exists )
t.assign( tiddlerName, tiddlerBody, config.views.wikified.defaultModifier, now, tiddlerTags.readBracketedList() );
story.displayTiddler(null,tiddlerName,DEFAULT_EDIT_TEMPLATE);
story.focusTiddler(tiddlerName,"title");
return false;
});
}}
//}}}
/***
This plugin is released under the [[Creative Commons Attribution 2.5 License|http://creativecommons.org/licenses/by/2.5/]]
***/
!First simple three parameter test
<<twUnit "reparse( one:two three four:5 )"
var params = "one:two three four:5" ;
var ret = config.macros.newerTiddler.reparse( params );
this.AssertSame( ret["one"], "two", "Param one error" );
this.Assert( ret["three"], "param two error" );
this.AssertSame( ret["four"], "5", "param three error" );
>>
!No Param Tests
<<twUnit "reparse()"
var params = "" ;
var ret = config.macros.newerTiddler.reparse( params );
this.Assert( true, "Passed." );
>>
!No Value Tests
<<twUnit "reparse( one )"
var params = "one" ;
var ret = config.macros.newerTiddler.reparse( params );
this.Assert( ret["one"], "Param one error" );
>>
<<twUnit "reparse( one two three )"
var params = "one two three" ;
var ret = config.macros.newerTiddler.reparse( params );
this.Assert( ret["one"], "Param one error" );
this.Assert( ret["two"], "Param two error" );
this.Assert( ret["three"], "Param three error" );
>>
Upload Password:
<<option pasUploadPassword>>
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
<!---
|''Name:''|PageTemplate |
|''Version:''|$Revision: 1 $ |
|''Requires:''|TiddlyWiki 2.0.0 or higher |
!Description
A modified page template moving the main menu into the header
Also removes the shadowed title & description.
!Markup
--->
<!--{{{-->
<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span> <span
class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span> <span
class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div id='mainMenu' refresh='content' tiddler='MainMenu'>
</div>
</div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'>
</div>
<div id='sidebarTabs' force='true' refresh='content' tiddler='SideBarTabs'>
</div>
</div>
<div id='displayArea'>
<div id='messageArea'>
</div>
<div id='tiddlerDisplay'>
</div>
</div>
<!--}}}-->
!Welcome
Welcome to my TiddlyWiki! Home of PaulsPlugins - my collection of hopefully usefull bits of javascript for your TiddlyWiki enjoyment!
PaulsNotepad is all about capturing and organizing bits of information. Using TiddlyWiki's native taging capabilities and some of the plugins you'll see here I manage to keep my HUGE TiddlyWiki nice and organized!
I also create lots of little reference works in TW using these same capabilities & plugins, references for API's, project documentation, even course work/ware.
I have a full set of HTML Entities here (HtmlEntities, GreekHtmlEntities, LatinHtmlEntities, and MathHtmlEntities), a abbreviated [[CSS Reference]], a handy Web ColorChart, and some help stuffed in the side bar. The help has ''not'' been updated to v2.0 yet, so don't bother with it!
BrightWhite: #FFFFFF
DarkBlack: #000000
WhiteTextBackground: #FFFFFF
WhiteTextForeground: #000000
BlackTextBackground: #FFFFFF
BlackTextForeground: #000000
Backdrop: #999
Background: #eee
Foreground: #000
BorderLight: #000
BorderDark: #fff
PrimaryPale: #006699
PrimaryLight: #6699CC
PrimaryMid: #99CCFF
PrimaryDark: #014
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
/***
|''Name:''|PaulsNotepadLayout |
|''Version:''|$Revision: 6 $ |
|''Source:''|http://thePettersons.org/PaulsNotepad.html#PaulsNotepadLayout |
|''Author:''|[[Paul Petterson]] |
|''Type:''|Style Sheet Extension |
|''Requires:''|TiddlyWiki 2.0.0 or higher |
!Description
Slightly changes the color of some TW elements to support a look and feel I like, fickle me! :)
!Revision history
$History: PaulsNotepadColors.css $
*
* ***************** Version 6 *****************
* User: paulpet Date: 7/08/07 Time: 6:04p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsNotepad/excludeLists
* more style work
*
* ***************** Version 5 *****************
* User: paulpet Date: 12/14/06 Time: 4:46p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsNotepad/excludeLists
* checkpoint
*
* ***************** Version 1 *****************
* User: paulpet Date: 2/22/06 Time: 12:33p
* Created in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsNotepad
* look and feel beginning to take shape!
!Colors from the default color palat (For reference)
<<tiddler ColorChart>>
!Rules
***/
/*{{{*/
body
{
background: [[ColorPalette::TertiaryDark]];
color: [[ColorPalette::Foreground]];
}
#mainMenu
{
color: [[ColorPalette::Background]];
border-top: solid 1px [[ColorPalette::Background]];
border-bottom: solid 1px [[ColorPalette::Background]];
}
#mainMenu .button, #mainMenu a
{
background: transparent;
color: [[ColorPalette::Background]];
border: none;
}
#mainMenu .button:hover, #mainMenu a:hover
{
background: transparent;
color: [[ColorPalette::Foreground]];
border: none;
}
.tiddler
{
background: [[ColorPalette::Background]];
border-top: solid [[ColorPalette::TertiaryPale]] 1px;
border-left: solid [[ColorPalette::TertiaryPale]] 1px;
border-right: solid [[ColorPalette::PrimaryDark]] 2px;
border-bottom: solid [[ColorPalette::PrimaryDark]] 2px;
}
.tagging, .tagged { background-color:[[ColorPalette::Background]]; border:none; }
.tagging a:hover, .tagged a:hover { background-color:[[ColorPalette::TertiaryPale]]; border:none; }
.selected .tagging, .selected .tagged { background-color:[[ColorPalette::Background]]; border:none; }
#sidebar
{
background: [[ColorPalette::TertiaryDark]];
color: [[ColorPalette::Background]];
}
#sidebarOptions .sliderPanel
{
background: [[ColorPalette::Background]];
color: [[ColorPalette::Foreground]];
border-top: solid [[ColorPalette::TertiaryPale]] 1px;
border-left: solid [[ColorPalette::TertiaryPale]] 1px;
border-right: solid [[ColorPalette::PrimaryDark]] 1px;
border-bottom: solid [[ColorPalette::PrimaryDark]] 1px;
}
h1, h2, h3, h4, h5
{
color: [[ColorPalette::SecondaryDark]];
background: [[ColorPalette::Background]];
}
#sidebar a
{
background: [[ColorPalette::TertiaryDark]];
color: [[ColorPalette::Background]];
border: none;
}
#sidebar a:hover
{
background: [[ColorPalette::Background]];
color: [[ColorPalette::Foreground]];
}
#sidebar a:active
{
background: [[ColorPalette::Background]];
color: [[ColorPalette::Foreground]];
}
#sidebarTabs
{
}
#sidebarTabs a
{
background: [[ColorPalette::TertiaryPale]];
color: [[ColorPalette::PrimaryMid]];
}
#sidebarTabs a:hover
{
background: [[ColorPalette::TertiaryPale]];
color: [[ColorPalette::TertiaryDark]];
}
#sidebarTabs a:active
{
background: [[ColorPalette::TertiaryPale]];
color: [[ColorPalette::Foreground]];
}
#sidebarTabs .tabSelected
{
color: [[ColorPalette::Foreground]];
background: [[ColorPalette::TertiaryPale]];
border-left: 2px solid [[ColorPalette::Background]];
border-top: 2px solid [[ColorPalette::Background]];
border-right: 2px solid [[ColorPalette::TertiaryMid]];
}
#sidebarTabs .tabUnselected
{
color: [[ColorPalette::Background]];
background: [[ColorPalette::TertiaryMid]];
border-left: 2px solid [[ColorPalette::Foreground]];
border-top: 2px solid [[ColorPalette::Foreground]];
border-right: 2px solid [[ColorPalette::Background]];
}
#sidebarOptions .sliderPanel a
{
border: none;
background: [[ColorPalette::Background]];
color: [[ColorPalette::PrimaryMid]];
}
#sidebarOptions .sliderPanel a:hover
{
background: [[ColorPalette::PrimaryMid]];
}
#sidebarOptions .sliderPanel a:active
{
color: [[ColorPalette::Background]];
background: [[ColorPalette::PrimaryMid]];
}
/*
#sidebarOptions input {
border: 1px solid [[ColorPalette::PrimaryDark]];
}
*/
/*}}}*/
!Pauls Notepad Development Details
I develop PaulsNotepad in VisualStudio 2005, each tiddler is a seperate .txt or .js file - stored in a directory structure that mimmics tags for the tiddlers. For example:
* PaulsPlugins
** ReleaseNotes
*** PluginUpdates070307.txt
*** PluginUpdates030206.txt
** systemConfig
*** [[twUnit]].js
** Tests
*** [[twUnitTests]].txt
(and so on)
Finally - I wrote a simple .NET application that reads the visual studio project file and gets that list of files (and their directories) and builds a set of store DIVS! All of this is kept in a Visual SourceSafe.
I've also developed a set of Unit Testing tools in TiddlyWiki and I'm building test suites for each of my plugins. I hope to have very stable releases of PaulsNotepad going forward!
You'll notice in all the tiddlers I'm actively working on that there is now a summary of the unit tests for that plugin - this comes from the {{{<<twRunner tiddlertests>>}}} macro which runs all the unit tests in a given tiddler and displays a summary of results. If you open a plugin tiddler and see those tests, you just tested that plugin! :)
/***
|''Name:''|PaulsNotepadLayout |
|''Version:''|$Revision: 2 $ |
|''Source:''|http://thePettersons.org/PaulsNotepad.html#PaulsNotepadLayout |
|''Author:''|[[Paul Petterson]] |
|''Type:''|Style Sheet Extension |
|''Requires:''|TiddlyWiki 2.0.0 or higher |
!Description
Slightly changes the layout of some TW elements to support a look and feel I like, fickle me! :)
!Revision history
$History: PaulsNotepadLayout.css $
*
* ***************** Version 2 *****************
* User: paulpet Date: 7/08/07 Time: 6:04p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsNotepad/excludeLists
* more style work
*
* ***************** Version 1 *****************
* User: paulpet Date: 12/09/06 Time: 9:43p
* Created in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsNotepad/excludeLists
* checkpoint
*
* ***************** Version 3 *****************
* User: paulpet Date: 2/22/06 Time: 12:33p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsNotepad
* look and feel beginning to take shape!
!Rules
***/
/*{{{*/
.tiddler {
padding: 1em;
margin-bottom: 1em;
}
.tags, .tagging {font-size:0.9em; float: none; margin: 0; padding: 0;}
.tagging { float: none; }
.tagging ul, .tags ul { list-style:none; margin:0; padding:0; }
.tagging li, .tags li { display: inline; list-style-type: none; }
.tagging br, .tags br { display:none; }
.headerShadow {position:relative; padding:1em 0em 1em 1em; left:-1px; top:-1px;}
.headerForeground {position:absolute; padding:1em 0em 1em 1em; left:0px; top:0px;}
/*}}}*/
!PaulsNotepad Version Information
|Version: |$Revision: 1 $ |
|Released: |$JustDate: 7/13/07 $ |
Version History:
$History: PaulsNotepadVersion.txt $
*
* ***************** Version 1 *****************
* User: paulpet Date: 7/13/07 Time: 9:42p
* Created in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsNotepad
* PaulsNotepad release July 13th 2007 (Friday the 13th!) See
* PluginUpdates071307 for details
!PaulsPlugins
These plugins I use to either to organize information, or to write more plugins!
* Organization
** GettingThingsDonePlugin - my own little implementation of GTD projects & next actions.
** ''List Extensions'' - adds powerfull organizational capabilities to the existing {{{<<list>>}}} macro
*** {{{<<list search sometext>>}}} - the ListSearchPlugin lets you return search results as simple lists.
*** {{{<<list withTag sometag>>}}} - the ListWithTagPlugin lists out all tiddlers that have the specified tag.
*** {{{<<list withTags expression>>}}} - the ListWithTagsPlugin lets you build powerfull tag based searches and return the matching tiddlers.
** ''List Replacements'' - instead of just lists, how about other formats
*** TableTagsPlugin - simply lists all your tags in a table, like {{{<<alltags>>}}}
*** ForEachPlugin - lets you use any list functions and format the output as you like.
** PercentCompletePlugin - draws a progress bar with a percent completed
** NewerTiddlerPlugin - replacement for the {{{<<newtiddler>>}}} macro, more options like tags, content, etc.
* TiddlyWiki Development
** [[twUnit]] - unit testing
** TiddlyWikiDebugger - some stack tracing tools - see what functions are called, with what parameters, and what they return
** TheDumpPlugin - display contents of variables, functions, configuration, etc.
** RegExTesterPlugin - for trying out regular expressions
* Other
** CalendarMakerPlugin - just for fun...
** ShowMyTitlePlugin - just shows the title of the tiddler it's in
I've contributed these Plugins to the community. These are all released under a very liberal [[License]] which says, in a nutshell, do what you want - just say who you got them from (that's me!). :)
!!Release Notes
<<tiddler PluginUpdates071307>>
!!!Older Releases
<<list withTag ReleaseNotes>>
!License
<<tiddler License>>
/***
|''Name:''|//PercentComplete// |
|''Description:''|PercentComplete is simple macro/hack to show a percent completion bar|
|''Version:''|$Revision: 1 $ |
|''Date:''|$JustDate: 7/08/07 $ |
|''Source:''|http://thePettersons.org/PaulsNotepad.html |
|''Author:''|[[Paul Petterson]] |
|''License:''|[[CC Attribution 2.5|http://creativecommons.org/licenses/by/2.5/]] |
|''CoreVersion:''|TiddlyWiki 2.2.x or Higher |
!About
Simple macro that draws a progress bar style bar, with a percentage complete filled in.
!Syntax
{{{<<PercentComplete}}}
{{{percent:<0-100>}}} - the percent of the progress bar to be filled in: 0 to 100 are valid
{{{[size:<size-in-pixels>]}}} - optional - the size in pixels of the percent complete progress bar (default is 200px)
{{{[completecolor:<valid-color>]}}} - optional - the color to fill the 'completed' part of the bar (default [[ColorPalette::PrimaryMid]])
{{{[remainingcolor:<valid-color>]}}} - optional - the color to fill the 'uncompleted' part of the bar (default [[ColorPalette::Background]])
{{{>>}}}
!Sample
{{{<<PercentComplete percent:42>>}}}
<<PercentComplete percent:42>>
!Unit Tests
<<twRunner PercentCompleteTests>>
!Todo
!Revision history
$History: PercentCompletePlugin.js $
*
* ***************** Version 1 *****************
* User: paulpet Date: 7/08/07 Time: 6:04p
* Created in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* Added new PercentComplete plugin!
!Code
***/
//{{{
//Version
version.extensions.PercentComplete = {
title: 'PercentComplete',
major: 1,
minor: 0,
revision: new Number( '$Revision: 1 $'.match( /\$[^\d]+([\d]+)[^\$]*\$/im )[1] ) ,
date: new Date( '$JustDate: 7/08/07 $'.match( /\$[^\d]+([\d\/\/]+)[^\$]*\$/im )[1].replace(/(\d+\/\d+\/)(\d+)/img, '$120$2') )
};
//Code
config.macros.PercentComplete = {
defaultSize: 200,
// styles
style: [
"/*{{{*/",
"/* styles for the PercentComplete macro */",
".pcbar1 { position:relative; line-height:1em; background-color:[[ColorPalette::Background]]; border:1px solid black; width:" + this.defaultSize + "px; }",
".pcbar2 { height:1.5em; width:" + this.defaultSize + "px; background-color:[[ColorPalette::PrimaryMid]]; }",
".pctext { position:absolute; text-align:center; padding-top:.25em; width:" + this.defaultSize + "px; top:0; left:0; }",
"/*}}}*/"
].join("\n"),
// Actual bar drawing function...
drawBar: function( sizestr, percentComplete, compcolor, remaincolor ) {
var size = parseInt( sizestr );
var completedSize = size * (percentComplete / 100);
var bar = createTiddlyElement( null, "div", null, "pcbar1" );
bar.style.width = sizestr + "px";
if ( remaincolor != null )
bar.style.backgroundColor = remaincolor ;
var e = createTiddlyElement( bar, "div", null, "pcbar2" );
e.style.width = completedSize + "px";
if ( compcolor!= null )
e.style.backgroundColor = compcolor;
e = createTiddlyElement( bar, "div", null, "pctext", percentComplete );
e.style.width = sizestr + "px";
return bar;
},
// macro
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
params = paramString.parseParams( "nada", null, false );
var pc = getParam( params, "percent", null );
var size = getParam( params, "size", this.defaultSize );
var completecolor= getParam( params, "completecolor", null );
var remainingcolor= getParam( params, "remainingcolor", null );
var bar = this.drawBar( size, pc, completecolor, remainingcolor);
place.appendChild( bar );
}};
// init stuff
config.shadowTiddlers["PercentCompleteStyles"] = config.macros.PercentComplete.style;
store.addNotification("PercentCompleteStyles",refreshStyles );
//}}}
/***
This plugin is released under the [[Creative Commons Attribution 2.5 License|http://creativecommons.org/licenses/by/2.5/]]
***/
<<twUnit "generate bar - percent only"
var percent = 50 ;
var paramString = "percent:" + percent ;
var params = paramString.parseParams();
var place = createTiddlyElement( null, "div" );
config.macros.PercentComplete.handler( place, "PercentComplete", params, null, paramString );
var size = 200; // default size is 200
var bs = size * ( percent / 100);
var dstr = '<DIV class=### style="WIDTH: %%%px">' ;
var expected = dstr.replace( '###', "pcbar1" ).replace( "%%%", size );
expected += "\r\n"
expected += dstr.replace( '###', "pcbar2" ).replace( "%%%", bs);
expected += "</DIV>\r\n"
expected += dstr.replace( '###', "pctext" ).replace( "%%%", size);
expected += percent + "</DIV></DIV>"
var actual = place.innerHTML;
this.AssertSame( expected, actual, "Got wrong bar!" );
>>
|Standard Periodic Table (ref. Wikipedia)|c
|| !1 | !2 |!| !3 | !4 | !5 | !6 | !7 | !8 | !9 | !10 | !11 | !12 | !13 | !14 | !15 | !16 | !17 | !18 |
|!1|bgcolor(#a0ffa0): @@color(red):H@@ |>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>||bgcolor(#c0ffff): @@color(red):He@@ |
|!2|bgcolor(#ff6666): Li |bgcolor(#ffdead): Be |>|>|>|>|>|>|>|>|>|>||bgcolor(#cccc99): B |bgcolor(#a0ffa0): C |bgcolor(#a0ffa0): @@color(red):N@@ |bgcolor(#a0ffa0): @@color(red):O@@ |bgcolor(#ffff99): @@color(red):F@@ |bgcolor(#c0ffff): @@color(red):Ne@@ |
|!3|bgcolor(#ff6666): Na |bgcolor(#ffdead): Mg |>|>|>|>|>|>|>|>|>|>||bgcolor(#cccccc): Al |bgcolor(#cccc99): Si |bgcolor(#a0ffa0): P |bgcolor(#a0ffa0): S |bgcolor(#ffff99): @@color(red):Cl@@ |bgcolor(#c0ffff): @@color(red):Ar@@ |
|!4|bgcolor(#ff6666): K |bgcolor(#ffdead): Ca ||bgcolor(#ffc0c0): Sc |bgcolor(#ffc0c0): Ti |bgcolor(#ffc0c0): V |bgcolor(#ffc0c0): Cr |bgcolor(#ffc0c0): Mn |bgcolor(#ffc0c0): Fe |bgcolor(#ffc0c0): Co |bgcolor(#ffc0c0): Ni |bgcolor(#ffc0c0): Cu |bgcolor(#ffc0c0): Zn |bgcolor(#cccccc): Ga |bgcolor(#cccc99): Ge |bgcolor(#cccc99): As |bgcolor(#a0ffa0): Se |bgcolor(#ffff99): @@color(green):Br@@ |bgcolor(#c0ffff): @@color(red):Kr@@ |
|!5|bgcolor(#ff6666): Rb |bgcolor(#ffdead): Sr ||bgcolor(#ffc0c0): Y |bgcolor(#ffc0c0): Zr |bgcolor(#ffc0c0): Nb |bgcolor(#ffc0c0): Mo |bgcolor(#ffc0c0): Tc |bgcolor(#ffc0c0): Ru |bgcolor(#ffc0c0): Rh |bgcolor(#ffc0c0): Pd |bgcolor(#ffc0c0): Ag |bgcolor(#ffc0c0): Cd |bgcolor(#cccccc): In |bgcolor(#cccccc): Sn |bgcolor(#cccc99): Sb |bgcolor(#cccc99): Te |bgcolor(#ffff99): I |bgcolor(#c0ffff): @@color(red):Xe@@ |
|!6|bgcolor(#ff6666): Cs |bgcolor(#ffdead): Ba |bgcolor(#ffbfff):^^*1^^|bgcolor(#ffc0c0): Lu |bgcolor(#ffc0c0): Hf |bgcolor(#ffc0c0): Ta |bgcolor(#ffc0c0): W |bgcolor(#ffc0c0): Re |bgcolor(#ffc0c0): Os |bgcolor(#ffc0c0): Ir |bgcolor(#ffc0c0): Pt |bgcolor(#ffc0c0): Au |bgcolor(#ffc0c0): @@color(green):Hg@@ |bgcolor(#cccccc): Tl |bgcolor(#cccccc): Pb |bgcolor(#cccccc): Bi |bgcolor(#cccc99): Po |bgcolor(#ffff99): At |bgcolor(#c0ffff): @@color(red):Rn@@ |
|!7|bgcolor(#ff6666): Fr |bgcolor(#ffdead): Ra |bgcolor(#ff99cc):^^*2^^|bgcolor(#ffc0c0): Lr |bgcolor(#ffc0c0): Rf |bgcolor(#ffc0c0): Db |bgcolor(#ffc0c0): Sq |bgcolor(#ffc0c0): Bh |bgcolor(#ffc0c0): Hs |bgcolor(#ffc0c0): Mt |bgcolor(#ffc0c0): Ds |bgcolor(#ffc0c0): Rg |bgcolor(#ffc0c0): @@color(green):Uub@@ |bgcolor(#cccccc): Uut |bgcolor(#cccccc): Uuq |bgcolor(#cccccc): Uup |bgcolor(#cccccc): Uuh |bgcolor(#fcfecc): @@color(#cccccc):Uus@@ |bgcolor(#ecfefc): @@color(#cccccc):Uuo@@ |
| !Lanthanides^^*1^^|bgcolor(#ffbfff): La |bgcolor(#ffbfff): Ce |bgcolor(#ffbfff): Pr |bgcolor(#ffbfff): Nd |bgcolor(#ffbfff): Pm |bgcolor(#ffbfff): Sm |bgcolor(#ffbfff): Eu |bgcolor(#ffbfff): Gd |bgcolor(#ffbfff): Tb |bgcolor(#ffbfff): Dy |bgcolor(#ffbfff): Ho |bgcolor(#ffbfff): Er |bgcolor(#ffbfff): Tm |bgcolor(#ffbfff): Yb |
| !Actinides^^*2^^|bgcolor(#ff99cc): Ac |bgcolor(#ff99cc): Th |bgcolor(#ff99cc): Pa |bgcolor(#ff99cc): U |bgcolor(#ff99cc): Np |bgcolor(#ff99cc): Pu |bgcolor(#ff99cc): Am |bgcolor(#ff99cc): Cm |bgcolor(#ff99cc): Bk |bgcolor(#ff99cc): Cf |bgcolor(#ff99cc): Es |bgcolor(#ff99cc): Fm |bgcolor(#ff99cc): Md |bgcolor(#ff99cc): No |
*Chemical Series of the Periodic Table
**@@bgcolor(#ff6666): Alkali metals@@
**@@bgcolor(#ffdead): Alkaline earth metals@@
**@@bgcolor(#ffbfff): Lanthanides@@
**@@bgcolor(#ff99cc): Actinides@@
**@@bgcolor(#ffc0c0): Transition metals@@
**@@bgcolor(#cccccc): Poor metals@@
**@@bgcolor(#cccc99): Metalloids@@
**@@bgcolor(#a0ffa0): Nonmetals@@
**@@bgcolor(#ffff99): Halogens@@
**@@bgcolor(#c0ffff): Noble gases@@
*State at standard temperature and pressure
**those in @@color(red):red@@ are gases
**those in @@color(green):green@@ are liquids
**those in black are solids
/***
|''Name:''|//pluginname// |
|''Description:''|pluginname is a ... |
|''Version:''|$Revision: 3 $ |
|''Date:''|$JustDate: 7/08/07 $ |
|''Source:''|http://thePettersons.org/PaulsNotepad.html |
|''Author:''|[[Paul Petterson]] |
|''License:''|[[CC Attribution 2.5|http://creativecommons.org/licenses/by/2.5/]] |
|''CoreVersion:''|TiddlyWiki 2.2.x or Higher |
!About
!Syntax
!Unit Tests
<<twRunner pluginnameTests>>
!Todo
!Revision history
$History: PluginTemplate.js $
*
* ***************** Version 3 *****************
* User: paulpet Date: 7/08/07 Time: 5:41p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins
* updated
!Code
***/
//{{{
// Code...
version.extensions.pluginname = {
title: 'pluginname',
major: 1,
minor: 0,
revision: new Number( '$Revision: 3 $'.match( /\$[^\d]+([\d]+)[^\$]*\$/im )[1] ) ,
date: new Date( '$JustDate: 7/08/07 $'.match( /\$[^\d]+([\d\/\/]+)[^\$]*\$/im )[1].replace(/(\d+\/\d+\/)(\d+)/img, '$120$2') )
};
config.macros.MyNewPlugin = {
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var defaultParamName = "default";
var defaultParamValue = null;
var evalParams = false;
var noNames = false;
var cascadeDefaults = false;
var params = paramString.parseParams( defaultParamName , defaultParamValue , evalParams , noNames, cascadeDefaults );
}}
//}}}
/***
This plugin is released under the [[Creative Commons Attribution 2.5 License|http://creativecommons.org/licenses/by/2.5/]]
***</>/
My First TiddlyWiki v2.0 update! Life's been a bit crazy the last couple of months, but things are slowing down now (finally).
First some general changes, all development is now done outside of TiddlyWiki and a full, new PaulsNotepad is built from scratch (from empty.html actually), just like a regular project in a compiled language. Each tiddler in this TW is version controlled independently. The version numbers are going to seem a bit wacky... but I should be able to get back to any previous version if necessary!
Right now these have only really been tested in a V2.0 TiddlyWiki - I'm thinking of making them backwards compatible, but that depends on time and demand...
Updated plugins:
* CalendarMakerPlugin - Calendar maker displays a small tiddler with buttons to edit/create tiddlers based on the date. A few small bug fixes - it's still just a toy really.
* NewerTiddlerPlugin - provides a way to make new tiddlers (like the newTiddler and newJournal macros) with lots of flexibility. You can set the name of the button, the title of the new tiddler (with date expansion, like newJournal), set the tags of the tiddler, and even provide content - either directly from the macro or from a another tiddler which can be used as a template. A couple of bug fixes.
* List Extensions - all of these macros add different ways to use the built in {{{<<list>>}}} macro. I believe in extending what's there first!
** ListSearchPlugin - lets you do searches from the list macro. Updated to v2.0 - ''not backward compatible'' //yet//.
** ListWithTagPlugin - lets you list tiddlers with a specific tag. (not really updated, but tested and seems to work fine in 2.0)
** ListWithTagsPlugin - list you build complex conditionals with tags to list tiddlers. For example {{{<<list withTags Tasks and not Complete>>}}}
* TableTagsPlugin - my first plugin! Lets you list tiddlers with a tag like ListWithTag but in a table.
* TheDumpPlugin - my first debugging aid! Lets you dump contents of the tiddly wiki internal structures. Not that useful for casual use - but if you're developing a plugin it can be kind of handy.
* TiddlerStats - find out how many tiddlers you have, how big they are, and other stuff. Updated to run on V2.0.
Other Stuff:
* [[reparser]] - a handy bit of javascript for when you want to parse out name:value parameters. Supports quoted or unquoted values, names without values, and 'escaped' quotations (so you can put quotes in a quoted string). Returns everything as an associative array so you can do checks like this: {{{ if ( params["name"] == "value" )...}}}
Now updated to TiddlyWiki v2.2!
Development in a version controlled environment is really going well. If you're interested in the details see PaulsNotepadDevelopment.
!! New Plugins
[[twUnit]] - my unit testing plugin.
[[PercentCompletePlugin]] - draws a progress bar and fills it in with a % complete. Neat for projects & status.
!! Updated Plugins
[[ListWithTagsPlugin]] - fixed a few painfull bugs (like when tags have spaces in them, then the last tiddler with that tag is removed, it would break) - added unit tests for the bug fixes and some basic functional testing.
[[ForEachPlugin]] - lots of bug fixes, now much easier to create nested lists. See ForEachDocumentation for lots of samples.
!! Pre-Beta Plugins
[[ForEachPlugin]] - I don't have notifiers hooked up right yet so if you play with the sample you'll notice that things don't update right unless you close/open the tiddler.
Small improvements over previous release
* GettingThingsDonePlugin - finished the rework using ForEachPlugin - now it only depends on forEach and newerTiddler
* Found a couple of bugs in withTags - added tests (which still fail)
ListWithTagsPlugin - finally hits v1.0 with feature complete and no known bugs.
NewerTiddlerPlugin - feature complete - can create a tiddler from a template tiddler, specifying the title, tags, or text for the tiddler.
HtmlEntitiesWikifierPlugin - fixed a couple of bugs, made it smaller and faster!
ForEachPlugin v0.1.0 - pre-release of a new lister macro. You can use any of the methods available in the {{{<<list>>}}} macro and by default it will output the same thing as list, but you can specify your own formatting, lists - tables - even call other macros or even the foreach macro again to make recursive lists!
ListWithTagsPlugin v1.0.2 - some bug fixes around non-existing tags screwing up the built expression, now they are all property turned into 'false's! If you find an expression that doesn't work - let me know, I've got a tester that will send me the information I ned fixing it! Sorry no sorting yet - but soon!
ListSearchPlugin v0.0.1 - really early release, create lists of tiddlers that have something in 'em. More options coming in the future!
ShowMyTitlePlugin v1.0.0 - simple macro displays the name of the tiddler it's put in. If you put it in a tiddler that's included in another tiddler - it shows the outer most tiddlers name, the one displayed. It's handy when making template tiddlers so you don't have to type the name in twice if you don't want too. :)
There are other changes - so dig around and take what you want!
|!Macro|!Syntax|
|allTags|{{{<}}}{{{<allTags>>}}}|
|>|{{{allTags}}} lists all tags. Clicking on a tag lists all the tiddlers assigned that tag. |
|closeAll|{{{<}}}{{{<closeAll>>}}}|
|>|Closes all open tiddlers |
|list all|{{{<}}}{{{<list all>>}}}|
|>|lists all tiddlers in alphabetical order |
|list missing|{{{<}}}{{{<list missing>>}}}|
|>|Lists all WikiWords in the TiddlyWiki that don't have tiddlers created for them |
|list orphans|{{{<}}}{{{<list orphans>>}}}|
|>|Lists all Tiddlers that aren't linked to directly by another tiddler |
|newJournal|{{{<}}}{{{<newJournal>>}}}|
|>| |
|newTiddler|{{{<}}}{{{<newTiddler>>}}}|
|>| |
|permaview|{{{<}}}{{{<permaview>>}}}|
|>| |
|saveChanges|{{{<}}}{{{<saveChanges>>}}}|
|>| |
|search|{{{<}}}{{{<search>>}}}|
|>| |
|slider|{{{<}}}{{{<slider ID Tiddler Label>>}}}|
|>| |
|tabs|{{{<}}}{{{<tabs ID Label Tip Tiddler>>}}}|
|>| |
|tag|{{{<}}}{{{<tag tagName>>}}}|
|>| |
|tiddler|{{{<}}}{{{<tiddler Tiddler>>}}}|
|>| |
|timeline|{{{<}}}{{{<timeline>>}}}|
|>| |
|today|{{{<}}}{{{<today>>}}}|
|>| |
|version|{{{<}}}{{{<version>>}}}|
|>| |
|>| !Text Markup |
|>|<html><tt>{{{Monospaced Text}}}</tt></html> |
|>|<html><pre>{{{<br/>Monospaced<br/>Multi-line<br/>Block<br/>}}}</pre></html> |
|>|{{{''}}}''Bold''{{{''}}} |
|>|{{{//}}}//Italics//{{{//}}} |
|>|{{{__}}}__Underine__{{{__}}} |
|>|{{{==}}}==Strike Through=={{{==}}} |
|>|{{{~~}}}~~sub~~{{{~~}}}script |
|>|{{{^^}}}^^super^^{{{^^}}}script |
|>| !Colors (see ColorChart) |
|>|{{{@@}}}@@highlight@@{{{@@}}} |
|>|{{{@@color(green):}}}@@color(green):green@@{{{@@}}} |
|>|{{{@@bgcolor(green):}}}@@bgcolor(green):green@@{{{@@}}} |
|>| !Links |
|>|any WikiWord |
|>|{{{[[Manual Link]]}}}<html><br/></html>Makes: [[Manual Link]] |
|>|Pretty Link<html><br/></html>{{{[[Help|QuickRef]]}}}<html><br/></html>Makes: [[Help|QuickRef]] |
|>|External Link<html><br/></html>{{{http://www.msn.com}}}<html><br/></html>Makes: http://www.msn.com |
|>|Pretty External Link<html><br/></html>{{{[[go|http://www.msn.com]]}}}<html><br/></html>Makes: [[go|http://www.msn.com]] |
|>| !Folder Links |
|>|{{{[[Link Text|OS Path]]}}} |
|>| !Path Formats |
|>|Windows Share:<html><br/></html>{{{file://///server/share}}} |
|>|Windows Local:<html><br/></html>{{{file:///c:/folder/file}}} |
|>|Un*x Local File:<html><br/></html>{{{file://folder/file}}} |
|>|Relative File<html><br/></html>{{{folder/file}}} |
|>| !Lists |
|>|{{{*}}} Bullet Lists<html><br/></html>{{{#}}} Numbered Lists |
|>|Nest with multiple {{{*}}}'s or {{{#}}}'s |
|>|{{{*}}}Bullet<html><br/></html>{{{##}}}Number |
|>|<html><ul><li>Bullet<ol><li>Numbered</li></ol></li></ul></html> |
|>| !blockquotes |
|>|{{{>}}} Blockquote<html><br/></html>{{{>>}}} Nested Blockquote |
|>|<html><blockquote>Blockquote<blockquote>Nested Blockquote</blockquote></blockquote></html> |
|>|<html><tt><<<</tt><br/>multi-line<br/>blockquote<br/><tt><<<</tt></html> |
|>|<html><blockquote>multi-line<br/>blockquote</blockquote></html> |
|>| !Images |
|>|{{{[img[favicon.ico]]}}} -> [img[http://www.tiddlywiki.com/favicon.ico]] |
|>| !Headings |
|>|<html><h1>!Heading H1</h1><h2>!!Heading H2</h2><h3>!!!Heading H3</h3><h4>!!!!Heading H4</h4><h5>!!!!!Heading H5</h5></html> |
|>| !Horizontal Rule |
|>|{{{----}}} |
|>|<html><hr/></html> |
|>| !Tables |
| {{{|}}} |Column Seperator |
| {{{!}}} |Header |
| {{{>}}} |Column Span |
| {{{~}}} |Row Span |
| {{{|Left |}}} |Left Align |
| {{{| Right|}}} |Right Align|
| {{{| Center |}}} |Center Align |
| {{{|Caption|c}}} |Table Caption |
|>| !Table Sample |
|>|{{{|}}} !header {{{|}}} !header {{{|}}}<html><br/></html>{{{|>|}}}colspan=2 {{{|}}}<html><br/></html>{{{|}}} rowspan {{{|}}}left align {{{|}}}<html><br/></html>{{{|�|}}} center {{{|}}}<html><br/></html>{{{|}}}bgcolor(green):color{{{|}}} right{{{|}}}<html><br/></html>{{{|}}}table caption{{{|}}}c<html><br/></html> |
|>| <html><table width="80%" border=1><tbody><tr><th align="center">header</th><th align="center">header</th></tr><tr><td colspan="2" align="center">colspan="2"</td></tr><tr><td rowspan="2" align="center">rowspan</td><td align="left">left align</td></tr><tr><td align="center">centered</td></tr><tr><td bgcolor="green">green</td><td align="right">right</td></tr><caption valign="bottom">table caption</caption></tbody></table></html> |
/***
|''Name:''|RegExTesterPlugin |
|''Version:''|$Revision: 1 $|
|''Source:''|http://thePettersons.org/tiddlywiki.html#RegExTesterPlugin |
|''Author:''|[[Paul Petterson]] |
|''Type:''|Macro |
|''Requires:''|TiddlyWiki 1.2.32 or higher |
!Description
Gives you a macro to test regular expressions and see what they match...
!Syntax
{{{<<regexTester }}}//{{{regularExpression stringToSearch}}}//{{{>>}}}
!Sample
{{{<<regexTester "([^,]*),?" "hello,world">>}}}
<<regexTester "a.*?a" "abbbabbbaabbbababaabb">>
!Revision history
$History: RegExTesterPlugin.js $
*
* ***************** Version 1 *****************
* User: paulpet Date: 2/24/06 Time: 1:36p
* Created in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
!Code
***/
//{{{
config.macros.regexTester = {
showVar: function( v ) {
if ( ! v ) return "null" ;
var tov = typeof( v ) ;
var sret = "" ;
var verbose = false ;
switch( tov ) {
case "number": case "boolean":
sret = v ;
break ;
case "string":
sret = "'" + v + "'" ;
break ;
case "function":
sret = "function()" ;
break ;
case "object" :
if ( v.join ) { // this is an array!
sret = "[" ;
for( var i=0; i<v.length; i++ )
sret += ((i==0)?"":", ") + this.showVar( v[i] ) ;
sret += "]" ;
} else {
var sep = "" ;
sret = "{" ;
for( var key in v ) {
sret += sep + key + "(" + typeof( v[key] ) + "): " ;//+ showVar( v[i] ) ;
sep = ", " ;
}
sret += "}" ;
}
break ;
default:
sret = "<b>typeof(" + tov + ")</b>" ;
break ;
}
return sret ;
},
handler: function(place,macroName,params) {
var rx = params[0] ;
var str = params[1] ;
var ul = createTiddlyElement( place, "ul", null, null, null ) ;
createTiddlyElement( ul, "li", null, null, "Expression: '" + rx +"'" ) ;
createTiddlyElement( ul, "li", null, null, "String: '" + str +"'" ) ;
createTiddlyElement( ul, "li", null, null, "Matches...." ) ;
ul = createTiddlyElement( ul, "ol", null, null, null ) ;
var reg = new RegExp( rx, "g" ) ;
var match = reg.exec( str ) ;
var i = 0
while( match ) {
createTiddlyElement( ul, "li", null, null, "Found: '" + this.showVar( match ) + "' lastIndex: " + reg.lastIndex );
i++ ;
match = reg.exec( str ) ;
if ( i > 10 ) match = null ;
if ( match != null && match[0].length == 0 ) match = null ;
}
}}
//}}}
/***
This plugin is released under the [[Creative Commons Attribution 2.5 License|http://creativecommons.org/licenses/by/2.5/]]
***/
/***
|''Name:''|SetupStuff |
|''Version:''|$Revision: 3 $ |
|''Source:''|http://thePettersons.org/tiddlywiki.html#SetupStuff |
|''Type:''|Tweaks |
!Description
Bug Fixes & other bits of setup. Basically bits of code that aren't really a macro or extension - but alter something at initialization time...
!Revision history
$History: SetupStuff.js $
*
* ***************** Version 3 *****************
* User: paulpet Date: 12/09/06 Time: 6:55p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* minimizing part 1
*
* ***************** Version 2 *****************
* User: paulpet Date: 2/22/06 Time: 11:10a
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
----
!!Widen the Search Box
***/
//{{{
//config.macros.search.sizeTextbox = 25 ;
//}}}
/***
----
!!Setup a Favicon
***/
//{{{
// favicons
var n = document.createElement("link");
n.rel = "shortcut icon";
n.href = "http://www.tthepettersons.org/favicon.ico";
document.getElementsByTagName("head")[0].appendChild(n);
//}}}
<<forEach this "!My Project: $title"
forEach withTag [[Context]] "|>|$$title | \<\<newerTiddler button:'New $$title' name:'New $$title for $title' tags:'[[$title]] [[$$title]]'\>\>|"
forEach withTags [[$title]] and [[$$title]] "|[[$$$title]] |$$$modified | \<\<newerTiddler button:'edit' name:'$$$title'\>\>|">>
/***
|''Name:''|ShowMyTitlePlugin |
|''Version:''|$Revision: 4 $ |
|''Source:''|http://thePettersons.org/tiddlywiki.html#ShowMyTitlePlugin |
|''Author:''|[[Paul Petterson]] |
|''Type:''|Macro Extension |
|''Requires:''|TiddlyWiki 2.0.0 or higher, not compatible with older versions |
!Description
Displays the title of the tiddler the macro is placed in, it always shows the name of the open tiddler, if the tiddler with the macro is included via a {{{<<tiddler MyTiddler>>}}} or {{{<<tabs foo ...>>}}} it will always display the ''including'' tiddlers name.
See [[ShowMyTitlePlugin Tests]] for an example.
!Sample/Syntax
| !Code | !Results |
| {{{<<showMyTitle>>}}} | <<showMyTitle>> |
!Revision history
$History: ShowMyTitlePlugin.js $
*
* ***************** Version 4 *****************
* User: paulpet Date: 3/02/06 Time: 12:16p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
*
* ***************** Version 3 *****************
* User: paulpet Date: 2/26/06 Time: 9:00p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
*
* ***************** Version 2 *****************
* User: paulpet Date: 2/22/06 Time: 11:10a
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
!Code
***/
//{{{
config.macros.showMyTitle = {
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var t = story.findContainingTiddler( place ) ;
var name = (t?t.id.substr(story.idPrefix.length):"NA") ;
createTiddlyText( place, name ) ;
}}
//}}}
/***
This plugin is released under the [[Creative Commons Attribution 2.5 License|http://creativecommons.org/licenses/by/2.5/]]
***/
<<search>><<closeAll>><<permaview>><<newTiddler>><<newJournal "DD MMM YYYY">><<saveChanges>><<upload http://tiddlyspot.com/PaulsNotepad/store.cgi index.html . . PaulsNotepad>><<slider chkSliderOptionsPanel OptionsPanel "options »" "Change TiddlyWiki advanced options">>
my own personal web notebook (non-linear is just redundant)
/*{{{*/
body {position:static;}
[[HorizontalMainMenuStyleSheet]]
[[PaulsNotepadColors]]
[[PaulsNotepadLayout]]
/*}}}*/
<<watchMacro list>>
<<watchMethod config.macros.list.all handler>>
<<watchMethod store reverseLookup>>
<<watchMethod store getOrphans>>
<<watchMethod store getReferringTiddlers>>
<<watchMethod window createTiddlyLink>>
<<list orphans>>
<<stop>>
<<showStack>>
<<echoMacros>>
<<watchMacro list>>
<<watchMethod config.macros.list.withTags newCleaner>>
!Method 1: Watch a Macro
{{{<<assertReturn config.macros.list.withTags newCleaner '/systemConfig\|/.test(tiddlerTags)'>>}}}
{{{<<assertArg config.macros.list.withTags newCleaner 1 'systemConfig'>>
{{{<<assertArg config.macros.list.withTags newCleaner 2 '/systemConfig\|/.test(tiddlerTags)'>>
<<list withTags systemConfig>>
<<stop>>
<<showStack>>
!Method2: Call Methods, See Results
Macro: {{{<< test <prettyName> <object> <method> >>}}}
* prettyName - the name you use to call the method with using 'call'
* object & method - the actual object and method references...
Macro: {{{<<testMacro macroName>>}}}
# Setup the test.
{{{
<<test newCleaner config.macros.list.withTags newCleaner>>
<<test withTagsHandler config.macros.list.withTags handler>>
<<testMacro list>>
<<assertArg newCleaner 1 'systemConfig'>>
<<assertArg newCleaner 2 '/systemConfig\|/.test(tiddlerTags)'>>
<<assertReturn newCleaner '/systemConfig\|/.test(tiddlerTags)'>>
<<call newCleaner >>
}}}
!Simple: Take 1
just simple javascript...
{{{
<<test
...
javascript
assert( this = that );
>>
}}}
!Simple: Take 2
test - object, method, (args) return
{{{
<<test config.macros.list.withTags newCleaner
( 'systemConfig', '/systemConfig\|/.test(tiddlerTags)' )
'/systemConfig\|/.test(tiddlerTags)'>>
}}}
<<tabs txtTabHelp
Markup 'Quick Reference TWML' QuickRef
Macros 'TiddlyWiki Macros' QuickMacros>>
<<tabs txtTabTid
'By Date' Timeline TabTimeline
Alphabetical 'All tiddlers' TabAll>>
/***
|''Name:''|TableTagsPlugin |
|''Version:''|$Revision: 2 $ |
|''Source:''|http://thePettersons.org/tiddlywiki.html#TableTagsPlugin |
|''Author:''|[[Paul Petterson]] |
|''Type:''|List Macro Extension |
|''Requires:''|TiddlyWiki 2.0.0 or higher |
!Description
Lists all tiddlers with a given tag in a table format. Can specify the number of columns in the table.
!Sample Output
{{{<<tableTags systemConfig 4>>}}}
<<tableTags systemConfig 4>>
!Known issues
* Doesn't always display a good table if there are two many empty columns in the last row.
!Revision history
$History: TableTagsPlugin.js $
*
* ***************** Version 2 *****************
* User: paulpet Date: 2/22/06 Time: 11:10a
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
!Code
***/
//{{{
config.macros.tableTags = {
handler: function(place,macroName,params) {
var tag = params[0] ? params[0] : "all";
var rows = params[1] ? params[1] : 3;
var tagged = store.getTaggedTiddlers(params[0]);
var tbl = createTiddlyElement(place,"table",null,null,"");
var tb = createTiddlyElement( tbl, "tbody", null, null );
var tr ;
for(var r=0;r<tagged.length;r++) {
if ( ( r % rows ) == 0 )
tr = createTiddlyElement( tb, "tr", null, null, "");
var td = createTiddlyElement(tr,"td",null,null,"");
createTiddlyLink(td,tagged[r].title,true);
}
}}
//}}}
/***
This plugin is released under the [[Creative Commons Attribution 2.5 License|http://creativecommons.org/licenses/by/2.5/]]
***/
/***
|''Name:''|TheDumpPlugin |
|''Version:''|$Revision: 1 $ |
|''Source:''|http://thePettersons.org/tiddlywiki.html#TheDumpPlugin |
|''Author:''|[[Paul Petterson]] |
|''Type:''|Macro Extension |
|''Requires:''|TiddlyWiki 1.2.32 or higher |
!Description
This macro dumps TiddlyWiki internals. Usefull for seeing just what those wacky shadow-tiddlers really are! Also handy for seeing what macros you really do have installed! Can dump just about anything...
!Revision history
$History: TheDumpPlugin.js $
*
* ***************** Version 1 *****************
* User: paulpet Date: 2/24/06 Time: 1:14p
* Created in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* ported to TW v2, some small cosmetic changes
v1.0 initial public release...
!Sample Output (long)
{{{<<dump config.shadowTiddlers>>}}}
<<dump config.shadowTiddlers>>
----
!Code
***/
//{{{
config.macros.dump = {
dumper: function( place, obj ) {
var key, s = "";
var ul = createTiddlyElement( place, "ul", null, null, "");
for (key in obj) {
s = key + ": (" + typeof( obj[key] ) + ") " ;
switch( typeof( obj[key] )) {
case "number":
case "boolean":
s += obj[key] ;
var li = createTiddlyElement( ul, "li", null, null, s);
break;
case "string":
case "function":
var result = new String( obj[key] );
result = result.replace(/\n/g, "\n\r");
var li = createTiddlyElement( ul, "li", null, null, s);
createTiddlyElement( li, "pre", null, null, result );
break;
case "object":
var li = createTiddlyElement( ul, "li", null, null, s);
config.macros.dump.dumper( li, obj[key] );
break;
}
}
},
handler: function( place, macroName, params ) {
var what=params[0]?eval(params[0]):config;
config.macros.dump.dumper( place, what );
}};
//}}}
/***
This plugin is released under the [[Creative Commons Attribution 2.5 License|http://creativecommons.org/licenses/by/2.5/]]
***/
/***
|''Name:''|TiddlerStatsPlugin|
|''Version:''|$Revision: 5 $ |
|''Source:''|http://thePettersons.org/tiddlywiki.html#TiddlerStatsPlugin |
|''Author:''|[[Paul Petterson]] |
|''Type:''|Macro Extension |
|''Requires:''|TiddlyWiki 2.0.0 or higher |
!Description
Want to know how big your TW really is? Want to see how big your biggest tiddler is? TiddlerStats is the answer!
Finds and displays the number of and size of all tiddlers, the biggest, smallest, and average size. Even draws up a sparkline with that info in it!
!Sample
{{{<<tiddlerStats>>}}}
<<tiddlerStats>>
!Known issues
* Sparkline isn't showing up if you embed this macro in a tiddler that's displayed via a slider. This doesn't look like an issue with the macro yet...
!Todo
* Add support for # of tiddlers changed in last 1..7, 14, 30 days
!Revision history
$History: TiddlerStats.js $
*
* ***************** Version 5 *****************
* User: paulpet Date: 3/02/06 Time: 12:17p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* fixed firefox 1.5.0.1 crash //bug//
*
* ***************** Version 4 *****************
* User: paulpet Date: 2/26/06 Time: 8:48a
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
*
* ***************** Version 3 *****************
* User: paulpet Date: 2/26/06 Time: 8:47a
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
*
* ***************** Version 2 *****************
* User: paulpet Date: 2/22/06 Time: 3:41p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* Ported to TW2.0 fixed standard deviation problem
!Code
***/
//{{{
Tiddler.prototype.tiddlerSize = function() {
var x = 0 ;
if ( this.title ) x += this.title.length;
if ( this.text ) x += this.text.length;
if ( this.modifier) x += this.modifier.length;
if ( this.modified) x+= this.modified.convertToYYYYMMDDHHMM().length;
if ( this.created ) x+= this.created.convertToYYYYMMDDHHMM().length;
if ( this.tags ) {
var allTags = this.tags.join();
x += allTags.length;
}
return x;
}
// For backward compatibility with TW 1.2.x
// from UdoBorkowski
if (!TiddlyWiki.prototype.forEachTiddler) {
TiddlyWiki.prototype.forEachTiddler = function(callback) {
for(var t in this.tiddlers) {
callback.call(this,t,this.tiddlers[t]);
}
};
}
config.macros.tiddlerStats = {
doStats: function( stats ) {
stats.average = stats.size / stats.count ;
var ts = 0 ;
store.forEachTiddler( function( title, tiddler ) {
var x = tiddler.tiddlerSize() ;
var t = x - stats.average ;
ts += Math.pow( t, 2 );
});
stats.sdev = Math.sqrt( ts / stats.count ) ;
stats.data = [] ;
var bucket = parseInt( stats.max / stats.sdev ) + 1;
for( var i = 0 ; i < bucket; i++ )
stats.data[i] = 0 ;
stats.incontrol = 0 ;
store.forEachTiddler( function( title, tiddler ) {
var x = tiddler.tiddlerSize() ;
if (((stats.average - stats.sdev) < x) && (x < (stats.average + stats.sdev))) stats.incontrol++ ;
bucket = parseInt( x / stats.sdev ) ;
stats.data[bucket]++ ;
});
return stats ;
},
showStats: function( place, stats ) {
createTiddlyElement( place, "li", null, null, stats.count + " Tiddlers" ) ;
createTiddlyElement( place, "li", null, null, stats.size + " bytes (total content size)" ) ;
createTiddlyElement( place, "li", null, null, stats.average + " is the average tiddler size" ) ;
createTiddlyElement( place, "li", null, null, stats.sdev + " is the standard deviation" ) ;
createTiddlyElement( place, "li", null, null, stats.incontrol + " within 1 standard deviation of the average" ) ;
var li = createTiddlyElement( place, "li", null, null, stats.min + " is the smallest tiddler size " ) ;
createTiddlyLink( li, stats.smallest, true ) ;
li = createTiddlyElement( place, "li", null, null, stats.max + " is the largest tiddler size " ) ;
createTiddlyLink( li, stats.largest, true ) ;
},
showSparkle: function( place, stats ) {
var li = createTiddlyElement( place, "li", null, null, null ) ;
config.macros.sparkline.handler( li, "sparkline?", stats.data ) ;
},
showTable: function( place, stats ) {
var tbl = createTiddlyElement(place,"table",null,null,"");
var tb = createTiddlyElement( tbl, "tbody", null, null );
var tr ;
for( var i = 0; i < stats.data.length ; i++ ) {
if ( stats.data[i] > 0 ) {
tr = createTiddlyElement( tb, "tr", null, null, null );
createTiddlyElement(tr,"td",null,null, i );
createTiddlyElement(tr,"td",null,null, (i * stats.sdev) + " < " + ((i+1) * stats.sdev) );
createTiddlyElement(tr,"td",null,null, stats.data[i] );
}
}
},
handler: function( place, macroName, params ) {
var stats = new Object() ;
stats.count = 0 ;
stats.size = 0 ;
stats.min = 99999;
stats.max = 0 ;
stats.smallest = 0;
stats.largest = 0;
stats.xsquared = 0 ;
store.forEachTiddler(function(title,tiddler) {
stats.count++ ;
var x = tiddler.tiddlerSize() ;
stats.size += x ;
stats.xsquared += (x^2) ;
if ( stats.min > x ) {
stats.min = x ;
stats.smallest = tiddler.title ;
}
if ( stats.max < x ) {
stats.max = x ;
stats.largest = tiddler.title ;
}
return x;
});
stats = this.doStats( stats ) ;
createTiddlyElement( place, "b", null, null, "TiddlyWiki usage statistics" ) ;
var ul = createTiddlyElement( place, "ul", null, null, null ) ;
this.showStats( ul, stats ) ;
this.showSparkle( ul, stats ) ;
this.showTable( place, stats ) ;
}};
//}}}
/***
This plugin is released under the [[Creative Commons Attribution 2.5 License|http://creativecommons.org/licenses/by/2.5/]]
***/
Simple SQL like query language TQL? :)
!Features
* Run simple to complex queries, with joins across multiple 'tables' inside your TiddlyWiki.
* Output parameter can be Table.Column, Literal String, or Macro(parameters)
* Output parameter can be another SELECT using (SELECT...) notation
* Macros can have Table.Column values and will receive their values
* Default output is a table
* Can use SELECT Tiddler.Title + ": " + Tiddler.Tag to output a string, string will be wikified
* Can use IN with inner select
!Sample
{{{
<<
SELECT Tiddler.Title, TiddlerTag.Name, Tiddler.Modified, NewerTiddler(button:'edit',name:Tiddler.Title) AS OP
FROM Tiddler
JOIN TiddlerTags ON TiddlerTag.TiddlerName = Tiddler.TagName
WHERE TiddlerTag.TagName IN (
SELECT TiddlerTag.TiddlerName
FROM TiddlerTag
WHERE TiddlerTag.TagName = 'Context'
)
>>
}}}
!!Output
| !Tiddler.Title | !"""TiddlerTag""".Name | !Tiddler.Modified | !OP |
|[[Take out Trash]] |<<tag @Home>> |7/6/2007 |<<newerTiddler button:'edit' name:[[Take out Trash]]>> |
|[[Call Bob]] |<<tag @Call>> |7/6/2007 |<<newerTiddler button:'edit' name:[[Call Bob]]>> |
!Schema
| !Table | !Column | !Notes|
|Tiddler |Name |PK - Tiddler Name|
|Tiddler |Modified |Date Last Modified |
|Tiddler |Modifier |Who last Modified|
|Tiddler |Tags |All tags as a string|
| !Table | !Column | !Notes |
|Tag | Name |PK - Tag Name|
| !Table | !Column | !Notes |
|"""TiddlerTag""" |"""Tiddler""" |FK(Tiddler.Name) |
|"""TiddlerTag""" |"""Tag""" |FK(Tag.Name) |
| !Table | !Column | !Note |
|Slice |"""Tiddler""" |FK(Tiddler.Name) |
|Slice |"""Name""" |Name of the slice in the tiddler |
|Slice |"""Value""" |Value of the slice |
----
<<projectTemplate>>
Welcome to revision <<version>> of TiddlyWiki, an experimental MicroContent WikiWikiWeb built by JeremyRuston. It's written in HTML, CSS and JavaScript to run on any modern browser without needing any ServerSide logic. It allows anyone to create personal SelfContained hypertext documents that can be posted to any web server, sent by email or kept on a USB thumb drive to make a WikiOnAStick. This is the ThirdVersion of TiddlyWiki, and is published under an OpenSourceLicense.
A TiddlyWiki is like a blog because it's divided up into neat little chunks, but it encourages you to read it by hyperlinking rather than sequentially: if you like, a non-linear blog analogue that binds the individual microcontent items into a cohesive whole. I think that TiddlyWiki represents a novel medium for writing, and will promote its own distinctive WritingStyle. This is the ThirdVersion of TiddlyWiki, which adds several NewFeatures. There are also several TiddlyWikiAdaptations by other developers based on earlier versions.
The MicroContent chunks are called [[Tiddlers]].
TiddlyWiki's home is at http://www.tiddlywiki.com
/***
|''Name:''|TiddlyWikiDebugger |
|''Version:''|$Revision: 3 $ |
|''Source:''|http://thePettersons.org/tiddlywiki.html#TiddlyWikiDebugger |
|''Author:''|[[Paul Petterson]] |
|''Type:''|Developer/Hacker Extension |
|''Requires:''|TiddlyWiki 1.2.32 or higher |
!Description
The TWDebugger //hijacks// a function, replacing it with a custom function that traces it's arguments and return status. If multiple functions are traced, then a pseudo call stack is built showing what functions were called, in what order, and by what functions.
The following Macros are used to control setting up the method tracing, and display the results of the traced execution.
''Usage:''
To use the TWDebugger you will typically setup a special testing tiddler for your experiments, in this tiddler you will set ''watches'' on a macro and a set of functions the macro will call. After the interesting functions have watches set on them, call the macro. Finally show the results and stop ''watching'' the methods.
''Example:'' Get a real detailed picture of how the list orphans macro works...
!Step 1: Setup all the watches.
{{{<<watchMacro list>>}}}
{{{<<watchMethod config.macros.list.all handler>>}}}
{{{<<watchMethod store reverseLookup>>}}}
{{{<<watchMethod store getOrphans>>}}}
{{{<<watchMethod store getReferringTiddlers>>}}}
{{{<<watchMethod window createTiddlyLink>>}}}
!Step 2. Run the macro
{{{<<list orphans>>}}}
!Step 3. Stop watching & Show the results
{{{<<stop>>}}}
{{{<<showStack>>}}}
See TWDebuggerSample for an example of how this really looks.
!Revision history
$History: TiddlyWikiDebugger.js $
*
* ***************** Version 3 *****************
* User: paulpet Date: 3/03/06 Time: 6:54a
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* checkpoint
*
* ***************** Version 2 *****************
* User: paulpet Date: 2/26/06 Time: 8:47a
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
*
* ***************** Version 1 *****************
* User: paulpet Date: 2/24/06 Time: 1:26p
* Created in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* recovered from the abyss and ported to TW v2
!The TiddlyWikiDebugger Macros
!! Watch Macro
The {{{watchMacro}}} hijacks a macro's handler method and traces when it is called including the parameters it is called with. Macros typically have no return value in tiddlywiki so don't expect to see much there...
Call with only the name of the macro.
''Examples:''
* {{{<<watchMacro list>>}}} -- will display the parameters passed to the list macro.
* {{{<<watchMacro tabs>>}}}
***/
//{{{
config.macros.watchMacro = {
twd: new TWDebug() ,
handler: function(place,macroName,params) {
if ( !params[0] ) throw ("must pass in name of macro to watch...") ;
var o ;
eval("o = config.macros." + params[0] ) ;
this.twd.trace( o, "handler" ) ;
}}
//}}}
/***
!! Echo Macros
The {{{echoMacros}}} macro echos out the macro to the tiddler display before executing it.
Takes no parameters
''Examples:''
* {{{<<echoMacros>>}}}
***/
//{{{
config.macros.echoMacros = {
twd: config.macros.watchMacro.twd,
handler: function(place,macroName,params) {
this.twd.echo();
}}
//}}}
/***
!! Watch Method
The {{{watchMethod}}} macro hijacks a method and traces when it called, including what parameters it's called with, and traces when it returns, along with it's return value.
Call with an object and a method name.
''Examples:''
* {{{<<watchMethod config.macros.list.all handler>>}}} - a macro, or sub-macro method handler
* {{{<<watchMethod store getReferringTiddlers>>}}} - a method from the TiddlyWiki store
* {{{<<watchMethod window createTiddlyLink>>}}} - a //global// method
***/
//{{{
config.macros.watchMethod = {
twd: config.macros.watchMacro.twd,
handler: function(place,macroName,params) {
if ( !params[0] ) throw ("must pass in object & method to watch...") ;
if ( !params[1] ) throw ("must pass in object & method to watch...") ;
var o ;
eval("o = " + params[0] ) ;
this.twd.trace( o, params[1] ) ;
}}
//}}}
/***
!! Test Method
The {{{testMethod}}} macro hijacks a method and besides tracing it's call and return - also asserts some condition.
Call with an object, a method name, what to test against and the value to test for
''Examples:''
* {{{<<testMethod config.macros.list.withTags newCleaner returns null>>}}}
* {{{<<testMethod store getReferringTiddlers returns InstanceOf tiddler>>}}}
***/
//{{{
config.macros.testMethod = {
twd: config.macros.watchMacro.twd,
handler: function(place,macroName,params) {
if ( !params[0] ) throw ("must pass in object & method to watch...") ;
if ( !params[1] ) throw ("must pass in object & method to watch...") ;
if ( !params[2] ) throw ("must specify what to assert (returns)");
if ( !params[3] ) throw ("must specify condition to test for" );
var o ;
eval("o = " + params[0] ) ;
this.twd.trace( o, params[1] ) ;
}}
//}}}
/***
!! Show Stack
The {{{showStack}}} macro dumps an emulated //call stack// like view of methods called and returned. If a method is called while another method is executing, the new method's call will be indented under the origional method's call.
{{{showStack}}} also clears the log. THis is usefull when executing multiple macros, you can display the call stack right after each call, and the won't be all run together.
''Example:''
{{{<<showStack>>}}}
''Note:'' the showStack calls the ''wikify'' function, which in turn calls lots and lots of other methods. It is possible to get stuck in a loop here if you trace something like ''createTiddlyLink'' and one of the statements in the call-stack is a tiddly link. If you run into this, use the ''stop'' macro before calling ''showStack''.
***/
//{{{
config.macros.showStack = {
twd: config.macros.watchMacro.twd,
handler: function(place,macroName,params) {
this.twd.log.paused = true ;
wikify( this.twd.log.dump(), place ) ;
this.twd.log.paused = false ;
this.twd.log.reset() ;
}}
//}}}
/***
!! Stop
The {{{stop}}} macro stops all tracing, and restores all the methods, returning them to their origional methods.
***/
//{{{
config.macros.stop = {
twd: config.macros.watchMacro.twd,
handler: function(place,macroName,params) {
this.twd.stop() ;
}}
//}}}
/***
----
! Aspect & Object Code
***/
//{{{
// testing code
function showVar( v ) {
if ( ! v ) return "null" ;
var tov = typeof( v ) ;
var sret = "" ;
var verbose = false ;
switch( tov ) {
case "number": case "boolean":
sret = v ;
break ;
case "string":
sret = "'" + v + "'" ;
break ;
case "function":
sret = "function()" ;
break ;
case "object" :
if ( v.join ) { // this is an array!
sret = "[" ;
for( var i=0; i<v.length; i++ )
sret += ((i==0)?"":", ") + showVar( v[i] ) ;
sret += "]" ;
} else {
var sep = "" ;
sret = "{" ;
if ( verbose ) {
for( var key in v ) {
sret += sep + key + "(" + typeof( v[key] ) + "): " ;//+ showVar( v[i] ) ;
sep = ", " ;
}
} else {
if ( v.constructor == TiddlyWiki ) sret += "store" ;
else if ( v.constructor == wikify ) sret += "wikify" ;
else if ( v.constructor == Wikifier ) sret += "Wikifier" ;
else if ( v.constructor == Tiddler ) sret += "Tiddler:'" + v.title + "'" ;
else if ( v.constructor == Animator ) sret += "Animator" ;
else if ( v.parentNode ) sret += "DOMObject" ;
else sret += "?" ;
}
sret += "}" ;
}
break ;
default:
sret = "<b>typeof(" + tov + ")</b>" ;
break ;
}
return "{{{" + sret + "}}}" ;
}
function showArgs( args ) {
var sargs = "";
var sep = "" ;
for( var i = 0; i<args.length ; i++ ) {
sargs += sep + showVar( args[i] ) ;
sep = ", " ;
}
return sargs ;
}
function Logger() {
this.log = ['* new Logger()'] ;
this.depth = 1 ;
this.starStr = "**********" ;
this.paused = false ;
this.stars = function() { return this.starStr.substr(0,(this.depth>10?10:this.depth)); } ;
return this ;
}
Logger.prototype.logMsg = function( str ) {
if ( this.paused ) return str ;
this.log.push( this.stars() + " " + str ) ;
return str ;
}
Logger.prototype.call = function( fn, args ) {
if ( this.paused ) return args ;
this.log.push( this.stars() + " Calling: {{{" + fn + "}}}( " + showArgs( args ) + " )" ) ;
this.depth++ ;
return args ;
}
Logger.prototype.ret = function( fn, results ) {
if ( this.paused ) return results ;
this.depth-- ;
this.log.push( this.stars() + " Returning: {{{" + fn + "}}} = " + showVar( results )) ;
return results ;
}
Logger.prototype.Assert = function( expect, actual, msg ) {
var es, as ;
var pass ;
try {
pass = ( expect == actual ) ;
} catch( e ) {
pass = false ;
this.log.push( this.stars() + " Caught exception on assert: " + e );
}
try {
es = showVar( expect );
} catch( e ) {
es = "<exception>";
}
try {
as = showVar( actual );
} catch( e ) {
as = "<exception>";
}
this.log.push( this.stars() + " Assertion "+ pass?"Passed":"Failed" + ". Expected: " + es + " actual: " + as + " -- " + msg );
return actual ;
}
Logger.prototype.dump = function() {
var s = this.log.join("\n") ;
return s ;
}
Logger.prototype.reset = function() {
this.log = ['* Logger.reset()'] ;
this.depth = 1 ;
}
function TWDebug() {
this.log = new Logger() ;
this.methodStore = new Array() ;
return this ;
}
TWDebug.prototype.storeMethod = function( obj, fn ) {
this.methodStore.push( { object:obj, method:fn, ptr:obj[fn] } ) ;
}
TWDebug.prototype.echo = function() {
this.storeMethod( window, "invokeMacro" );
var old = window["invokeMacro"] ;
window["invokeMacro"] = function(place,macro,params,wikifier,tiddler) {
var text = "<<" + macro + " " + params + ">>";
createTiddlyElement(place,"pre",null,null,text);
old( place, macro, params, wikifier, tiddler );
}
}
// Trace method - replaces existing method with one that logs arguments, calls method, logs result
TWDebug.prototype.trace = function( obj, fn ) {
var log = this.log ;
this.storeMethod( obj, fn ) ;
var old = obj[fn] ;
obj[fn] = function() {
try {
return log.ret( fn, old.apply( this, log.call( fn, arguments ))) ;
} catch( e ) {
log.logMsg( "Function: " + fn + " threw an exception: " + e.toString() ) ;
throw( e ) ;
}
}
this.writeLog( "Started tracing: " + fn ) ;
}
TWDebug.prototype.AssertReturn = function( obj, fn, expect, msg ) {
var log = this.log ;
this.storeMethod( obj, fn ) ;
var old = obj[fn] ;
obj[fn] = function() {
try {
return log.Assert( expect, log.ret( fn, old.apply( this, log.call( fn, arguments ))), msg ) ;
} catch( e ) {
log.logMsg( "Function: " + fn + " threw an exception: " + e.toString() ) ;
throw( e ) ;
}
}
this.writeLog( "Started Assertion tracing: " + fn ) ;
}
TWDebug.prototype.stop = function() {
var m;
while( (m = this.methodStore.pop()) != null ) {
var obj = m.object ;
var fn = m.method ;
try { obj[fn] = m.ptr ; } catch(e) { this.writeLog( "error on stop: " + e.description ); }
this.writeLog( "Stopped tracing: " + fn ) ;
}
}
// Add additional information in the call stack history
TWDebug.prototype.writeLog = function( str ) {
if ( this && this.log ) this.log.logMsg( str );
}
//}}}
/***
This plugin is released under the [[Creative Commons Attribution 2.5 License|http://creativecommons.org/licenses/by/2.5/]]
***/
I found a bug switching back and forth between numbered and bulleted lists:
!Example 1 - Single Bullet, Single #
{{{
* foo
# bar
}}}
renders as:
* foo
# bar
expecting:
<html><UL><LI>foo</LI></UL><OL><LI>bar</LI></OL></html>
!! test
<<twUnit "Example 1 - Single Bullet, Single Number"
var text = "* foo\n# bar\n";
var expected = "<UL><LI>foo</LI></UL><OL><LI>bar</LI></OL>"
var actual = wikifyStatic( text ).replace( /\s/g, "" );
this.AssertSame( expected, actual, "Rendering error" );
>>
! Example 2 - Bullet, Number, Sub Number
* foo
# bar
## bar.2
renders as:
* foo
# bar
## bar.2
expecting:
<html><UL><LI>foo</LI></UL><OL><LI>bar</LI><OL><LI>bar.2</LI></OL></OL></html>
!! test
<<twUnit "Example 2 - Bullet, Number, Sub Number"
var text = "* foo\n# bar\n## bar.2\n";
var expected = "<UL><LI>foo</LI></UL><OL><LI>bar</LI><OL><LI>bar.2</LI></OL></OL>"
var actual = wikifyStatic( text ).replace( /\s/g, "" );
this.AssertSame( expected, actual, "Rendering error" );
>>
! Example 3 - last bullet is now a number
Shows how the 'baz' is now at the 'bar' level
{{{
* foo
# bar
## bar.2
* baz
}}}
renders as:
* foo
# bar
## bar.2
* baz
expecting:
<html><UL><LI>foo</LI></UL><OL><LI>bar</LI><OL><LI>bar.2</LI></OL></OL><UL><LI>baz</LI></UL></html>
<<twUnit "Example 3 - last bullet is now a number"
var text = "* foo\n# bar\n## bar.2\n* baz\n";
var expected = "<UL><LI>foo</LI></UL><OL><LI>bar</LI><OL><LI>bar.2</LI></OL></OL><UL><LI>baz</LI></UL>"
var actual = wikifyStatic( text ).replace( /\s/g, "" );
this.AssertSame( expected, actual, "Rendering error" );
>>
config.tiddlyspotSiteId = 'yoursiteid'
| !date | !user | !location | !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |
| 3/7/2007 22:0:23 | YourName | [[PaulsNotepad.html|file:///C:/Documents%20and%20Settings/paulpet/My%20Documents/Visual%20Studio%202005/Projects/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsNotepad.html]] | [[store.cgi|http://tiddlyspot.com/PaulsNotepad/store.cgi]] | . | index.html | . |
| 8/7/2007 18:33:18 | PaulPetterson | [[PaulsNotepad.htm|file:///C:/Users/Paul/Desktop/PaulsNotepad.htm]] | [[store.cgi|http://tiddlyspot.com/PaulsNotepad/store.cgi]] | . | index.html | . |
| 8/7/2007 18:33:36 | PaulPetterson | [[PaulsNotepad.htm|file:///C:/Users/Paul/Desktop/PaulsNotepad.htm]] | [[store.cgi|http://tiddlyspot.com/PaulsNotepad/store.cgi]] | . | index.html | . |
| 11/7/2007 13:44:27 | PaulPetterson | [[PaulsNotepad.htm|file:///C:/Documents%20and%20Settings/paulpet/Desktop/PaulsNotepad.htm]] | [[store.cgi|http://tiddlyspot.com/PaulsNotepad/store.cgi]] | . | index.html | . |
| 11/7/2007 13:44:44 | PaulPetterson | [[PaulsNotepad.htm|file:///C:/Documents%20and%20Settings/paulpet/Desktop/PaulsNotepad.htm]] | [[store.cgi|http://tiddlyspot.com/PaulsNotepad/store.cgi]] | . | index.html | . |
| 13/7/2007 21:48:57 | PaulPetterson | [[/|http://tiddlyspot.com/PaulsNotepad/]] | [[store.cgi|http://tiddlyspot.com/PaulsNotepad/store.cgi]] | . | index.html | . |
| 14/7/2007 15:35:23 | PaulsNotepad | [[PaulsNotepad.htm|file:///C:/Users/Paul/Desktop/PaulsNotepad.htm]] | [[store.cgi|http://tiddlyspot.com/PaulsNotepad/store.cgi]] | . | index.html | . | Ok |
| 14/7/2007 15:42:42 | PaulsNotepad | [[PaulsNotepad.htm|file:///C:/Users/Paul/Desktop/PaulsNotepad.htm]] | [[store.cgi|http://tiddlyspot.com/PaulsNotepad/store.cgi]] | . | index.html | . |
| 14/7/2007 15:43:11 | PaulsNotepad | [[PaulsNotepad.htm|file:///C:/Users/Paul/Desktop/PaulsNotepad.htm]] | [[store.cgi|http://tiddlyspot.com/PaulsNotepad/store.cgi]] | . | index.html | . |
/***
<<tiddler UploadPluginDoc>>
!Code
***/
//{{{
version.extensions.UploadPlugin = {
major: 3, minor: 3, revision: 3,
date: new Date(2006,6,30),
type: 'macro',
source: 'http://tiddlywiki.bidix.info/#UploadPlugin',
docs: 'http://tiddlywiki.bidix.info/#UploadPluginDoc'
};
//}}}
////+++!![config.lib.file]
//{{{
if (!config.lib) config.lib = {};
if (!config.lib.file) config.lib.file= {
author: 'BidiX',
version: {major: 0, minor: 1, revision: 0},
date: new Date(2006,3,9)
};
config.lib.file.dirname = function (filePath) {
var lastpos;
if ((lastpos = filePath.lastIndexOf("/")) != -1) {
return filePath.substring(0, lastpos);
} else {
return filePath.substring(0, filePath.lastIndexOf("\\"));
}
};
config.lib.file.basename = function (filePath) {
var lastpos;
if ((lastpos = filePath.lastIndexOf("#")) != -1)
filePath = filePath.substring(0, lastpos);
if ((lastpos = filePath.lastIndexOf("/")) != -1) {
return filePath.substring(lastpos + 1);
} else
return filePath.substring(filePath.lastIndexOf("\\")+1);
};
window.basename = function() {return "@@deprecated@@";};
//}}}
////===
////+++!![config.lib.log]
//{{{
if (!config.lib) config.lib = {};
if (!config.lib.log) config.lib.log= {
author: 'BidiX',
version: {major: 0, minor: 1, revision: 0},
date: new Date(2006,3,9)
};
config.lib.Log = function(tiddlerTitle, logHeader) {
if (version.major < 2)
this.tiddler = store.tiddlers[tiddlerTitle];
else
this.tiddler = store.getTiddler(tiddlerTitle);
if (!this.tiddler) {
this.tiddler = new Tiddler();
this.tiddler.title = tiddlerTitle;
this.tiddler.text = "| !date | !user | !location |" + logHeader;
this.tiddler.created = new Date();
this.tiddler.modifier = config.options.txtUserName;
this.tiddler.modified = new Date();
if (version.major < 2)
store.tiddlers[tiddlerTitle] = this.tiddler;
else
store.addTiddler(this.tiddler);
}
return this;
};
config.lib.Log.prototype.newLine = function (line) {
var now = new Date();
var newText = "| ";
newText += now.getDate()+"/"+(now.getMonth()+1)+"/"+now.getFullYear() + " ";
newText += now.getHours()+":"+now.getMinutes()+":"+now.getSeconds()+" | ";
newText += config.options.txtUserName + " | ";
var location = document.location.toString();
var filename = config.lib.file.basename(location);
if (!filename) filename = '/';
newText += "[["+filename+"|"+location + "]] |";
this.tiddler.text = this.tiddler.text + "\n" + newText;
this.addToLine(line);
};
config.lib.Log.prototype.addToLine = function (text) {
this.tiddler.text = this.tiddler.text + text;
this.tiddler.modifier = config.options.txtUserName;
this.tiddler.modified = new Date();
if (version.major < 2)
store.tiddlers[this.tiddler.tittle] = this.tiddler;
else {
store.addTiddler(this.tiddler);
story.refreshTiddler(this.tiddler.title);
store.notify(this.tiddler.title, true);
}
if (version.major < 2)
store.notifyAll();
};
//}}}
////===
////+++!![config.lib.options]
//{{{
if (!config.lib) config.lib = {};
if (!config.lib.options) config.lib.options = {
author: 'BidiX',
version: {major: 0, minor: 1, revision: 0},
date: new Date(2006,3,9)
};
config.lib.options.init = function (name, defaultValue) {
if (!config.options[name]) {
config.options[name] = defaultValue;
saveOptionCookie(name);
}
};
//}}}
////===
////+++!![PasswordTweak]
//{{{
version.extensions.PasswordTweak = {
major: 1, minor: 0, revision: 2, date: new Date(2006,3,11),
type: 'tweak',
source: 'http://tiddlywiki.bidix.info/#PasswordTweak'
};
//}}}
/***
!!config.macros.option
***/
//{{{
config.macros.option.passwordCheckboxLabel = "Save this password on this computer";
config.macros.option.passwordType = "password"; // password | text
config.macros.option.onChangeOption = function(e)
{
var opt = this.getAttribute("option");
var elementType,valueField;
if(opt) {
switch(opt.substr(0,3)) {
case "txt":
elementType = "input";
valueField = "value";
break;
case "pas":
elementType = "input";
valueField = "value";
break;
case "chk":
elementType = "input";
valueField = "checked";
break;
}
config.options[opt] = this[valueField];
saveOptionCookie(opt);
var nodes = document.getElementsByTagName(elementType);
for(var t=0; t<nodes.length; t++) {
var optNode = nodes[t].getAttribute("option");
if (opt == optNode)
nodes[t][valueField] = this[valueField];
}
}
return(true);
};
config.macros.option.handler = function(place,macroName,params)
{
var opt = params[0];
var size = 15;
if (params[1])
size = params[1];
if(config.options[opt] === undefined) {
return;}
var c;
switch(opt.substr(0,3)) {
case "txt":
c = document.createElement("input");
c.onkeyup = this.onChangeOption;
c.setAttribute ("option",opt);
c.size = size;
c.value = config.options[opt];
place.appendChild(c);
break;
case "pas":
// input password
c = document.createElement ("input");
c.setAttribute("type",config.macros.option.passwordType);
c.onkeyup = this.onChangeOption;
c.setAttribute("option",opt);
c.size = size;
c.value = config.options[opt];
place.appendChild(c);
// checkbox link with this password "save this password on this computer"
c = document.createElement("input");
c.setAttribute("type","checkbox");
c.onclick = this.onChangeOption;
c.setAttribute("option","chk"+opt);
place.appendChild(c);
c.checked = config.options["chk"+opt];
// text savePasswordCheckboxLabel
place.appendChild(document.createTextNode(config.macros.option.passwordCheckboxLabel));
break;
case "chk":
c = document.createElement("input");
c.setAttribute("type","checkbox");
c.onclick = this.onChangeOption;
c.setAttribute("option",opt);
place.appendChild(c);
c.checked = config.options[opt];
break;
}
};
//}}}
/***
!! Option cookie stuff
***/
//{{{
window.loadOptionsCookie_orig_PasswordTweak = window.loadOptionsCookie;
window.loadOptionsCookie = function()
{
var cookies = document.cookie.split(";");
for(var c=0; c<cookies.length; c++) {
var p = cookies[c].indexOf("=");
if(p != -1) {
var name = cookies[c].substr(0,p).trim();
var value = cookies[c].substr(p+1).trim();
switch(name.substr(0,3)) {
case "txt":
config.options[name] = unescape(value);
break;
case "pas":
config.options[name] = unescape(value);
break;
case "chk":
config.options[name] = value == "true";
break;
}
}
}
};
window.saveOptionCookie_orig_PasswordTweak = window.saveOptionCookie;
window.saveOptionCookie = function(name)
{
var c = name + "=";
switch(name.substr(0,3)) {
case "txt":
c += escape(config.options[name].toString());
break;
case "chk":
c += config.options[name] ? "true" : "false";
// is there an option link with this chk ?
if (config.options[name.substr(3)]) {
saveOptionCookie(name.substr(3));
}
break;
case "pas":
if (config.options["chk"+name]) {
c += escape(config.options[name].toString());
} else {
c += "";
}
break;
}
c += "; expires=Fri, 1 Jan 2038 12:00:00 UTC; path=/";
document.cookie = c;
};
//}}}
/***
!! Initializations
***/
//{{{
// define config.options.pasPassword
if (!config.options.pasPassword) {
config.options.pasPassword = 'defaultPassword';
window.saveOptionCookie('pasPassword');
}
// since loadCookies is first called befor password definition
// we need to reload cookies
window.loadOptionsCookie();
//}}}
////===
////+++!![config.macros.upload]
//{{{
config.macros.upload = {
accessKey: "U",
formName: "UploadPlugin",
contentType: "text/html;charset=UTF-8",
defaultStoreScript: "store.php"
};
// only this two configs need to be translated
config.macros.upload.messages = {
aboutToUpload: "About to upload TiddlyWiki to %0",
errorDownloading: "Error downloading",
errorUploadingContent: "Error uploading content",
fileNotFound: "file to upload not found",
fileNotUploaded: "File %0 NOT uploaded",
mainFileUploaded: "Main TiddlyWiki file uploaded to %0",
urlParamMissing: "url param missing",
rssFileNotUploaded: "RssFile %0 NOT uploaded",
rssFileUploaded: "Rss File uploaded to %0"
};
config.macros.upload.label = {
promptOption: "Save and Upload this TiddlyWiki with UploadOptions",
promptParamMacro: "Save and Upload this TiddlyWiki in %0",
saveLabel: "save to web",
saveToDisk: "save to disk",
uploadLabel: "upload"
};
config.macros.upload.handler = function(place,macroName,params){
// parameters initialization
var storeUrl = params[0];
var toFilename = params[1];
var backupDir = params[2];
var uploadDir = params[3];
var username = params[4];
var password; // for security reason no password as macro parameter
var label;
if (document.location.toString().substr(0,4) == "http")
label = this.label.saveLabel;
else
label = this.label.uploadLabel;
var prompt;
if (storeUrl) {
prompt = this.label.promptParamMacro.toString().format([this.dirname(storeUrl)]);
}
else {
prompt = this.label.promptOption;
}
createTiddlyButton(place, label, prompt,
function () {
config.macros.upload.upload(storeUrl, toFilename, uploadDir, backupDir, username, password);
return false;},
null, null, this.accessKey);
};
config.macros.upload.UploadLog = function() {
return new config.lib.Log('UploadLog', " !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |" );
};
config.macros.upload.UploadLog.prototype = config.lib.Log.prototype;
config.macros.upload.UploadLog.prototype.startUpload = function(storeUrl, toFilename, uploadDir, backupDir) {
var line = " [[" + config.lib.file.basename(storeUrl) + "|" + storeUrl + "]] | ";
line += uploadDir + " | " + toFilename + " | " + backupDir + " |";
this.newLine(line);
};
config.macros.upload.UploadLog.prototype.endUpload = function() {
this.addToLine(" Ok |");
};
config.macros.upload.basename = config.lib.file.basename;
config.macros.upload.dirname = config.lib.file.dirname;
config.macros.upload.upload = function(storeUrl, toFilename, uploadDir, backupDir, username, password)
{
// parameters initialization
storeUrl = (storeUrl ? storeUrl : config.options.txtUploadStoreUrl);
toFilename = (toFilename ? toFilename : config.options.txtUploadFilename);
backupDir = (backupDir ? backupDir : config.options.txtUploadBackupDir);
uploadDir = (uploadDir ? uploadDir : config.options.txtUploadDir);
username = (username ? username : config.options.txtUploadUserName);
password = config.options.pasUploadPassword; // for security reason no password as macro parameter
if (storeUrl === '') {
config.macros.upload.defaultStoreScript;
}
if (config.lib.file.dirname(storeUrl) === '') {
storeUrl = config.lib.file.dirname(document.location.toString())+'/'+storeUrl;
}
if (toFilename === '') {
toFilename = config.lib.file.basename(document.location.toString());
}
clearMessage();
// only for forcing the message to display
if (version.major < 2)
store.notifyAll();
if (!storeUrl) {
alert(config.macros.upload.messages.urlParamMissing);
return;
}
var log = new this.UploadLog();
log.startUpload(storeUrl, toFilename, uploadDir, backupDir);
if (document.location.toString().substr(0,5) == "file:") {
saveChanges();
}
displayMessage(config.macros.upload.messages.aboutToUpload.format([this.dirname(storeUrl)]), this.dirname(storeUrl));
this.uploadChanges(storeUrl, toFilename, uploadDir, backupDir, username, password);
if(config.options.chkGenerateAnRssFeed) {
//var rssContent = convertUnicodeToUTF8(generateRss());
var rssContent = generateRss();
var rssPath = toFilename.substr(0,toFilename.lastIndexOf(".")) + ".xml";
this.uploadContent(rssContent, storeUrl, rssPath, uploadDir, '', username, password,
function (responseText) {
if (responseText.substring(0,1) != '0') {
displayMessage(config.macros.upload.messages.rssFileNotUploaded.format([rssPath]));
}
else {
if (uploadDir) {
rssPath = uploadDir + "/" + config.macros.upload.basename(rssPath);
} else {
rssPath = config.macros.upload.basename(rssPath);
}
displayMessage(config.macros.upload.messages.rssFileUploaded.format(
[config.macros.upload.dirname(storeUrl)+"/"+rssPath]), config.macros.upload.dirname(storeUrl)+"/"+rssPath);
}
// for debugging store.php uncomment last line
//DEBUG alert(responseText);
});
}
return;
};
config.macros.upload.uploadChanges = function(storeUrl, toFilename, uploadDir, backupDir,
username, password) {
var original;
if (document.location.toString().substr(0,4) == "http") {
original = this.download(storeUrl, toFilename, uploadDir, backupDir, username, password);
return;
}
else {
// standard way : Local file
original = loadFile(getLocalPath(document.location.toString()));
if(window.Components) {
// it's a mozilla browser
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]
.createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
converter.charset = "UTF-8";
original = converter.ConvertToUnicode(original);
}
catch(e) {
}
}
}
//DEBUG alert(original);
this.uploadChangesFrom(original, storeUrl, toFilename, uploadDir, backupDir,
username, password);
};
config.macros.upload.uploadChangesFrom = function(original, storeUrl, toFilename, uploadDir, backupDir,
username, password) {
var startSaveArea = '<div id="' + 'storeArea">'; // Split up into two so that indexOf() of this source doesn't find it
var endSaveArea = '</d' + 'iv>';
// Locate the storeArea div's
var posOpeningDiv = original.indexOf(startSaveArea);
var posClosingDiv = original.lastIndexOf(endSaveArea);
if((posOpeningDiv == -1) || (posClosingDiv == -1))
{
alert(config.messages.invalidFileError.format([document.location.toString()]));
return;
}
var revised = original.substr(0,posOpeningDiv + startSaveArea.length) +
allTiddlersAsHtml() + "\n\t\t" +
original.substr(posClosingDiv);
var newSiteTitle;
if(version.major < 2){
newSiteTitle = (getElementText("siteTitle") + " - " + getElementText("siteSubtitle")).htmlEncode();
} else {
newSiteTitle = (wikifyPlain ("SiteTitle") + " - " + wikifyPlain ("SiteSubtitle")).htmlEncode();
}
revised = revised.replace(new RegExp("<title>[^<]*</title>", "im"),"<title>"+ newSiteTitle +"</title>");
var response = this.uploadContent(revised, storeUrl, toFilename, uploadDir, backupDir,
username, password, function (responseText) {
if (responseText.substring(0,1) != '0') {
alert(responseText);
displayMessage(config.macros.upload.messages.fileNotUploaded.format([getLocalPath(document.location.toString())]));
}
else {
if (uploadDir !== '') {
toFilename = uploadDir + "/" + config.macros.upload.basename(toFilename);
} else {
toFilename = config.macros.upload.basename(toFilename);
}
displayMessage(config.macros.upload.messages.mainFileUploaded.format(
[config.macros.upload.dirname(storeUrl)+"/"+toFilename]), config.macros.upload.dirname(storeUrl)+"/"+toFilename);
var log = new config.macros.upload.UploadLog();
log.endUpload();
store.setDirty(false);
}
// for debugging store.php uncomment last line
//DEBUG alert(responseText);
}
);
};
config.macros.upload.uploadContent = function(content, storeUrl, toFilename, uploadDir, backupDir,
username, password, callbackFn) {
var boundary = "---------------------------"+"AaB03x";
var request;
try {
request = new XMLHttpRequest();
}
catch (e) {
request = new ActiveXObject("Msxml2.XMLHTTP");
}
if (window.netscape){
try {
if (document.location.toString().substr(0,4) != "http") {
netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');}
}
catch (e) { }
}
//DEBUG alert("user["+config.options.txtUploadUserName+"] password[" + config.options.pasUploadPassword + "]");
// compose headers data
var sheader = "";
sheader += "--" + boundary + "\r\nContent-disposition: form-data; name=\"";
sheader += config.macros.upload.formName +"\"\r\n\r\n";
sheader += "backupDir="+backupDir
+";user=" + username
+";password=" + password
+";uploaddir=" + uploadDir
+ ";;\r\n";
sheader += "\r\n" + "--" + boundary + "\r\n";
sheader += "Content-disposition: form-data; name=\"userfile\"; filename=\""+toFilename+"\"\r\n";
sheader += "Content-Type: " + config.macros.upload.contentType + "\r\n";
sheader += "Content-Length: " + content.length + "\r\n\r\n";
// compose trailer data
var strailer = new String();
strailer = "\r\n--" + boundary + "--\r\n";
var data;
data = sheader + content + strailer;
//request.open("POST", storeUrl, true, username, password);
request.open("POST", storeUrl, true);
request.onreadystatechange = function () {
if (request.readyState == 4) {
if (request.status == 200)
callbackFn(request.responseText);
else
alert(config.macros.upload.messages.errorUploadingContent);
}
};
request.setRequestHeader("Content-Length",data.length);
request.setRequestHeader("Content-Type","multipart/form-data; boundary="+boundary);
request.send(data);
};
config.macros.upload.download = function(uploadUrl, uploadToFilename, uploadDir, uploadBackupDir,
username, password) {
var request;
try {
request = new XMLHttpRequest();
}
catch (e) {
request = new ActiveXObject("Msxml2.XMLHTTP");
}
try {
if (uploadUrl.substr(0,4) == "http") {
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
}
else {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
}
} catch (e) { }
//request.open("GET", document.location.toString(), true, username, password);
request.open("GET", document.location.toString(), true);
request.onreadystatechange = function () {
if (request.readyState == 4) {
if(request.status == 200) {
config.macros.upload.uploadChangesFrom(request.responseText, uploadUrl,
uploadToFilename, uploadDir, uploadBackupDir, username, password);
}
else
alert(config.macros.upload.messages.errorDownloading.format(
[document.location.toString()]));
}
};
request.send(null);
};
//}}}
////===
////+++!![Initializations]
//{{{
config.lib.options.init('txtUploadStoreUrl','store.php');
config.lib.options.init('txtUploadFilename','');
config.lib.options.init('txtUploadDir','');
config.lib.options.init('txtUploadBackupDir','');
config.lib.options.init('txtUploadUserName',config.options.txtUserName);
config.lib.options.init('pasUploadPassword','');
config.shadowTiddlers.UploadPluginDoc = "[[Full Documentation|http://tiddlywiki.bidix.info/l#UploadPluginDoc ]]\n";
//}}}
////===
////+++!![Core Hijacking]
//{{{
config.macros.saveChanges.label_orig_UploadPlugin = config.macros.saveChanges.label;
config.macros.saveChanges.label = config.macros.upload.label.saveToDisk;
config.macros.saveChanges.handler_orig_UploadPlugin = config.macros.saveChanges.handler;
config.macros.saveChanges.handler = function(place)
{
if ((!readOnly) && (document.location.toString().substr(0,4) != "http"))
createTiddlyButton(place,this.label,this.prompt,this.onClick,null,null,this.accessKey);
}
//}}}
////===
<!--{{{-->
<div class='tags' macro='tags'></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='viewer' macro='view text wikified'></div>
<div class='tagging' macro='tagging'></div>
<div class='tagClear'></div>
<!--}}}-->
A Wiki is a popular way of building collaborative websites. It's based on the ideas of easy editing of pages and the use of special WikiWord notation to automagically create links between pages. See Wikipedia for [[more details|http://en.wikipedia.org/wiki/Wiki]]. TiddlyWiki is different from a conventional Wiki because it is not based on entire pages of content, but rather items of MicroContent that are referred to as 'tiddlers'.
A WikiWord is a word composed of a bunch of other words slammed together with each of their first letters capitalised. WikiWord notation in a conventional WikiWikiWeb is used to name individual pages while TiddlyWiki uses WikiWord titles for smaller chunks of MicroContent. Referring to a page with a WikiWord automatically creates a link to it. Clicking on a link jumps to that page or, if it doesn't exist, to an editor to create it. This ThirdVersion of TiddlyWiki also adds NonWikiWordLinks.
! Work In Progress...
IP: StyleSheet PaulsNotepadColors PaulsNotepadLayout HorizontalMainMenuStyleSheet
REF: StyleSheetColors StyleSheetLayout ColorChart ColorCard
!!Style
* The tagging & tagged sections need a whole lot of work
* I use taggly tagging maybe I should include them here?
!! Plugins
* GettingThingsDonePlugin - add UnitTests
* ListWithTagsPlugin - one new bug - rewrite unit tests so that they create the tiddlers/tags they need
* ForEachPlugin - UnitTests
!! Future
* Integration TiddlyWikiDebugger with [[twUnit]]
* TableListPlugin - instead of a list, it displays a table
* ListExtensionsPlugin - lists out everything in the config.extensions section
/***
<<dumpParams date modified [[DD-MM-YY]]>>
<<dumpParams foo <<test\>\> bar "foo\nbar" foo\nbar>>
!Code
***/
//{{{
//String.prototype.readMacroParams = function()
//{
// var regexpMacroParam = /(?:([\'\"])([^\'\"\\]*(?:\\.[^\'\"\\]*)*)\1)|(?:\[\[((?:[^\]]|(?:\](?!\])))*)\]\])|(?:\S)+/g ;
// var params = [];
// var match;
// while( ( match = regexpMacroParam.exec(this)) != null )
// params.push(match[3]?match[3]:match[2]?match[2]:match[0]);
// return params;
//}
config.macros.dumpParams = {};
config.macros.dumpParams.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
var result ="{{{<<"+macroName+" "+paramString+">>}}}\n";
for (var i = 0; i < params.length; i++) {
result += "["+i+"] = \"{{{"+params[i]+"}}}\"\n";
}
wikify(result,place);
}
//}}}
/***
Testing reparser
<<reparser slideTime:5000 autostart continuous>>
<<reparser test:"some thing" some:'thing else' else:'or what">>
<<reparser fails:on this>>
<<reparser one two>>
<<reparser three:four>>
<<reparser five:"six\"some" six:'stuid\"thing' to:'try\'again'>>
<<reparser bug:"one' :'two' 'three' four>>
<<reparser "bug":six>>
!Code
***/
//{{{
config.macros.reparser = {
reparse: function( params ) {
var re = /([^:\'\"\s]+)(?::([^\'\":\s]+)|:[\'\"]([^\'\"\\]*(?:\\.[^\'\"\\]*)*)[\'\"])?(?=\s|$)/g;
var ret = new Array() ;
var m ;
while( (m = re.exec( params )) != null )
ret[ m[1] ] = m[2]?m[2]:m[3]?m[3]:true ;
return ret ;
},
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var nvpair = this.reparse( paramString ) ;
var tbl = createTiddlyElement(place,"table",null,null,"");
var tb = createTiddlyElement( tbl, "tbody", null, null );
var tr = createTiddlyElement( tb, "tr", null, null, "");
var td = createTiddlyElement(tr,"td",null,null,paramString);
td.setAttribute("colSpan",2);
for( var name in nvpair ) {
if ( typeof( nvpair[name] ) != "function" ) {
tr = createTiddlyElement( tb, "tr", null, null, "");
createTiddlyElement(tr,"td",null,null,name);
createTiddlyElement(tr,"td",null,null,nvpair[name]);
}
}
}}
//}}}
/***
|''Name:''|//twUnit// |
|''Description:''|twUnit is a simple unit testing macro. |
|''Version:''|1.0 - $Revision: 8 $ |
|''Date:''|$JustDate: 7/08/07 $ |
|''Source:''|http://thePettersons.org/PaulsNotepad.html#twUnit |
|''Author:''|[[Paul Petterson]] |
|''License:''|[[CC Attribution 2.5|http://creativecommons.org/licenses/by/2.5/]] |
|''CoreVersion:''|TiddlyWiki 2.1.x or Higher |
!Description
Adds two new macros to support unit testing of plugins, or just plain old javascript testing.
twUnit - this defines and runs a unit test, displaying it's results.
twRunner - runs all the twUnit unit tests on a specified tiddler and summarized their results.
!Usage
Create a tiddler with several twUnit macros on it to test various conditions. When you open the tiddler, the tests will run and detailed results will be displayed. If you want only a summary, then reference that unit testing tiddler using the twRunner macro.
If a given unit test does not call an Assert method, then that unit test run will be marked as inconclusive.
!Syntax
to create a unit test use twUnit
{{{
<<twUnit "<name of test>"
// code to run the test
use the assert methods to validate success or failure:
this.Assert( boolean, message )
boolean: true = success, false = failure
message: message to display on failure
this.AssertSame( expected, actual, message )
expected: the expected value
actual: the actual value
message: the failure message to display if expected != actual
this.AssertNotSame( expected, actual, message )
expected: the expected value
actual: the actual value
message: the failure message to display if expected == actual
this.Log( message )
message: just output a message in the test log...
>>
}}}
to run all the unit tests on a tiddler (see unit tests section below for sample)
{{{
<<twRunner TiddlerName>>
}}}
!Sample
<<twUnit "Revision Number Testing"
// Make sure this is the right version...
var expected = version.extensions.twUnit.revision ;
var actual = '$Revision: 8 $'.match( /\$[^\d]+([\d]+)[^\$]*\$/im )[1] ;
this.AssertSame( expected, actual, "Wrong Version #" );
>>
!Unit Tests
<<twRunner twUnitTests>>
!Todo
!Revision history
$History: twUnit.js $
*
* ***************** Version 8 *****************
* User: paulpet Date: 7/08/07 Time: 6:10p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* Added a loging (log doesn't have unit tests yet)
*
* ***************** Version 7 *****************
* User: paulpet Date: 7/03/07 Time: 9:07p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* Added twRunner macro to run a list of tests from a single tiddler and
* display the results.
*
* ***************** Version 6 *****************
* User: paulpet Date: 7/03/07 Time: 4:57p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* twUnit Update - added multiple-failure support & logging. Updated
* UnitTest unit tests for more coverage.
*
* ***************** Version 5 *****************
* User: paulpet Date: 12/21/06 Time: 3:20p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* twUnit Version 1
*
* ***************** Version 4 *****************
* User: paulpet Date: 12/21/06 Time: 2:23p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* checkpoint
*
* ***************** Version 3 *****************
* User: paulpet Date: 12/21/06 Time: 2:16p
* Updated in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* twUnit Version 1 - a few VSS expansion issues to figure out!
*
* ***************** Version 1 *****************
* User: paulpet Date: 12/16/06 Time: 12:12p
* Created in $/PaulsNotepad3.0.root/PaulsNotepad3.0/PaulsPlugins/systemConfig
* first working copy of twUnit.js
!Code
***/
//{{{
// Code...
version.extensions.twUnit = {
major: 1,
minor: 0,
revision: new Number( '$Revision: 8 $'.match( /\$[^\d]+([\d]+)[^\$]*\$/im )[1] ) ,
date: new Date( '$JustDate: 7/08/07 $'.match( /\$[^\d]+([\d\/\/]+)[^\$]*\$/im )[1].replace(/(\d+\/\d+\/)(\d+)/img, "$120$2") )
};
config.macros.twRunner = {
tests: [],
handler: function( place, macroName, params, wikifier, paramsString, tiddler ) {
// reset our tests array
this.tests = new Array();
// collect our tests;
var tn = params[0];
this.collectTests( tn );
// if we have tests -
if ( this.tests.length > 0 ) {
// loop through them, execute them, and and create a results table.
var resultsString = "| !Test Name | !Result |";
for( var i = 0; i < this.tests.length; i++ ) {
var ut = this.tests[i];
var name = ut.TestName;
var res = "???" ;
try {
ut.Test();
res = ut.Result();
} catch( e ) {
res = exceptionText( e, "Test Threw Exception" );
}
resultsString += "\n|\"\"\"" + name + "\"\"\" | " + res + " |";
}
wikify( resultsString, place );
}
},
collectTests: function( tiddlerName ) {
// parse the unit test tiddler to collect the tests
var text = store.getTiddlerText(tiddlerName);
var place = createTiddlyElement(document.body,"div");
place.style.display = "none";
config.macros.twUnit.collectOnly = true;
wikify(text,place,null,store.getTiddler(tiddlerName));
config.macros.twUnit.collectOnly = false;
removeNode( place );
// finally restore the origional handler
// config.macros.twUnit.handler = oldHandler;
}}
config.macros.twUnit = {
printTest: function( ut ) {
var outStr = "''Test'': ''//{{{" + ut.TestName + "}}}//'' \n" ;
outStr += "''Result'': " + ut.Result() + "\n";
outStr += "''Unit Test Code'':\n{{{\n" + ut.code + "\n}}}\n";
outStr += "''Unit Test Log'':\n{{{\n" + ut.DumpLog() + "\n}}}\n" ;
return outStr ;
},
collectOnly: false,
handler: function( place, macroName, params, wikifier, paramsString, tiddler ) {
var u ;
try {
var name = params[0] ;
var code = paramsString.substr( paramsString.indexOf( params[1] ) );
u = new UnitTest( name, code );
} catch( ex ) {
createTiddlyText( place, exceptionText( ex, "Exception on setup." ));
}
if ( this.collectOnly ) {
if ( u != undefined )
config.macros.twRunner.tests.push( u );
} else {
try {
var ret = u.Test() ;
var results = this.printTest( u );
wikify( results, place ) ;
} catch( ex ) {
createTiddlyText( place, exceptionText( ex, "Exception on execution/results display." ));
}
}
}}
//}}}
/***
!Unit Testing Support Code
***/
//{{{
function UnitTest(name, code) {
this.TestName = name;
this.Tested = false;
this.Success = false;
this.traceLog = [''] ;
this.code = code;
return this;
}
UnitTest.prototype.Assert = function( bool, message ) {
if ( ! this.Tested ) {
this.Success = bool;
this.Tested = true;
} else
this.Success = this.Success && bool;
if ( ! bool )
this.Log( message ) ;
return this.Success;
}
UnitTest.prototype.AssertSame = function( expected, actual, message ) {
var msg = "AssertSame Failed: Expected '" + expected + "' (" + typeof( expected ) + ") Actual '" + actual + "' (" + typeof( expected ) + ") Message: " + message ;
return this.Assert( (expected == actual), msg );
}
UnitTest.prototype.AssertNotSame = function( expected, actual, message ) {
var msg = "AssertNotSame Failed: Expected '" + expected + "' (" + typeof( expected ) + ") Actual '" + actual + "' (" + typeof( expected ) + ") Message: " + message ;
return this.Assert( (expected != actual), msg );
}
UnitTest.prototype.Test = function() {
this.Success = true ;
try {
eval( this.code );
} catch( e ) {
this.Assert( false, exceptionText( e, "Test threw an exception" ));
}
return this.Success ;
}
UnitTest.prototype.Result = function() {
if ( ! this.Tested ) {
return "@@color(yellow):Inconclusive@@";
} else {
if ( this.Success ) {
return "@@color(green):Succeeded!@@" ;
} else {
return "@@color(red):Failed!@@" ;
}
}
}
UnitTest.prototype.Log = function( message ) {
this.traceLog.push( message ) ;
}
UnitTest.prototype.DumpLog = function() {
var s = this.traceLog.join("\n") ;
return s ;
}
UnitTest.prototype.ShowVar = function( obj, name ) {
if ( name == null ) name = "obj" ;
var show = function( name, val, typ ) { return name + "=" + val ; };
switch( typeof( obj )) {
case "number":
case "boolean":
this.Log( show( name, String( obj ), typeof( obj )) );
break;
case "string":
this.Log( show( name, "'" + obj + "'", typeof( obj )) );
break;
case "object":
if ( obj ) {
for( var key in obj )
this.ShowVar( obj[key], name + "[" + key + "]" ) ;
} else
this.Log( show( name, 'null', typeof( obj )) );
break;
}
}
//}}}
/***
This plugin is released under the [[Creative Commons Attribution 2.5 License|http://creativecommons.org/licenses/by/2.5/]]
***/
!UnitTest Testing
<<twUnit "UnitTest Simple Success test"
var code = "var someTest = true ;\nthis.Assert( someTest, \"Fail!\" );\n";
var ut = new UnitTest( "UnitTest-Success", code );
var actual = ut.Test();
var expected = true;
this.AssertSame( expected, actual , "ut.Test() should have passed..." );
actual = ut.Tested;
expected = true;
this.AssertSame( expected, actual, "ut.Tested should be true" );
expected = code;
actual = ut.code;
this.AssertSame( expected, actual , "ut.code is wrong..." );
expected = "" ;
actual = ut.DumpLog();
this.AssertSame( expected, actual , "ut.DumpLog() is wrong..." );
>>
----
<<twUnit "UnitTest Failure test"
var code = "var someTest = false ;\nthis.Assert( someTest, \"Fail!\" );\n";
var ut = new UnitTest( "UnitTest-Failure", code );
var actual = ut.Test();
var expected = false;
this.AssertSame( expected, actual , "ut.Test() should have failed..." );
actual = ut.Tested;
expected = true;
this.AssertSame( expected, actual, "ut.Tested should be true" );
expected = code;
actual = ut.code;
this.AssertSame( expected, actual , "ut.code is wrong..." );
expected = "\nFail!" ;
actual = ut.DumpLog();
this.AssertSame( expected, actual , "ut.DumpLog() is wrong..." );
>>
----
<<twUnit "UnitTest Inclusive test"
var code = "var someTest = false ;\n";
var ut = new UnitTest( "UnitTest-Inconclusive", code );
var actual = ut.Test();
var expected = true;
this.AssertSame( expected, actual , "ut.Test() should have succeeded..." );
actual = ut.Tested;
expected = false;
this.AssertSame( expected, actual, "ut.Tested should be false" );
expected = code;
actual = ut.code;
this.AssertSame( expected, actual , "ut.code is wrong..." );
expected = "";
actual = ut.DumpLog();
this.AssertSame( expected, actual , "ut.DumpLog() is wrong..." );
>>
----
!UnitTest AssertSame Tests
<<twUnit "UnitTest AssertSame Success test"
var code = "var e = \"abc\" ;\nvar a = \"abc\" ;\nthis.AssertSame( e, a, \"Failure!\" );";
var ut = new UnitTest( "UnitTest-Success", code );
var actual = ut.Test();
var expected = true;
this.AssertSame( expected, actual , "ut.Test() should have passed..." );
actual = ut.Tested;
expected = true;
this.AssertSame( expected, actual, "ut.Tested should be true" );
expected = code;
actual = ut.code;
this.AssertSame( expected, actual , "ut.code is wrong..." );
expected = "" ;
actual = ut.DumpLog();
this.AssertSame( expected, actual , "ut.DumpLog() is wrong..." );
>>
----
<<twUnit "UnitTest AssertSame Failure test"
var code = "var e = \"abc\" ;\nvar a = \"123\" ;\nthis.AssertSame( e, a, \"Failure!\" );";
var ut = new UnitTest( "UnitTest-Success", code );
var actual = ut.Test();
var expected = false;
this.AssertSame( expected, actual , "ut.Test() should have failed..." );
actual = ut.Tested;
expected = true;
this.AssertSame( expected, actual, "ut.Tested should be true" );
expected = code;
actual = ut.code;
this.AssertSame( expected, actual , "ut.code is wrong..." );
expected = "\nAssertSame Failed: Expected 'abc' (string) Actual '123' (string) Message: Failure!" ;
actual = ut.DumpLog();
this.AssertSame( expected, actual , "ut.DumpLog() is wrong..." );
>>
----
!UnitTest AssertNotSame Tests
<<twUnit "UnitTest AssertNotSame Success test"
var code = "var e = \"abc\" ;\nvar a = \"123\" ;\nthis.AssertNotSame( e, a, \"Failure!\" );";
var ut = new UnitTest( "UnitTest-Success", code );
var actual = ut.Test();
var expected = true;
this.AssertSame( expected, actual , "ut.Test() should have passed..." );
actual = ut.Tested;
expected = true;
this.AssertSame( expected, actual, "ut.Tested should be true" );
expected = code;
actual = ut.code;
this.AssertSame( expected, actual , "ut.code is wrong..." );
expected = "" ;
actual = ut.DumpLog();
this.AssertSame( expected, actual , "ut.DumpLog() is wrong..." );
>>
----
<<twUnit "UnitTest AssertSame Failure test"
var code = "var e = \"abc\" ;\nvar a = \"abc\" ;\nthis.AssertNotSame( e, a, \"Failure!\" );";
var ut = new UnitTest( "UnitTest-Success", code );
var actual = ut.Test();
var expected = false;
this.AssertSame( expected, actual , "ut.Test() should have failed" );
actual = ut.Tested;
expected = true;
this.AssertSame( expected, actual, "ut.Tested should be true" );
expected = code;
actual = ut.code;
this.AssertSame( expected, actual , "ut.code is wrong..." );
expected = "\nAssertNotSame Failed: Expected 'abc' (string) Actual 'abc' (string) Message: Failure!" ;
actual = ut.DumpLog();
this.AssertSame( expected, actual , "ut.DumpLog() is wrong..." );
>>
----
!UnitTest Multi-Result Tests
<<twUnit "UnitTest Multi-Result All Success test"
var code = "var r = true;\nthis.Assert( r, \"1 Failed\" );\nr = true;\nthis.Assert( r, \"2 Failed\" );";
var ut = new UnitTest( "UnitTest-Success", code );
var actual = ut.Test();
var expected = true;
this.AssertSame( expected, actual , "ut.Test() should have passed" );
actual = ut.Tested;
expected = true;
this.AssertSame( expected, actual, "ut.Tested should be true" );
expected = code;
actual = ut.code;
this.AssertSame( expected, actual , "ut.code is wrong..." );
expected = "" ;
actual = ut.DumpLog();
this.AssertSame( expected, actual , "ut.DumpLog() is wrong..." );
>>
----
<<twUnit "UnitTest Multi-Result First Failed test"
var code = "var r = false;\nthis.Assert( r, \"1 Failed\" );\nr = true;\nthis.Assert( r, \"2 Failed\" );";
var ut = new UnitTest( "UnitTest-Success", code );
var actual = ut.Test();
var expected = false;
this.AssertSame( expected, actual , "ut.Test() should have failed" );
actual = ut.Tested;
expected = true;
this.AssertSame( expected, actual, "ut.Tested should be true" );
expected = code;
actual = ut.code;
this.AssertSame( expected, actual , "ut.code is wrong..." );
expected = "\n1 Failed" ;
actual = ut.DumpLog();
this.AssertSame( expected, actual , "ut.DumpLog() is wrong..." );
>>
----
<<twUnit "UnitTest Multi-Result Second Failed test"
var code = "var r = true;\nthis.Assert( r, \"1 Failed\" );\nr = false;\nthis.Assert( r, \"2 Failed\" );";
var ut = new UnitTest( "UnitTest-Success", code );
var actual = ut.Test();
var expected = false;
this.AssertSame( expected, actual , "ut.Test() should have failed" );
actual = ut.Tested;
expected = true;
this.AssertSame( expected, actual, "ut.Tested should be true" );
expected = code;
actual = ut.code;
this.AssertSame( expected, actual , "ut.code is wrong..." );
expected = "\n2 Failed" ;
actual = ut.DumpLog();
this.AssertSame( expected, actual , "ut.DumpLog() is wrong..." );
>>
----
<<twUnit "UnitTest Multi-Result All Failed test"
var code = "var r = false;\nthis.Assert( r, \"1 Failed\" );\nr = false;\nthis.Assert( r, \"2 Failed\" );";
var ut = new UnitTest( "UnitTest-Success", code );
var actual = ut.Test();
var expected = false;
this.AssertSame( expected, actual , "ut.Test() should have failed" );
actual = ut.Tested;
expected = true;
this.AssertSame( expected, actual, "ut.Tested should be true" );
expected = code;
actual = ut.code;
this.AssertSame( expected, actual , "ut.code is wrong..." );
expected = "\n1 Failed\n2 Failed" ;
actual = ut.DumpLog();
this.AssertSame( expected, actual , "ut.DumpLog() is wrong..." );
>>
----
!UnitTest Logging Tests
<<twUnit "UnitTest Logging Success Test"
var code = "this.Log( \"Line 1\" );\nthis.Assert( true, \"Fail!\" );";
var ut = new UnitTest( "UnitTest-Log-Success", code );
var actual = ut.Test();
var expected = true;
this.AssertSame( expected, actual , "ut.Test() should have passed..." );
actual = ut.Tested;
expected = true;
this.AssertSame( expected, actual, "ut.Tested should be true" );
expected = code;
actual = ut.code;
this.AssertSame( expected, actual , "ut.code is wrong..." );
expected = "\nLine 1" ;
actual = ut.DumpLog();
this.AssertSame( expected, actual , "ut.DumpLog() is wrong..." );
>>
----
<<twUnit "UnitTest Logging Failure Test"
var code = "this.Log( \"Line 1\" );\nthis.Assert( false, \"Fail!\" );";
var ut = new UnitTest( "UnitTest-Log-Success", code );
var actual = ut.Test();
var expected = false;
this.AssertSame( expected, actual , "ut.Test() should have failed" );
actual = ut.Tested;
expected = true;
this.AssertSame( expected, actual, "ut.Tested should be true" );
expected = code;
actual = ut.code;
this.AssertSame( expected, actual , "ut.code is wrong..." );
expected = "\nLine 1\nFail!" ;
actual = ut.DumpLog();
this.AssertSame( expected, actual , "ut.DumpLog() is wrong..." );
>>
----