Dear Stephan
I've cut and pasted the text into a tiddler, given it the title
"$:/macros/skeeve/wordcount.js" and set the type to "application/javascript"

I have also added a field with "module-type: macro"

I've tried this on TW.com the result is that nothing  appears to happen. I
bet I've overlooked something very simple...

best wishes

Alex

On 10 December 2014 at 11:10, Stephan Hradek <[email protected]>
wrote:

>
>
> Am Mittwoch, 10. Dezember 2014 11:15:12 UTC+1 schrieb AlexHough:
>>
>> Is there an update for TW 5 for this [1]
>>
>> ALex
>>
>> [1] http://wordcountmacro.tiddlyspot.com/
>>
>
> Is this sufficient?
>
> /*\
> title: $:/macros/skeeve/wordcount.js
> type: application/javascript
> module-type: macro
>
> <<wordcount text>>
>
> Examples:
> <<wordcount "sometext">>
> <<wordcount tiddler:"tiddlertitle">>
> <$macrocall $name="wordcount" text="sometext"/>
> <$macrocall $name="wordcount" tiddler={{!!title}}/>
>
> Inspired by: http://wordcountmacro.tiddlyspot.com/
>
> \*/
> (function(){
>
> /*jslint node: true, browser: true */
> /*global $tw: false */
> "use strict";
>
> /*
> Information about this macro
> This is a macro to get the number of "words" of a string/text or a tiddler.
>
> */
>
> exports.name = "wordcount";
>
> exports.params = [
>     { name: "text" },
>     { name: "tiddler" },
> ];
>
> /*
> Run the macro
> */
> exports.run = function(text, tiddler) {
>     if(!text) {
>         if(!tiddler) {
>             return "0";
>         }
>         text = tiddler + " " + ($tw.wiki.getTiddlerText(tiddler) || "");
>     }
>     return text.match(/\w+/g).length.toString() || "0";
> };
>
> })();
>
>
>  --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/tiddlywiki.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to