Re: [elinks-users] Piping the HTML source of a page open in ELinks to another application
* John Magolske b79...@gmail.com [120814 23:02]: I'm looking for a way to pipe the HTML of a page open in ELinks to another application without having to re-download the page. I have a ELinks mapping script that automates saving a web-page to text -- with two keypresses the HTML is converted to text and automatically opened in Vim for editing saving to an appropriate location. Very handy, but this approach uses URI passing and %c, which involves re-downloading the HTML source over the net. [...] What I'd like to be able to do is pipe the source of an open page through `elinks -dump` without an internet connection, and without having to manually save it somewhere first. After reading a few helpful threads [1] from the archives of this list and looking over the contrib/lua/hooks.lua file, I pieced together a solution which seems to work fairly well. Not having much experience with Lua, it's quite possible this can be more correct/clean. Any suggestions for improvement are welcome. Might be time to pick up the Programming in Lua book... The relevant bits from my ~/.elinks/hooks.lua file: -- Convert HTML to plaintext open file in Vim function save_to_text () -- See if we can obtain the local document. local doc = current_document() if doc then -- Create a temporary file local tmp = tmpname () -- Write document into the temporary file. writeto (tmp) write (doc) writeto() -- convert HTML to plaintext and open Vim in a new tmux window execute( elinks -dump -no-references -no-numbering ..tmp.. | ..tmp...txt ;\ echo \\n\n[saved on: `date +%Y\/%m\/%d\\ %a\\ %k:%M\\ %Z` ]\ ..tmp...txt ;\ echo ..current_url ().. ..tmp...txt;\ tmux new-window -n vim-elink \vim \..tmp...txt) -- Tell elinks to delete after this function. table.insert (tmp_files, tmp) end end -- Convert HTML to markdown open file in Vim function save_to_markd () -- See if we can obtain the local document. local doc = current_document() if doc then -- Create a temporary file local tmp = tmpname () -- Write document into the temporary file. writeto (tmp) write (doc) writeto() -- convert HTML to markdown and open Vim in a new tmux window execute( pandoc -r html -w markdown --no-wrap --reference-links ..tmp.. | ..tmp...txt ;\ echo \\n\n[saved on: `date +%Y\/%m\/%d\\ %a\\ %k:%M\\ %Z` ]\ ..tmp...txt ;\ echo ..current_url ().. ..tmp...txt ;\ tmux new-window -n vim-elink \vim \ ..tmp...txt) -- Tell elinks to delete after this function. table.insert (tmp_files, tmp) end end console_hook_functions = { txt = save_to_text, mkd = save_to_markd, } bind_key (main, Ctrl-H, save_to_text) bind_key (main, Ctrl-G, save_to_markd) [1] http://archives.linuxfromscratch.org/mail-archives/elinks-users/2006-March/001109.html http://archives.linuxfromscratch.org/mail-archives/elinks-users/2006-April/001120.html Regards, John -- John Magolske http://B79.net/contact ___ elinks-users mailing list elinks-users@linuxfromscratch.org http://linuxfromscratch.org/mailman/listinfo/elinks-users
Re: [elinks-users] Piping the HTML source of a page open in ELinks to another application
* John Magolske b79...@gmail.com [120814 23:02]: I'm looking for a way to pipe the HTML of a page open in ELinks to another application without having to re-download the page. I have a ELinks mapping script that automates saving a web-page to text -- with two keypresses the HTML is converted to text and automatically opened in Vim for editing saving to an appropriate location. Very handy, but this approach uses URI passing and %c, which involves re-downloading the HTML source over the net. [...] What I'd like to be able to do is pipe the source of an open page through `elinks -dump` without an internet connection, and without having to manually save it somewhere first. I'm guessing the only way to do this would be through something like a Lua scripting approach. If so, might anyone know of a script that could provide a good starting point to learn from? Thanks, John -- John Magolske http://B79.net/contact ___ elinks-users mailing list elinks-users@linuxfromscratch.org http://linuxfromscratch.org/mailman/listinfo/elinks-users
[elinks-users] PhantomJS, headless JavaScript tool ... use with ELinks?
I use ELinks for 90%+ of my web browsing, and would love to find a way of dealing with JavaScript. I just found out about PhantomJS [1], a minimalistic, headless, WebKit-based, JavaScript-driven tool. I'm wondering if this might be an option for dealing with JavaScript when browsing the net with ELinks, by passing the URI to an external script that returns some nice html back to ELinks. I haven't played around with it at all, but it seems promising. Maybe pipe the html through something like goose [2] or boilerpipe [3] for good measure. I found out about PhantomJS on this [4] thread. [1] http://code.google.com/p/phantomjs/ [2] https://github.com/jiminoc/goose [3] http://code.google.com/p/boilerpipe/ [4] http://news.ycombinator.com/item?id=2298237 Regards, John -- John Magolske http://B79.net/contact ___ elinks-users mailing list elinks-users@linuxfromscratch.org http://linuxfromscratch.org/mailman/listinfo/elinks-users
[elinks-users] PhantomJS, headless JavaScript tool ... use with ELinks?
I use ELinks for 90%+ of my web browsing, and would love to find a way of dealing with JavaScript. I just found out about PhantomJS [1], a minimalistic, headless, WebKit-based, JavaScript-driven tool. I'm wondering if this might be an option for dealing with JavaScript when browsing the net with ELinks -- pass the URI to an external script that returns some nice html back to ELinks. I haven't played around with it at all, but it seems promising. Maybe pipe the html through something like goose [2] or boilerpipe [3] for good measure. I read about PhantomJS on this [4] thread. [1] http://code.google.com/p/phantomjs/ [2] https://github.com/jiminoc/goose [3] http://code.google.com/p/boilerpipe/ [4] http://news.ycombinator.com/item?id=2298237 Regards, John -- John Magolske http://B79.net/contact ___ elinks-users mailing list elinks-users@linuxfromscratch.org http://linuxfromscratch.org/mailman/listinfo/elinks-users
[elinks-users] a url that locks up elinks
Hi, Navigating to the following url, I find Elinks hangs indefinitely displaying the message Request sent with the cpu maxed out at 100%: http://www.eweek.com/c/a/Application-Development/Google-Delivers-New-Javalike-Language-Noop-473613/ Ctrl-C won't quit, I have to manually Kill-9 Elinks to stop it. Does anyone else experience this behavior with this url? TIA, John -- John Magolske http://B79.net/contact ___ elinks-users mailing list elinks-users@linuxfromscratch.org http://linuxfromscratch.org/mailman/listinfo/elinks-users
[elinks-users] caching of pages, localhost
Hi, I wrote the following wrapper script to launch elinks after running the restview [1] command, for viewing reStructuredText documents: #!/bin/sh restview --listen=*:8080 $1 /dev/null STATUS_PID=$! elinks http://myhostname:8080/ kill $STATUS_PID Every time I have to hit the reload key to reload the browser, as it shows whatever previous page was viewed. Is there some way to prevent this? The only way I've found to avoid this in other cases is with elinks -no-connect 1 $1, but here that gets: Unable to retrieve http://myhostname:8080/: Connection refused I've tried elinks -eval 'set ... ' in the script with every combo of document.cache.* document.browse.* I could think of, but nothing seems to work. TIA for any suggestions, John [1] http://mg.pov.lt/restview/ -- John Magolske http://B79.net/contact ___ elinks-users mailing list elinks-users@linuxfromscratch.org http://linuxfromscratch.org/mailman/listinfo/elinks-users
Re: [elinks-users] Shift-Tab, move-link-prev redux
* Kalle Olavi Niemitalo k...@iki.fi [090625 16:21]: Thanos Papaïoannou t...@math.uchicago.edu writes: 2. When not on a link, Tab moves the cursor to the link closest to the top of the page; is there a way to force the link to jump to the nearest link instead? In ELinks 0.12pre1, there is a new action move-link-right-line that may do what you want. Thank you! This is something I've been wanting in ELinks for a while, IMHO, a major usability boost. There's also move-link-left-line for jumping to the nearest previous link. John -- John Magolske http://B79.net/contact ___ elinks-users mailing list elinks-users@linuxfromscratch.org http://linuxfromscratch.org/mailman/listinfo/elinks-users
Re: [elinks-users] adjusting the page width
* Y. Hida eigensol...@gmail.com [090508 17:20]: On 2009-05-08, John Magolske b79...@gmail.com wrote: document.browse.margin_width = 9 will reduce the page width to 110 columns, but 9 is the maximum value that can be set. Is there some way to achieve a narrower page width? It would also be nice to somehow toggle between full-width and reduced-width with a key binding. If you can compile elinks from source, the following patch (against current git master) would do it. This adds toggle-margin action (default keybind M) to toggle the margin between 0 and the specified margin_width (which can be up to 100 now). Thanks! This patch does exactly what I was looking for. One question -- is there a way to have it toggle the margin between say, 2 or 3 (rather than 0) and the specified margin_width? Maybe by changing something in this line: + margin_width, 0, 0, 100, 3, Regards, John -- John Magolske http://B79.net/contact ___ elinks-users mailing list elinks-users@linuxfromscratch.org http://linuxfromscratch.org/mailman/listinfo/elinks-users
[elinks-users] Ctrl-C -- possible to make it not quit ELinks?
I picked up the habit of using Ctrl-C to close unresponsive connections while using w3m. Now that I'm using ELinks more more, occasionally I make the mistake of hitting Ctrl-C, which will close an ELinks session along with all open tabs without warning. I'm re-training myself to use z, which is currently mapped to Abort connection. But would like to find a way to prevent accidentally closing ELinks in this way. Adding the Ctrl-C binding to Abort connection made no difference. In the list archives I found: If you do e.g. stty intr undef so that Ctrl-C does not give ELinks a signal, then ELinks will handle it as a bindable key. http://linuxfromscratch.org/pipermail/elinks-users/2006-December/001384.html But this disables the functionality of Ctrl-C altogether within the terminal. Are there any other options? Regards, John -- John Magolske http://B79.net/contact ___ elinks-users mailing list elinks-users@linuxfromscratch.org http://linuxfromscratch.org/mailman/listinfo/elinks-users