On Fri, 8 Mar 2002, Jochen F. Rick wrote:

> ^ append area stays at top and appends go down
> _ appends are separated by lines
> + replicating appends
> @ timestamps for appends
> - appends without areas
> 
> What do people think? Any other necessary features?

I think append templates are more general. You can specify what should be 
inserted before and after a new submission.  This allows rather easy 
customization - See http://swiki.gsug.org:8888/bert/4

My syntax is either
        +stuff to be appended
or
        +stuff to be prepended+stuff to be appended

The syntax could be extended so the position of the new append area is 
specified: This would allow reverse listings and replicating appends, too.

Regarding timestamps: If you add this as general feature, it would work 
with my template approach just fine. For example, <TIME> could be 
replaced by the current time when the page is saved.

I'll attach my (oldish) code; it's not for the current Swiki release.

-- Bert
'From Squeak2.7 of 5 January 2000 [latest update: #1770] on 11 March 2002 at 11:40:43 
am'!
"Change Set:         append-bf
Date:                 12 October 2000
Author:      
           Bert Freudenberg

A little enhancement for append areas: Now the text after 
the leading '+' is preserved and will be inserted after each append operation. For 
example, '+_' will insert a horizontal rule after each entry."!


!IdFormatter class 
methodsFor: 'instance creation' stamp: 'bf 6/6/2001 19:55'!
saveAppend
     | instance 
|

  instance _ self new.
   instance idBlock: [:text | '+'].
       instance 
startBlock: [:id | ''].
       instance endBlock: [:id | ''].
 instance 
transitionBlock: [:idOld :idNew | ''].
        instance formatter: [:text :request 
:page :book |
              request temp ifNil: [request temp: Dictionary new].
       
     (request temp includesKey: 'appendId') ifFalse: [request temp at: 'appendId' put: 
0].
          request temp at: 'appendId' put: ((request temp at: 'appendId') + 1).
   
       ((request temp at: 'appendId') asString = (request appendId))
                  
ifTrue: [
                      ((text includes: $+)
                           
ifTrue: [(text copyUpTo: $+) replaceHtmlCharRefs, String cr]
                          
 ifFalse: ['']),
                        ((page settings at: 'saveFormatter' ifAbsent: 
[book settings at: 'saveFormatter']) format: (request append) request: request page: 
page book: book) withBlanksTrimmed, String cr,
                      ((text includes: 
$+)
                           ifTrue: [(text copyAfterLast: $+) replaceHtmlCharRefs, 
String cr]
                              ifFalse: [text replaceHtmlCharRefs, String 
cr]),
                       '+', text, String cr]
                  ifFalse: ['+', 
text, String cr]].
      ^instance! !


Reply via email to