Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
-- build.lua: generate a single blogme4.lua from separate files. -- This file: -- http://angg.twu.net/blogme4/build.lua.html -- http://angg.twu.net/blogme4/build.lua -- (find-blogme4 "build.lua") -- Author: Eduardo Ochs <[email protected]> -- Version: 2011aug04 -- License: GPL3 -- -- Related to: (find-dn5 "build.lua") -- -- This script generates "blogme4.lua". -- It needs to be run from the blogme4 directory, -- Run with: (find-sh0 "cd ~/blogme4/ && lua51 build.lua") -- (defun c () (interactive) (find-sh0 "cd ~/blogme4/&&lua51 build.lua")) -- (defun c () (interactive) (find-sh "cd ~/blogme4/ && lua51 build.lua && cat blogme4.lua")) -- -- (find-blogme4 "Makefile") -- (defun m () (interactive) (find-blogme4sh "make clean; make blogme4.lua")) -- (find-blogme4 "blogme4.lua") -- dofile "common.lua" -- (find-blogme4 "common.lua") target = "blogme4.lua" A = { -- Core modules: "common", -- (find-blogme4 "common.lua") -- (find-blogme4 "blogme4.lua" "common.lua") "eoo", -- (find-blogme4 "eoo.lua") -- (find-blogme4 "blogme4.lua" "eoo.lua") "def", -- (find-blogme4 "def.lua") -- (find-blogme4 "blogme4.lua" "def.lua") "eval", -- (find-blogme4 "eval.lua") -- (find-blogme4 "blogme4.lua" "eval.lua") "brackets", -- (find-blogme4 "brackets.lua") -- (find-blogme4 "blogme4.lua" "brackets.lua") -- -- Non-core modules: "elisp", -- (find-blogme4 "elisp.lua") -- (find-blogme4 "blogme4.lua" "elisp.lua") "angglisp", -- (find-blogme4 "angglisp.lua") -- (find-blogme4 "blogme4.lua" "angglisp.lua") "anggdefs", -- (find-blogme4 "anggdefs.lua") -- (find-blogme4 "blogme4.lua" "anggdefs.lua") "anggdefs", -- (find-blogme4 "anggdefs.lua") -- (find-blogme4 "blogme4.lua" "anggdefs.lua") "texinfo", -- (find-blogme4 "texinfo.lua") -- (find-blogme4 "blogme4.lua" "texinfo.lua") -- -- Main: "options", -- (find-blogme4 "options.lua") -- (find-blogme4 "blogme4.lua" "options.lua") } guill = function (str) return (str:gsub("<<", "\171"):gsub(">>", "\187")) end findblogme4 = function (fname) return '(find-blogme4 "'..fname..'")' end prepfile = function (stem) local name = stem..".lua" local contents = readfile(name) local contents2 = contents:gsub("\nrequire", "\n-- require") local contents3 = contents2:gsub("\n%-%- dump%-to: tests.*", "") local head = gformat(guill [[ ---- <<%0.lua>> (to ".%0.lua") ---- This block is from: (find-blogme4 "%0.lua") ]])(stem) return head..contents3 end quick_index = "---- Index to the modules:\n" .. mapconcat(gformat(guill '-- <<.%0.lua>> \t(to "%0.lua")'), A, "\n").. "\n\n\n\n\n" date = os.date("%Y%b%d %k:%M"):lower() date = os.date("%Y%b%d %k:%M %Z") head_all = "#!/usr/bin/env lua5.1".."\n".. mapconcat(gformat "---- %1\n", { "This is a one-file version of blogme4, generated", "automatically by build.lua on "..date..". See:", " http://angg.twu.net/blogme4/build.lua.html", " (find-blogme4 \"build.lua\")", "This file:", " http://angg.twu.net/blogme4/blogme4.lua.html", " (find-blogme4 \"blogme4.lua\")", }).."\n" -- head_all = "------ Generated by: "..findblogme4("blogme4-gen.lua").."\n" body_all = mapconcat(prepfile, A, "\n\n\n") footer_all = guill [[ -- Local Variables: -- coding: raw-text-unix -- ee-anchor-format: "<<%s>>" -- End: ]] writefile(target, head_all.. quick_index.. body_all.. footer_all) print(" Created: "..target) print(" From: "..mapconcat(gformat "%1.lua", A, " "))