Hallo!
First of all I want to thank the developers for the absolutly great browser!
Well done!
I just noticed that the instructions for printing with elinks are no longer
working. For piping one has to use io.popen and no "|"-syntax. For me the
attached hooks.lua works well with cups lp.
I now got stuck on trying to print in colour. Is there a way to get a somehow
formatted coloured dump? (html, esc-sequenced, ...) I might be nice to have
the option "Save formatted and coloured document" With colour I mean the
colours elinks uses for displaying depending on one of the three modes. I
tried to use /dev/vcs3 but the escape-sequences are not in there. Using elinks
http://www.czech-language.cz/alphabet/kodovani.html > cz.txt is behaving as if
-dump 1 had been specified.
Thanks
Lynx
_INPUT = io.stdin
_OUTPUT = io.stdout
function writeto (name)
if name == nil then
local f, err, cod = io.close(_OUTPUT)
_OUTPUT = io.stdout
return f, err, cod
else
local f, err, cod = io.open(name, "w")
_OUTPUT = f or _OUTPUT
return f, err, cod
end
end
function writetop (name)
if name == nil then
local f, err, cod = io.close(_OUTPUT)
_OUTPUT = io.stdout
return f, err, cod
else
local f, err, cod = io.popen(name, "w")
_OUTPUT = f or _OUTPUT
return f, err, cod
end
end
function write (...)
local f = _OUTPUT
if type(arg[1]) == 'userdata' then
f = table.remove(arg, 1)
end
return f:write(unpack(arg))
end
function cattop (output)
local doc = current_document_formatted (79)
if doc then writetop (output) write (doc) writeto () end
end
-- Email the current document, using Mutt (http://www.mutt.org).
-- This only works when called from lua_console_hook, below.
function mutt ()
local tmp = tmpname ()
writeto (tmp) write (current_document ()) writeto ()
table.insert (tmp_files, tmp)
return "run", "mutt -a "..tmp
end
-- Table of expressions which are recognised by our lua_console_hook.
console_hook_functions = {
reload = "reload ()",
mutt = mutt,
}
function lua_console_hook (expr)
local x = console_hook_functions[expr]
if type (x) == "function" then
return x ()
else
return "eval", x or expr
end
end
-- Send the current document to `lpr'.
-- lp has 79 rows so elinks dumps 79 if possible!
function lp ()
local doc = current_document_formatted (160)
if doc then writetop ("lp -s -o cpi=20 -o lpi=10 -o page-left=9") write
(doc) writeto () end
-- cattop ("lp -o cpi=20 -o lpi=10 -o page-left=9")
end
-- Send the current document to `enscript'.
function enscript ()
cattop ("enscript -q -fCourier8")
end
-- Bind Alt-p to print.
bind_key ("main", "p", lp)
bind_key ("main", "Alt-p", enscript)
_______________________________________________
elinks-users mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-users