Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
-- blogme3.lua - load libraries, process command-line options. -- This is part of blogme3. -- -- Author: Eduardo Ochs <[email protected]> -- Version: 2019feb15 -- <http://anggtwu.net/blogme3/blogme3.lua> -- <http://anggtwu.net/blogme3/blogme3.lua.html> -- License: GPL. -- -- See: (find-angg "LUA/BlogMe3.lua") -- «.blogmedir» (to "blogmedir") -- «.edrxlib» (to "edrxlib") -- «.pathto» (to "pathto") -- «.dooptions» (to "dooptions") -- «blogmedir» (to ".blogmedir") -- Similar to: (find-dn6 "dednat6.lua" "package.path") -- Put the directory where this script is at the -- front of the list of paths used by "require". -- (find-lua51manual "#pdf-package.path") -- (find-lua51manual "#pdf-package.cpath") -- Names: (find-elnode "File Name Components" "file-name-directory") fnamedirectory = function (fname) return fname:match"^(.*/)[^/]*$" end fnamenondirectory = function (fname) return fname:match "([^/]*)$" end blogmedir = blogmedir or (arg and fnamedirectory(arg[0])) or "./" package.path = blogmedir .. "?.lua;" .. package.path package.cpath = blogmedir .. "?.so;" .. package.cpath -- for lpeg -- «edrxlib» (to ".edrxlib") require "edrxlib" -- (find-angg "LUA/lua50init.lua") -- Experimental, 2007jun26 -- autoload("fwnn", function () require "foo" end) autoload = function (funname, codethatloadsthefunction, soft) if soft and _G[funname] then return end -- don't override _G[funname] = function (...) _G[funname] = function () error("Autoload failed: "..funname, 2) end codethatloadsthefunction() -- this should override _G[funname] return _G[funname](...) end end -- Commented out the autoloads: I'm loading "elisp.lua" always -- autoload("makesexphtml", function () require "elisp" end) -- autoload("maketarget", function () require "elisp" end) -- autoload("makelocaltarget", function () require "elisp" end) -- «pathto» (to ".pathto") pathtoroot = "" pathto = function (path) return pathtoroot .. path end getpathtoroot = function (path) local _, nslashes = string.gsub(path, "/", "/") return string.rep("../", nslashes) end require "brackets" -- (find-blogme3 "brackets.lua") require "definers" -- (find-blogme3 "definers.lua") require "charset" -- (find-blogme3 "charset.lua") require "anggdefs" -- (find-blogme3 "anggdefs.lua") require "youtube" -- (find-blogme3 "youtube.lua") require "elisp" -- (find-blogme3 "elisp.lua") require "options" -- (find-blogme3 "options.lua") -- require "angglisp" -- (find-blogme3 "angglisp.lua") loada2html = function () require "escripts" -- (find-blogme3 "escripts.lua") end -- Should I factor the block above? "escripts.lua" is optional... -- doblogmefile = function (fname) dofile(blogmedir .. fname) end -- (find-blogme3 "notes.e.lua" "defs-tests") -- (find-luamanualw3m "#pdf-select") -- (find-angg "TH/Files.tcl" "blogme") --------[ Compatibility hacks ]-------- -- myinclude = function (fname, verbose) -- if verbose then print(" Including: "..fname) end -- doblogme(readfile(ee_expand(fname))) -- end -- def_ [[ INCLUDE 1 fname myinclude(fname, nil) ]] smash = nilify def [[ EXPNODE 2 nodename,text HREF("info:expect:"..nodename, nilify(text) or nodename) ]] def [[ LUANODE 2 nodename,text HREF("info:lua:"..nodename, nilify(text) or nodename) ]] def [[ LIBCNODE 2 nodename,text HREF("info:libc:"..nodename, nilify(text) or nodename) ]] nonvoids = filter def [[ IFL 0 _ "" ]] -- «dooptions» (to ".dooptions") -- PP(arg) dooptions(unpack(arg or {})) --[===[ # (find-orgfile "index.org" "convert-to-blogme3") # (find-blogme3file "notes.e.lua") * (eepitch-lua51) * (eepitch-kill) * (eepitch-lua51) arg={ [0] = ee_expand "~/blogme3/blogme3.lua" } dofile(arg[0]) --]===] -- Local Variables: -- coding: raw-text-unix -- End: