@PMario I will just remove the "//" and everything that follows to the end of the line (remove all comments and keep the programming)
I did create 2 short scripts, that you can copy paste into your developer > console and execute there. > ... > The following script doesn't modify anything. > It just outputs a list of new tiddler names. ... > by copy paste into my developer console - you mean just add a new tiddler called "PMario step 1" with the body containing your code (stripped of comments) and save it - and it is going to reveal me a list of tiddlers to check??? Developer console must be something else... > > "use strict"; > // read existing tiddlers > var titles = $tw.wiki.getTiddlers(); > > var newTitle = function (elem) { > var xx, > match = elem.match(/(.+)(\d{4}-\d?\d-\d?\d)(.*)/); > if (match != null) { > // matched text: match[0] > // match start: match.index > // capturing group n: match[n] > > // swap matches > if (match[1] && match[2]) { > xx = match[2] + " " + match[1] > } > > // If there is some text after the date append it > // format: <date> <match 1>--<match 3> > // just change the "--" to your likings > if (match[3]) xx = xx + "--" + match[3]; > > return xx.trim(); // trim() removes trailing spaces > } else { > return elem; > } > } > > // create new titles > var newTitles = titles.map(newTitle) > > newTitles.map(function(elem) {console.log(elem)}) > > > > *Second step *- *Danger Zone* > If the frist step went OK, you can use the second function to rewrite your > titles. > > WARNING - Use a BACKUP !! > > "use strict"; > // read existing tiddlers > var titles = $tw.wiki.getTiddlers(); > > var rewriteTitles = function (elem) { > var xx, > match = elem.match(/(.+)(\d{4}-\d?\d-\d?\d)(.*)/); > if (match != null) { > // matched text: match[0] > // match start: match.index > // capturing group n: match[n] > > // swap matches > if (match[1] && match[2]) { > xx = match[2] + " " + match[1] > } > > // If there is some text after the date append it > // format: <date> <match 1>--<match 3> > // just change the "--" to your likings > if (match[3]) xx = xx + "--" + match[3]; > > var tid = $tw.wiki.getTiddler(elem) > > xx.trim(); // trim() removes trailing spaces > > // danger zone ... > if (tid) { > $tw.wiki.addTiddler(new $tw.Tiddler(tid, {title: xx})); > $tw.wiki.deleteTiddler(elem); > > // create some feedback > console.log(elem, "-->", xx); > } > > return xx; > } else { > return elem; > } > } > > // Enter the Danger Zone! > // BACKUP - BACKUP - BACKUP before you execute this! > > // You need to uncomment the next line to excute the function!! > // titles.map(rewriteTitles); > > > > Depending on the number of tiddlers, this may take some time. > > have fun! > mario > > > > -- 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+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at https://groups.google.com/group/tiddlywiki. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/e8d7c6b7-216b-41a2-89ed-f4a6db2ff57b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.