*! log2html 1.2.9 cfb/njc/br 08jun2006 *! log2html 1.2.8 cfb/njc/br 09feb2005 *! log2html 1.2.7 cfb/njc/br 12oct2004 *! log2html 1.2.6 cfb/njc/br 2oct2003 *! log2html 1.2.5 cfb/njc/br 17Jun2003 *! log2html 1.2.0 cfb/njc 3Mar2003 *! log2html 1.1.1 cfb/njc 17Dec2001 program log2html version 8.0 syntax anything(name=smclfile id="The name of a .smcl logfile is") /// [, ERASE replace TItle(str) INput(str) Result(str) BG(str) LINEsize(integer `c(linesize)') /// TExt(str) ERRor(str) PERcentsize(integer 100) BOLD CSS(str) SCHeme(str)] // syntax processing if "`css'" != "" & `"`input'`result'`text'`error'`bg'`scheme'"' != "" { di as err "if CSS is specified, you may not specify any colors" exit 198 } if "`scheme'" != "" { if `"`input'`result'`text'`error'`bg'"' != "" { di as err /// "if a scheme is specified, you may not specify any colors" exit 198 } local names "bg input result text error" local cblack "000000 ffffff ffff00 00ff00 ff0000" local cwhite "ffffff 000000 000000 000000 ff0000" local cblue "000090 ffffff ffff00 00ff00 ff0000" local cugly "ff00ff 9999ff ff99ff 00ff00 cccc00" local cyellow "ffffcc cc00cc 0000cc 000000 ff0000" local cnt 1 foreach name of local names { local `name' : word `cnt++' of `c`scheme'' } if "`bg'"=="" { display as error "scheme `scheme' does not exist! Available schemes are " display as error " black, white, blue, and yellow." exit 198 } } else { if "`input'" == "" local input "CC6600" if "`result'" == "" local result "000099" if "`text'" == "" local text "000000" if "`error'" == "" local error "dd0000" if "`bg'" == "" local bg "ffffff" else { if "`bg'" == "gray" | "`bg'" == "grey" { local bg "cccccc" } } } if !inrange(`linesize', 40, 255) { display as err "linesize must be between 40 and 255" exit 125 } if `percentsize' <= 0 { display as err "percentsize() must be a positive integer" exit 198 } // filenames and handles tempname hi ho tempfile htmlfile local origfile `smclfile' if (!index(lower("`origfile'"),".smcl")) { local origfile "`origfile'.smcl" } local smclfile : subinstr local smclfile ".smcl" "" local smclfile : subinstr local smclfile ".SMCL" "" local smclfile : subinstr local smclfile `"""' "", all /* '"' (for fooling emacs) */ local smclfile : subinstr local smclfile "`" "", all local smclfile : subinstr local smclfile "'" "", all local outfile `"`smclfile'.html"' local ll "ll(`linesize')" qui log html `"`origfile'"' `"`htmlfile'"', `replace' yebf whbf `ll' // line-by-line processing file open `hi' using `"`htmlfile'"', r file open `ho' using `"`outfile'"', w `replace' file write `ho' _n file write `ho' "" _n "
" _n if `"`title'"' ~= "" { file write `ho' `" (which should be a div) to a
local line : ///
subinstr local line "
" "
", all
local line: ///
subinstr local line ". " ". ", count(local c)
// catch continuation lines
local word1 : word 1 of `"`line'"'
if substr(`"`word1'"',1,7) == ">" & `cprev' {
local line : ///
subinstr local line "" "", count(local c)
}
else {
local line: ///
subinstr local line "" "", all
}
*local line : subinstr local line "---" "___", all
local line: subinstr local line "" "", all
// check for error number
if substr(`"`word1'"',1,2) == "r(" {
if real(substr(`"`word1'"',3,index(`"`word1'"',")")-3)) < . {
local line `"