Story.getRenderedContentPart (name, fmt)
function checks if the text of the story was already cached and if it's still valid if false, it caches it again

  • Returns
    String cached text of story
Sourcecode in Story/objectFunctions.js:
1:   function getRenderedContentPart(name, fmt) {
2:      var part = this.content.getProperty(name);
3:      if (!part)
4:         return "";
5:      var key = fmt ? name + ":" + fmt : name;
6:      var lastRendered = this.cache["lastRendered_" + key];
7:      if (!lastRendered ||
8:          lastRendered.getTime() < this.content.getLastModified().getTime()) {
9:         switch (fmt) {
10:           case "plaintext":
11:              part = stripTags(part);
12:              break;
13:           case "alttext":
14:              part = stripTags(part);
15:              part = part.replace(/\"/g, "&quot;");
16:              part = part.replace(/\'/g, "&#39;");
17:              break;
18:           default:
19:              var s = createSkin(format(part));
20:              this.allowTextMacros(s);
21:              // enable caching; some macros (eg. poll, storylist)
22:              // will set this to false to prevent caching of a contentpart
23:              // containing them
24:              req.data.cachePart = true;
25:              // The following is necessary so that global macros know where they belong to.
26:              // Even if they are embeded at some other site.
27:              var tmpSite;
28:              if (this.site != res.handlers.site) {
29:                 tmpSite = res.handlers.site;
30:                 res.handlers.site = this.site;
31:              }
32:              part = this.renderSkinAsString(s).activateURLs();
33:              if (tmpSite)
34:                 res.handlers.site = tmpSite;
35:        }
36:        this.cache[key] = part;
37:        if (req.data.cachePart)
38:           this.cache["lastRendered_" + key] = new Date();
39:     }   
40:     return this.cache[key];
41:  }