[colug-432] lynx -dump (was Meeting Reminder)

Matt Meinwald meinwald.1 at osu.edu
Wed Jul 30 14:07:46 EDT 2014


On 07/30/2014 09:18 AM, Richard Holbert wrote:
> 
> On 07/30/2014 09:11 AM, Rob Funk wrote:
>> jep200404 at columbus.rr.com wrote:
>>> There's a meeting tonight. See colug.net.
>> There's a certain charm to being able to do "curl -s http://colug.net"
>> and get readable information. Who needs a browser?
>>
>> But now I'm wondering if there's a way to accomplish that while still
>> making things pretty in the browser. Probably involving Markdown and
>> on-the-fly conversion to HTML.
>>
>> I may have a new project....
> Rob,
> 
> I know it's not exactly what you had in mind, but the following works 
> from the command prompt:
> 
> curl -s http://colug.net | lynx -stdin -dump
> _______________________________________________
> colug-432 mailing list
> colug-432 at colug.net
> http://lists.colug.net/mailman/listinfo/colug-432
> 

Lynx can also download the page itself, as it is a web browser:

$ lynx -dump http://colug.net

In addition, many other text browsers support -dump. I
tested elinks, links2, and w3m.

$ elinks -dump http://colug.net
$ links -dump http://colug.net
$ w3m -dump http://colug.net

There are subtle differences in the rendering, such as using
different characters ("-", "_", or "━━") for horizontal rules.

As far as the question about making a document look nice as
text and in the browser, the "right way" to do that would
probably be to have two files hosted, markdown and the
resulting html. When the accept header specifies html at
higher priority, you serve the html, and when it specifies
text, you serve the markdown.

However, with the state of accept headers in browsers, and
the fact that curl doesn't even send the accept header at
all by default (how would it know what kind of resource you
want?), this might not work reliably, plus there's no good
way to advertise what content types are supported before the
resource is requested. So maybe having the markdown wrapped
in minimal html that loads a script to turn it into full
html may actually be the way to go. Just don't use user-agents.



More information about the colug-432 mailing list