/*\
title: $:/macros/danielo/tinto.js
type: application/javascript
module-type: macro
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Information about this macro
This is developed to put some text in color.
<<tinto "text" "green">>
<<tinto "text">> (will be red)
<$macrocall $name="tinto" color="pink" text="elephant"/>
*/
exports.name = "tinfo";
exports.params = [
{ name: "text" },
{ name: "color" }
];
/*
Run the macro
*/
exports.run = function(text, color) {
if( !text) text = "IMPORTANT"; if( !color) color = "red";
return "<span style='color:" + color + "'>" + text + "</span>";
};
})();
\define red($text$)
@@color:red;
$text$
@@
\end
<<red "this is red">>
\define red($text$) is wrong. It should be \define red(text)\define red(text)
@@color:red;
$text$
@@
\end
<$macrocall $name="red" text={{!!title}}/>this not red {{this is red||red}} this not red
- the
\define red($text$)is wrong. It should be\define red(text)
- It's a macro that you need to put everywhere where you want red text
But this one might be interesting. Define a tiddler "red" containing:\define red(text)
@@color:red;
$text$
@@
\end
<$macrocall $name="red" text={{!!title}}/>
and then use it like so:this not red {{this is red||red}} this not red
But you can put it into $:/core/ui/PageMacros
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/groups/opt_out.
The advantage is that you don't have to know javascript to make macros. I am not a programmer.
"tinto" spanish (according to translate.google.com) for "colorize"
exports.name = "tinfo";
I was going to say what Alberto said :)
Am Freitag, 31. Januar 2014 20:31:43 UTC+1 schrieb Ton Gerner:The advantage is that you don't have to know javascript to make macros. I am not a programmer."Thou shalt not fear JavaScript" :D
Come on, Ton! You understand so much of TiddlyWiki, that little of JavaScript you need to know to transfer a TW macro to JS is nothing.
You can even use a bookmarklet I wrote. Look at http://tw5magick.tiddlyspot.com and search for " Macro to Javascript Bookmarklet".
Drag that bookmarklet to you bookmarks.
Create a new tiddler.
Paste into that tiddler your macro.
Click your new bookmarklet and you'll get your macro translated to Javascript.
Can I color a specific text in TW5?