Fixed b/w compatibility for linked comments in history skin

This commit is contained in:
Tobi Schäfer 2015-01-05 20:26:29 +01:00
parent 4166b29b05
commit c614e08718
3 changed files with 42 additions and 28 deletions

View file

@ -429,32 +429,18 @@ Story.prototype.getMacroHandler = function(name) {
*/
Story.prototype.summary_macro = function(param) {
param.limit || (param.limit = 15);
var keys, summary;
if (arguments.length > 1) {
res.push();
var content;
for (var i=1; i<arguments.length; i+=1) {
if (content = this.getMetadata(arguments[i])) {
res.write(content);
res.write(String.SPACE);
var summary = this.title || this.text;
if (!summary && arguments.length > 1) {
var buffer, content = [];
for (var i = 1; i < arguments.length; i += 1) {
if (buffer = this.getMetadata(arguments[i])) {
content.push(buffer);
}
}
summary = res.pop();
}
if (!summary) {
summary = (this.title || String.EMPTY) + String.SPACE +
(this.text || String.EMPTY);
summary = content.join(String.SPACE);
}
var clipped = stripTags(summary).clip(param.limit, param.clipping, '\\s');
var head = clipped.split(/(\s)/, param.limit * 0.6).join(String.EMPTY);
var tail = clipped.substring(head.length).trim();
head = head.trim();
if (!head && !tail) {
head = '…';
}
param.link ? html.link({href: this.href()}, head) : res.write(head);
res.writeln('\n');
res.write(tail);
res.write(clipped || '…');
return;
}

View file

@ -114,13 +114,11 @@
<% #history %>
<li>
<a href='<% this.href %>' title='<% this.modified %>'>
<% this.summary %>
<div>
<small>
<% this.creator %>, <% this.modified text %>
</small>
</div>
<% this.summary | this.link %>
</a>
<div class='uk-text-small'>
<% this.creator %>, <% this.modified text %>
</div>
</li>
<% #permalink %>

View file

@ -422,3 +422,33 @@ Story.prototype.reads_macro = function(param) {
res.write(this.requests);
return;
}
Story.prototype.summary_macro = function(param) {
param.limit || (param.limit = 15);
var keys, summary;
if (arguments.length > 1) {
res.push();
var content;
for (var i=1; i<arguments.length; i+=1) {
if (content = this.getMetadata(arguments[i])) {
res.write(content);
res.write(String.SPACE);
}
}
summary = res.pop();
}
if (!summary) {
summary = (this.title || String.EMPTY) + String.SPACE + (this.text || String.EMPTY);
}
var clipped = stripTags(summary).clip(param.limit, param.clipping, '\\s');
var head = clipped.split(/(\s)/, param.limit * 0.6).join(String.EMPTY);
var tail = clipped.substring(head.length).trim();
head = head.trim();
if (!head && !tail) {
head = '…';
}
html.link({href: this.href()}, head);
res.writeln('<br>');
res.write(tail);
return;
}