Hello,
I'm trying to find a way to get the current {{!!title}} into an
alphanumeric + underscores format variable, so for example "Topic: Foo Bar"
would be converted to "topic_foo_bar"
The following works to convert text as wanted:
/*\
title: JavaC1
type: application/javascript
module-type: macro
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
exports.name = "JavaC1";
exports.params = [
{ name: "myText" }
];
/*
Run the macro
*/
exports.run = function(myText) {
if( !myText) myText = "all spaces to underscores";
var myAlphanum = myText.replace(/[^A-Z0-9]+/ig, "_");
var output ="1: [" + myText + "] <br>2: [" + myAlphanum+ "]";
return output;
};
})();
Calling:
<<JavaC1>>
<<JavaC1 "symbols ? disappear ! as # well">>
but I can't find how to make it automatically retrieve {{!!title}} as with
normal tiddlywiki macros.
Alternatively, is there any other method to transform/user regex inside
regular macros, or easily acquire the title on that format? Thanks
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/346e7895-76fa-4d46-85a0-277504ee9b8f%40googlegroups.com.