New web newsreader - requesting participation

Adam Ruppe destructionator at gmail.com
Sun Jan 30 19:08:02 PST 2011


In the other newsgroup, I've been talking about a little
web news program I've been writing as a spinoff of the
potential new homepage idea.

It's to the point where it is usuable, but still kinda buggy:

http://arsdnet.net/d-web-site/nntp/thread-index?
newsgroup=digitalmars.D

Source code: http://arsdnet.net/d-web-site/nntp.d

NOTE: it does /not/ automatically check for new posts. I have
to manually trigger that right now (I don't want it annoying
the news server automatically while still in the testing phase.)

It will lazily load a message on demand though if you know
it's message ID:
http://arsdnet.net/d-web-site/nntp/get-message

Get it from the Message-ID header in the post.



Anyway, here's the features:

a) It isn't god awful slow. The PHP web news currently on digital
mars, as best as I can tell, actually polls the news server every
time you go to it's index! This does aggressive local caching.

b) It actually lets you select text...

OK, if I list every annoyance with the current web news, I'll
never stop. Moving on to new things:

c) It tries to convert news posts to HTML, so the paragraphs
wrap to the browser, links work, quotes are put into the proper
tags for indentation, and it tries to auto-detect D code and
put it in a <pre> block - which my javascript can make inline
editable and runnable. Example:

http://arsdnet.net/d-web-site/nntp/get-message?
newsgroup=digitalmars.D&messageId=%
3Cmailman.1085.1296409409.4748.digitalmars-d%40puremagic.com%3E

With script disabled, you'll see the code in a different colored
block. With script enabled, you'll see an Edit button there
too.

d) It tries to convert HTML emails back to plain text. (Ironically,
so it can turn it back to html...) This gives uniformity across
the various mime types. Similarly, if the type is
multipart/alternative, it will only show the text version.

e) It also makes an attempt to preserve deliberate whitespace,
for things like ASCII art or purposefully short lines. If it
can't make heads or tails of it, it bails out and shows the
original message in a <pre> block for human consumption.

f) Tries to be fast and lean.

g) Written in D!

h) Already read messages is tracked by your browser - if the link
is visited, it puts up a different color url.

Coming as I find time:

a) References to bugzilla entries should be automatically
converted to links.

b) Viewing threads by date or by threaded view.

c) Posting with the option of automatic quoting.

d) Syntax highlighting of D code in posts.

e) Maybe, maybe links to documentation of functions referenced,
   if I can find a good way to get them automatically. Integration
   with my dpldocs.info site is the way I'd do it.

e) Any more ideas? I'm reluctant to add too much, but if I like
   an idea - or if you want to write the code :) - I'll be open'
   to adding it.


Known bugs:

Lots of content types aren't handled right and it ignores
character encoding.

It doesn't always recognize code. This would be ok, but if it
sees one line as code but doesn't include one of them, it would
confuse the reader. Example:

http://arsdnet.net/d-web-site/nntp/get-message?
newsgroup=digitalmars.D&messageId=%3Cii4lbj%242bes%241%
40digitalmars.com%3E

(Look for "auto str =")

The reason for this is it detects code lines by looking for
semicolons and open braces. It will call something a generic
<pre> if there's a lot of whitespace in it - figuring it is
probaby ascii art (if it thinks the whitespace has human
significance, it tries to preserve it), but it still isn't
a perfect detection function.

I'm open to ideas. We want to detect code, but not flag
regular English text.



I'm also open to graphical styling ideas. I put up a dark
theme here because the white was hurting my eyes, but I change
on if I like light or dark almost at random. (Depends on the room's
lighting conditions I think). But I didn't do any more graphic
setup other than the max-width.

Multiple color schemes is an idea I like.



BTW, as a fun fact, this post is about 1/4th the size of the
entire nntp.d code file!


More information about the Digitalmars-d-announce mailing list