参照一覧の仕様変更
refs → actions (page) → references
book references: page before: [:results | (book formatBookAction: 'bar' request: request response: response shelf: shelf), String crlf, '<h3>Link', ((results size > 1) ifTrue: ['s'] ifFalse: ['']), ' to this Page</h3>', String crlf, '<ul>', String crlf] during: [:element | '<li><a href="', (request referenceShelf: shelf book: book page: element), '">', element showName, '</a> last edited on ', element printDate, ' at ', element printTime, ' by ', element user, String crlf] after: [:results | '</ul>', String crlf] ifAbsent: ['']
↓
| user |
book references: page before: [:results | String crlf, '<hr>', String crlf, '<table border=0 cellpadding=3 cellspacing=3>', String crlf, '<tr>', String crlf, '<td align=left valign=middle>', (book formatBookAction: 'emoteHappy' request: request response: response shelf: shelf), '</td>', String crlf, '<td align=left valign=middle><b>以下の ', (results size asString), ' ページから参照されています。</b></td>', String crlf, '</tr>', String crlf, '</table>', String crlf, '<ul>', String crlf]
during: [:element | '<li><a href="', (request referenceShelf: shelf book: book page: element), '">', element showName, '</a> <font color=gray size=-1>最終更新: ', element printDate, ', ', element printTime, ' <', ((user _ element user) = '' ifTrue: ['unknown'] ifFalse: [(user _ user copyUpTo: $.) copyFrom: 1 to: (user size min: 7)]), '></font>', String crlf]
after: [:results | '</ul>', String crlf, '<hr>']
ifAbsent: [(page == (book pages ifNotNil: [book pages at: 1])) ifTrue: [''] ifFalse: [String crlf, '<hr>', String crlf, '<table border=0 cellpadding=3 cellspacing=3>', String crlf, '<tr>', String crlf, '<td align=left valign=middle>', (book formatBookAction: 'emoteSad' request: request response: response shelf: shelf), '</td>', String crlf, '<td align=left valign=middle><b>このページは Swiki ブック内で孤立しています。</b></td>', String crlf, '</tr>', String crlf, '</table>', String crlf, '<hr>']]
SwikiBook >> #references:before:during:after:ifAbsent: "最初のページからの参照も含める、が、自己参照は排除するように仕様変更"
references: page before: beforeBlock during: duringBlock after: afterBlock ifAbsent: absentBlock
| results return |
results _ OrderedCollection new.
pages do: [:element | ((element settingsAt: 'referenceCache' ifAbsent: [OrderedCollection new]) includes: page id) ifTrue: [results add: element]].
"(results includes: (pages at: 1)) ifTrue: [results remove: (pages at: 1)]."
(results includes: page) ifTrue: [results remove: page].
(results size > 0) ifTrue: [
return _ beforeBlock value: results.
results do: [:element | return _ return, (duringBlock value: element)].
^return, (afterBlock value: results)].
^absentBlock value
このページを編集 (3200 bytes)
|
以下の 1 ページから参照されています。 |
This page has been visited 2411 times.