[# -*- coding: raw-text-unix -*- This is not a standalone blogme file. Huh, it pretends to be one, but that's for tests only. Load this with [INCLUDE dba.blogme] for the DBA pages... (find-anggfile "TH/speedbar.blogme") Cheers. Edrx 2006jan09 #] [lua: def [[ yellow 1 _ "#ffda99" ]] def [[ blue 1 _ "#4169e1" ]] def [[ blue 1 _ "#1e90ff" ]] def [[ blue 1 _ "#4876ff" ]] def [[ BORDERLESSBOXBG 2 bg,body _G["BORDERLESSBOX+"](STYLE("background: $bg;"), body) ]] def [[ FOO 1 body BORDERLESSBOXBG(yellow(), PRE(two_d_trim(body))) ]] def [[ SPANSTYLE 2 style,body "$body" ]] def [[ BG 2 bg,body SPANSTYLE("background-color: $bg;", body) ]] def [[ BGFG 3 bg,fg,body SPANSTYLE("background-color: $bg; color: $fg;", body) ]] def [[ STANDOUT 1 body BGFG("blue", "white", body) ]] def [[ STANDOUT 1 body BG(blue(), body) ]] def [[ STANDOUTMAYBE 1 body strfind(body, "^= ") and STANDOUT(body) or body ]] -- entities[""] = "*" -- entities[""] = COLOR("red", BF("*")) -- entities_chars = entities_chars.."" -- entities_re = "(["..entities_chars.."])" tounix = function (str) return (string.gsub(str, "\r", "")) end -- faltava um () map = function (f, arr) local brr = {} for i=1,getn(arr) do tinsert(brr, (f(arr[i]))) end return brr end splitlines = function (bigstr) local L = {} local rest = string.gsub(bigstr, "(([^\n]*)\n)", function (all, li) tinsert(L, li); return "" end) if rest ~= "" then tinsert(L, rest) end return L end standouthowm1 = function (li) if strfind(li, "^= ") then return STANDOUT(Q(li)) else return Q(li) end end standouthowm = function (bigstr) return join(map(standouthowm1, splitlines(tounix(bigstr))), "\n") end -- (find-blogmefile "blogme2.lua" "\"-o\"") -- (find-blogmefile "blogme2.lua" "blogme_test =") -- (find-blogmefile "blogme2-outer.lua" "html_all(title, body)") -- htmlize_howm_file = function (title, infname, outfname) local body = PRE(standouthowm(readfile(infname))) writefile(outfname, html_all(title, body)) end htmlize_howm_file1 = function (stem) htmlize_howm_file(stem, "c:/edrx/edrx/HOWM4/"..stem, "c:/tmp/"..stem..".html") end -- htmlize_howm_file1("2006-01-04") dias_mes_table = {} _A["set_dias_mes"] = _AA["1L"] _G["set_dias_mes"] = function (dias_mes) dias_mes_table = {} for i=1,getn(dias_mes) do dias_mes_table[dias_mes[i]] = true end return "" end _A["mes_dias"] = _AA["2L"] _G["mes_dias"] = function (prefixo, dias) prefixo_mes = prefixo dias_mes_table = {} for i=1,getn(dias) do dias_mes_table[dias[i]] = true end return "" end def [[ TDCENTER 1 body _G["TD+"]("align=center", body) ]] _A["TD_DIA"] = vargs1 _G["TD_DIA"] = function (str) if str == "" or str == nil then return TD("") end if strfind(str, "^[0-9][0-9]?$") and dias_mes_table[str] then return TDCENTER(HREF(format("%s%02d.html", prefixo_mes, str), str)) end return TDCENTER(str) end def [[ SEMANA 1L dias TR(join(map(TD_DIA, dias), "")) ]] _A["MES"] = vargs2_a _G["MES"] = function (titulo, semanas) return TABLE(TR(_G["TD+"]("colspan=5 align=center", titulo)) .. join(map(TR, semanas), "")) end -- lis = splitlines(tounix(readfile "c:/edrx/edrx/HOWM4/2006-01-04")) -- PP(map(standouthowm1, lis)) -- print(ee_expand("~/HOWM4/")) -- (find-fline "c:/tmp/") ] [htmlize DBA (This is just an INCLUDEd file...) ]