// MOD_DATE.VDM - Search for date tag in HTML files and place current date // // Date: 04/27/2004 Initial macro written // Date: 05/21/2004 Refinements by Christian Z // // The Starving Hedonist - http://cu2.home.comcast.net // // This macro will behave as follows: // // Looks for "" TAG // // if a formatted date YYYY-MM-DD is present after the tag it will overwrite it with // the present date otherwise insert the date. If insertion is at EOF adds a new line // // How to use: // // I use file open configuration. There really isn't any use for this macro without it // and event macros enabled. // // Add the line Reg_Load(111,"MOD_DATE.VDM",USERMACRODIR) to the end of the HTM.CFT and // HTML.CFT files. Also, if event macros are not enabled elsewhere add // Config(F_E_F_Macro,1,LOCAL) to the CTF file. // // I use this in my web pages here, so if you want to view the source you will see the // tags and how I use them to date my page modifications. // If (Version_Num < 612) { Buf_Switch(Buf_Free(EXTRA)) // select a free buffer Out_Ins() // route output to edit buffer Date(NOMSG|NOCR) // get date in mm-dd-yyyy format - v6.11 Out_Ins(CLEAR) // resume console output Reg_Copy_Block(103, 6, 10) // copy yyyy portion into text register 103 Reg_Set(103, "-", APPEND) Reg_Copy_Block(103, 0, 5, APPEND) // append the mm-dd portion Buf_Quit(OK) } else { Out_Reg(103) // route output to register 103 Date(REVERSE|NOMSG|NOCR) // get date in yyyy-mm-dd format - v6.12 Out_Reg(CLEAR) // resume console output } BOF repeat(ALL) { Search("",ADVANCE|ERRBREAK) if (Match("|D|D|D|D-|D|D-|D|D")==0) { Ins_Text(@103,OVERWRITE) // if existing date, overwrite it } else { Ins_Text(@103) // otherwise insert date if (At_EOF) { // if inserted at end of file add a new line Ins_Newline(1) } } }