Changeset 200

Show
Ignore:
Timestamp:
05/23/05 06:57:44 (4 years ago)
Author:
ged
Message:

- Added comment footer transform

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/simplest-thing/tools/convertWikiPage.rb

    r199 r200  
    102102    newContent = transformHrules( newContent ) 
    103103    newContent = transformAnchors( newContent ) 
     104    newContent = transformCommentFooters( newContent ) 
    104105 
    105106    newContent = transformOtherIdiosyncrasies( newContent ) 
     
    235236end 
    236237 
     238 
     239CommentFooter = %r{^--\s*(.*?)(?:<br\s*/?>)?$}i 
     240 
     241### Transform the version change comments at the bottom of the page, e.g.,  
     242###   '-- Ged The Greys Hain - 16 May 2000 <br>' 
     243def transformCommentFooters( content ) 
     244    content.gsub( CommentFooter ) {|match| 
     245        comment = $1.strip 
     246        newComment = "— %s[[br]]" % [comment.gsub(%r{</?\w+>}, '')] 
     247        debugMsg "Transforming comment footer %p -> %p" % [match, newComment] 
     248        newComment 
     249    } 
     250end 
     251 
     252 
    237253Anchor = %r{<a href="(.*?)">(.*?)</a>}i 
    238254