【Kareha】 Comma Thread Syntax? (26)

1 Name: Anonymous 2005-01-03 11:52 ID:Heaven [Del]

Requesting implementation of Shiichan's comma syntax to refer to well-defined sets of certain posts.

Like this: http://www.world4ch.org/read.php/vip/1103880078/47,5,15-10,8-

2 Name: !WAHa.06x36 2005-01-03 16:08 ID:r73OcP/v [Del]

I was nagging MrVacBob into implementing that. Needless to say, it will be in the next Kareha version too.

3 Name: Anonymous 2005-01-04 21:24 ID:Heaven [Del]

I was surprised by the backwards ranges (ie. 15-10 in the link above) being valid and listing the posts in reverse order. Not really a bad thing, just unexpected.

4 Name: Mr VacBob!JqK7T7zan.!!47oS1MzU 2005-01-12 13:07 ID:rGCo5B4Y [Del]

I've been thinking of more extensions to that. The only useful one that I can think of is 'qX', which would display every post with an anchor to X. That would be kind of slow, though.

5 Name: !WAHa.06x36 2005-01-12 13:45 ID:dSNfvVxs [Del]

>>3

Call it a joke. That one's MrVacBob's. I've put some of my own in Kareha, but it up to you to figure them out.

>>4

That's a pretty good idea, I think. Would be easier if one saved some metadata, but quite possible to do anyway. Hard to correctly parse references to range and such, though. One could maybe even add a link somewhere in each post to that.

6 Name: !WAHa.06x36 2005-01-12 15:00 ID:Heaven (Replies) [Del]

Well, as an experiment, I've implemented both the q syntax, and http://wakaba.c3.cx/sup/kareha.pl/1102984488/1 on these two boards. Try it out, and give suggestions for improvement or changes.

7 Name: !WAHa.06x36 2005-01-12 15:01 ID:dSNfvVxs (Replies) [Del]

Oops bug. Fixed.

8 Name: Anonymous 2005-01-12 16:37 ID:Heaven (Replies) [Del]

>>6
test

9 Name: !WAHa.06x36 2005-01-12 17:21 ID:dSNfvVxs (Replies) [Del]

>>5-7 should work too.

10 Name: Anonymous 2005-01-13 04:30 ID:BlJDif0u (Replies) [Del]

It's kinda annoying on the eyes to have that link there for every post, though. Maybe this "Replies" feature would better be fit in some external browser thing like http://wakaba.c3.cx/sup/kareha.pl/1104757670 ?

11 Name: !WAHa.06x36 2005-01-13 08:07 ID:Nzgs9ur2 (Replies) [Del]

Yeah, I'm not too fond of the replies link either, but it does make the feature much more accessible. If the reply number wasn't already used for the quoting, I'd use that. Can anyone think up any other more elegant way to do this?

12 Name: Anonymous 2005-01-13 11:51 ID:/aBbmgBH (Replies) [Del]

Is the feature even that important? The only thing it adds to something a user could do with CTRL+F is the syntax >>9 shows.

13 Name: Mr VacBob!JqK7T7zan. 2005-01-13 12:28 ID:LDDx8kYI (Replies) [Del]

>>12
I was thinking of 2ch browser-like programs. Being able to query for every reply to a certain post is easier on bandwidth and CPU on both sides than HTML scraping.

14 Name: Anonymous 2005-01-13 12:49 ID:/aBbmgBH (Replies) [Del]

> I was thinking of 2ch browser-like programs.

zomg me too!

http://wakaba.c3.cx/sup/kareha.pl/1104757670

15 Name: !WAHa.06x36 2005-01-13 13:30 ID:8/5imfol (Replies) [Del]

Incidentially, it wouldn't be all that hard to extend the q code to handle replies to the replies, to an arbitary depth. Would that be useful, you think?

16 Name: Anonymous 2005-01-13 13:54 ID:/aBbmgBH (Replies) [Del]

Seriously, though: Why not make a firefox extension or a small browser for this? There are a lot of features that could be useful for Kareha, but I doubt it would make sense to cram them all into the actual software itself.

17 Name: !WAHa.06x36 2005-01-13 14:06 ID:8/5imfol (Replies) [Del]

Well, it's quite a bit of work. If anyone wants to do this, I'm open to suggestions and making internal changes to help out.

18 Name: Mr VacBob!JqK7T7zan. 2005-01-14 21:27 ID:Heaven (Replies) [Del]

A secret feature :o
>>r3

19 Name: Mr VacBob!JqK7T7zan. 2005-01-19 20:19 ID:g8vpanZy (Replies) [Del]

How did you implement /q? I'm working on it and I've thought of two ways:
* on every /q request, rescan the entire thread for anchors that would load the q parameter; this is slow even when it isn't being done in PHP.
* keep around a cache of what anchors every post requests; this isn't slow, but adds more data files which might annoy someone, and makes me wish for an actual database. Also, it can get corrupted and has to be updated every time someone posts and such.

20 Name: !WAHa.06x36 2005-01-20 06:59 ID:31LyLntx (Replies) [Del]

I scan the entire thread. I figured it's done seldom enough that speed isn't crucial. It's not THAT slow, either, at least not with my data storage setup (keeping posts on separate single lines of a HTML file).

Here's the relevant code (@page contains the lines of the current thread page, $num is the argument to q, @posts is filled with a list of which posts to display, $replyrange_re is a regexp to match the >> syntax, in_range() checks if a certain post number is contained in a >> reference.

push @posts,$num;
OUTER: foreach my $post (1..$total)
{
next if($post eq $num);
while($page[$post+1]=~/>>($replyrange_re)/g)
{
if(in_range($num,$1)) { push @posts,$post; next OUTER; }
}
}

Here's in_range():

sub in_range($$)
{

my ($num,$ranges)=@_;
foreach my $range (split /(,|,)/,$ranges)
{
if($range=~/^([0-9]*)-([0-9]*)$/)
{
my $start=($1 or 1);
my $end=($2 or 1000000); # arbitary large number
		($start,$end)=($end,$start) if($start>$end);
		return 1 if($num>=$start and $num<=$end);
}
elsif($range=~/^([0-9]+)$/)
{
return 1 if($num==$1);
}
#elsif($range=~/^l([0-9]+)$/i) {} # l ranges never match
#elsif($range=~/^r([0-9]*)$/i) {} # r ranges never match
#elsif($range=~/^q([0-9]+)$/i) {} # q ranges never match
}
return 0;

}

21 Name: !WAHa.06x36 2005-01-20 07:48 ID:TAFsRkJX (Replies) [Del]

Some notes:

  • I add the parent post by hand to the start, and then scan, explicitly skipping the parent post which would otherwise match because of the javascript code for quoting. This has the effect of putting forward references after the parent post. I am not sure if this is the better behaviour or not.
  • The generalization to support replies-to-replies is easy to see: Make in_range() accept an array of post numbers to match against the range, and feed back the @posts array to it. This wouldn't catch forward references to replies, but maybe we can live without those.
  • If you don't want to catch forward references at all, start the scan from $num+1 instead of 1.

22 Name: Mr VacBob!JqK7T7zan. 2005-01-21 23:40 ID:4GAOAN4q (Replies) [Del]

The >> posting regex being used right now matches every comma in an anchor, even if it's at the end and doesn't mean anything. This screws up some sentences a little:
"What this all really means, though, is that you, >>1, should just stick with today's special."

I can't get one to work; it seems to need at least extended regexp syntax, and I don't know enough of that to do something useful.

23 Name: !WAHa.06x36 2005-01-22 08:50 ID:T12nv1b8 (Replies) [Del]

Well, that's ugly, but at least it doesn't break things entirely, since the link to 1, does work... But let's look at the regexp. I'm using this right now:

/(?:[0-9\-,lrq]|,)+/

One quick but slightly clumsy solution would be something like this:

/(?:[0-9\-,lrq]|,)*[0-9\-lrq]/

That would require the last character to not be a ,.

24 Name: Anonymous 2005-09-09 05:20 ID:c1dSFQq7 [Del]

Shamelessly bumping this to promote further improvement of navigation/linking & sucking up to 0ch! n, next100/previous100, etc. (n´✪ω✪n)

See also: http://wakaba.c3.cx/sup/kareha.pl/1099328662/21-22

25 Post deleted by moderator.

26 Post deleted by moderator.

This thread has been closed. You cannot post in this thread any longer.