Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2018 06:52 AM
You would have to write your own script to do replacement on the meta strings. I've done this, it's a bit of a find/replace exercise in script. Mine tend to be very bespoke where I identify the known keywords and what text is replaced. I don't do any dictionary lookups or display values.
An example from a recent script include:
replaceMeta : function (episodeGr, text) {
var newText = text;
// gs.info('text=' + text);
var patt = /(\${[a-z_]*})/g;
var list = text.match(patt);
if (!list) {
gs.warn('No meta strings found in: ' + text);
return text;
}
if (list.length == 0) {
return text;
}
// gs.info('list.length=' + list.length);
for (var i = 0; i < list.length; i++) {
// gs.info('found: ' + list[i]);
switch (list[i]) {
case '${html_topic_list}':
newText = text.replace(list[i], this._generateHTMLList(episodeGr));
break;
case '${youtube_id}':
if (episodeGr.youtube_url) {
newText = text.replace(list[i], this._getYouTubeID(episodeGr.getValue('youtube_url')));
}
break;
case '${text_topic_list}':
newText = text.replace(list[i], this._generateTextList(episodeGr));
break;
case '${repo_url}':
var repo = gs.getProperty('x_snc_cls.repo_name');
if (episodeGr.has_git) {
var url = repo + '/tree/master/' + episodeGr.date.getDisplayValue();
newText = text.replace(list[i], url);
} else {
newText = text.replace(list[i], repo);
}
break;
case '${date}':
var dateStr = episodeGr.date.getDisplayValue();
newText = text.replace(list[i], dateStr);
break;
case '${community_url}':
if (episodeGr.community_url) {
newText = text.replace(list[i], episodeGr.getValue('community_url'));
}
break;
}
text = newText;
}
return text;
},