Skip to content

Instantly share code, notes, and snippets.

@udkl
Last active January 1, 2016 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save udkl/8208729 to your computer and use it in GitHub Desktop.
Save udkl/8208729 to your computer and use it in GitHub Desktop.
Collection of Macros used across TiddlyWiki files. It's on gist because of the need of a central place to update the macros and then copy into other tiddlyWikis.
config.macros.hero= {};
config.macros.hero.handler = function (place,macroName,params,wikifier,paramString,tiddler) {
var heroText= params.length > 0 ? params[0] : "BLANK";
wikify("__@@''"+heroText+"''@@__", place);
}
config.macros.insight= {};
config.macros.insight.handler = function (place,macroName,params,wikifier,paramString,tiddler) {
var insightText= params.length > 0 ? params[0] : "BLANK";
wikify("^^@@Insight@@ : "+insightText+"^^", place);
}
config.macros.hrLine= {};
config.macros.hrLine.handler = function (place,macroName,params,wikifier,paramString,tiddler) {
var insightText= params.length > 0 ? params[0] : "BLANK";
wikify("-------------------------------------------------------------------------------------------------", place);
}
config.macros.imgSrc= {};
config.macros.imgSrc.handler = function (place,macroName,params,wikifier,paramString,tiddler) {
var imgSrc= params.length > 0 ? params[0] : "BLANK";
var width= params.length > 1 ? params[1] : "400";
var height = params.length > 2 ? params[2] : "400";
var border = params.length > 3 ? params[3] : "1";
wikify('<html><img border="1" width="'+width+'" height="'+height+'" src="'+imgSrc+'" /></html>', place);
}
config.macros.noNewLine= {};
config.macros.noNewLine.handler = function (place,macroName,params,wikifier,paramString,tiddler) {
var textWithNewLines = params.length > 0 ? params[0] : "BLANK";
var textWithoutNewLines = textWithNewLines.replace('\n','');
textWithoutNewLines = textWithoutNewLines.replace('\r','');
wikify(textWithoutNewLines, place);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment