class JsonTiddler {
  constructor(title) {
    this.title = title;
  }

  run() {
    const title = this.title || this.getVariable("currentTiddler");
    const tiddler = !!title && this.wiki.getTiddler(title);
    const fields = {};

    if (tiddler) {
      for (const field in tiddler.fields) {
        fields[field] = tiddler.getFieldString(field);
      }
    }

    return JSON.stringify(fields, null, $tw.config.preferences.jsonSpaces);
  }
}

module.exports = JsonTiddler;
jsexportsname = jsontiddler;exportsparams = 	name title;Run the macroexportsrun = functiontitle 	title = title thisgetVariablecurrentTiddler;	var tiddler = !!title && thiswikigetTiddlertitle		fields

原文地址: http://www.cveoy.top/t/topic/iWqK 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录