| David E. Smith on 12 Dec 2002 04:26:01 -0000 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| [spoon-discuss] Re: [Spoon-business] NWEEK 28 BALLOT |
On Wed, 11 Dec 2002, Wonko wrote:
> This is directed to Dave, with regards to the 21/6 in one of my props. Why
> is it that sometimes strings in proposals such as "21/6" become links to
> their respective rules, but sometimes it doesn't happen? Do you go through
> and do it yourself, or does one of your scripts do it, and if it is the
> latter, what do I have to do to make a "21/6" turn into a link in the prop?
It's semi-automated.
$rt = $srow["ruletext"];
$re = "/(\d{3,4})\/(\d{1,2}[^\d])/" ;
$rt = preg_replace($re,
"<A HREF=\"http://www.nomic.net/~g6/history.php?rn=\\1\">\\1/\\2</A>",
$rt);
The regex isn't perfect, obviously, but it's reasonably close. It's
supposed to look for anything that's 3 or 4 digits, then a / , then one or
two digits. It was really only intended for rule revision histories; the
fact that such things show up elsewhere occasionally is just a convenient
bonus.
...dave
_______________________________________________
spoon-discuss mailing list
spoon-discuss@xxxxxxxxx
http://lists.ellipsis.cx/mailman/listinfo/spoon-discuss