wiki:LogTask

Add this to your global scripts page and add an import statement to the pages you want to use this on.

Output

+++ Log
track.log.2007.May.03.MyCurrentProject: () 

Code

<%
1:
###############################
#  Add the track.log.YEAR.MONTH.DAY.WIKIPAGE: () time stamp under the +++ Log heading.
#  If there is no heading, it will be created at the end of the document and the 
#  timestamp appended on the next line.
###############################
editor.SetTargetStart(1)
editor.SetTargetEnd(editor.GetLength())

logPos = int(editor.SearchInTarget("+++ Log"))


def AddLogStamp():
    editor.AddText("track.log.")
    editor.AddText(lib.strftime("%Y"))
    editor.AddText(".")
    editor.AddText(lib.strftime("%b"))
    editor.AddText(".")
    editor.AddText(lib.strftime("%d"))
    editor.AddText(".")
    editor.AddText(pwiki.getCurrentWikiWord().replace(" ","_"))
    editor.AddText(": () ")

if logPos == -1:
    editor.GotoPos(editor.GetLength())
    editor.AddText("\n\n+++ Log\n")
    AddLogStamp()  
else:
    editor.GotoLine(editor.LineFromPosition(editor.SearchInTarget("+++ Log")+1))
    editor.SetCurrentPos(editor.GetLineEndPosition(editor.GetCurrentLine()))
    editor.AddText("\n")
    AddLogStamp()
    curPos = editor.GetLineEndPosition(editor.GetCurrentLine())
    editor.AddText("\n")
    editor.GotoPos(curPos)
%>
Last modified 8 years ago Last modified on May 9, 2009 10:35:44 AM