RSS 2.0 Feed

» Welcome Guest Log In :: Register

Pages: (38) < [1] 2 3 4 5 6 ... >   
  Topic: Board Mechanics< Next Oldest | Next Newest >  
MidnightVoice



Posts: 380
Joined: Aug. 2005

(Permalink) Posted: Oct. 19 2005,12:45   

I have been involved in other boards and some of them have an "ignore" feature.  This can very useful at times.  Does anyone know if this board has one?  :D

--------------
If I fly the coop some time
And take nothing but a grip
With the few good books that really count
It's a necessary trip

I'll be gone with the girl in the gold silk jacket
The girl with the pearl-driller's hands

  
C.J.O'Brien



Posts: 395
Joined: Aug. 2005

(Permalink) Posted: Oct. 19 2005,13:46   

Well, peachy and the withered wisp seem to be utilizing SOME feature that allows them to ignore things like evidence, and logic, so I would say: yes. yes it does.

--------------
The is the beauty of being me- anything that any man does I can understand.
--Joe G

  
Henry J



Posts: 4048
Joined: Mar. 2005

(Permalink) Posted: Oct. 19 2005,13:48   

:D

  
Wesley R. Elsberry



Posts: 4474
Joined: May 2002

(Permalink) Posted: May 10 2006,23:35   

Slightly different mechanics... the primary hard disk on the server was getting intermittent errors, leading to the server going offline. A few hours ago, the secondary disk was made the boot disk, and I have been working since then to get everything back in place with the right permissions, ownership, etc., and I think that things are OK now. Let me know if there are things that I've overlooked.

--------------
"You can't teach an old dogma new tricks." - Dorothy Parker

    
jeannot



Posts: 1200
Joined: Jan. 2006

(Permalink) Posted: May 11 2006,11:38   

Wesley, there are problems with nested quotes. Is there a way to fix that?

  
Wesley R. Elsberry



Posts: 4474
Joined: May 2002

(Permalink) Posted: May 11 2006,18:22   

Quote

Wesley, there are problems with nested quotes. Is there a way to fix that?



If it was working before, I don't see how.

From iTextParser.pm:

Quote


$Txt =~ s{\[quote\](.+?)\[\/quote\]}   {
                  $html = do_wrapper({STYLE=>'QUOTE'});
                  qq[<!--QuoteBegin-->$html->{START}<\!--QuoteEBegin-->$1<\!--QuoteEnd-->$html->{END}<\!--QuoteEEnd-->];
                }eisgx;

       $Txt =~ s{\[quote=(.+?),\s*(.+?)\](.+?)\[\/quote\]}   {
                   $auth = $1;
                   $time = $2;
                   $html = do_wrapper({STYLE=>'QUOTE', EXTRA => "($auth \@ $time)"});
                   $extra = "-\-$auth\+$time";
                  qq[<!--QuoteBegin$extra-->$html->{START}<\!--QuoteEBegin-->$3<\!--QuoteEnd-->$html->{END}<\!--QuoteEEnd-->];
                }eisgx;



The regular expression,

\[quote\](.+?)\[\/quote\]

means "look for a quote tag, gather and remember the text from that point to the next closing quote tag". Which means that in any "nested" quote, it matches the outer opening quote tag to the innermost closing quote tag. To do nested quotes, I'm thinking that you would need a real parser, not just some regular expression matches.

Edited by Wesley R. Elsberry on May 12 2006,09:39

--------------
"You can't teach an old dogma new tricks." - Dorothy Parker

    
Russell



Posts: 1082
Joined: April 2005

(Permalink) Posted: May 12 2006,02:39   

I never did figure out how to do nested quotes. If it's working now, can someone give me a clue?

(I certainly hope that box Wesley just posted was not the procedure!;)

--------------
Must... not... scratch... mosquito bite.

  
Mr_Christopher



Posts: 1238
Joined: Jan. 2006

(Permalink) Posted: May 12 2006,04:10   

I think Midnight was asking for an ignore button where you could ignore certain users here and not see their comments.

And Russell, if you make a new post you'll see a Quote button along the menue about the new post, experiment with that button.  Also, when you read my post here you'll see a different Quote button.  Try that one as well and use the Preview button alot  :-)

--------------
Uncommon Descent is a moral cesspool, a festering intellectual ghetto that intoxicates and degrades its inhabitants - Stephen Matheson

  
Henry J



Posts: 4048
Joined: Mar. 2005

(Permalink) Posted: May 12 2006,06:03   

I suppose a work around for the nested quote thing would be split the nest up into separate quotes. More work, but it might even make it easier to read. I.e., instead of (A said (B said (C said ...) ... ) ... )
put
(C said ... )
(B said ... )
(A said ... )

Henry

  
steve_h



Posts: 532
Joined: Jan. 2006

(Permalink) Posted: May 12 2006,09:01   

The first of those regular expressions only matches quotes with no attribution. The second mathes only one with them. So as long as you do something like

Quote

 {quote=A,B}
   {quote} .... {/quote}
 {/quote} and don't nest any deeper you should be OK


Quote (A @ B)
 

 xxxxxxx
 
Quote
yyyy




This has been driving me crazy for ages. Thanks for the code snippet.

  
jeannot



Posts: 1200
Joined: Jan. 2006

(Permalink) Posted: May 12 2006,09:10   

Quote (test @ test)

test
Quote
test

test

test

EDIT, it works!

  
Henry J



Posts: 4048
Joined: Mar. 2005

(Permalink) Posted: May 12 2006,10:11   

So inner quotes aren't allowed to say who said whatever it is? That seems like a strange limitation to have.

Henry

  
steve_h



Posts: 532
Joined: Jan. 2006

(Permalink) Posted: May 12 2006,11:02   

Not sure that a full parser is necessary. If you add a (.*) to the front of your pattern (To slurp up the longest text that doesn't contain {quote}, you can find the last complete inner quote. Then iterate until you find no more or you hit a limit (to avoid infinite loops if there is a mistake). I also combined the handling of {quote=} and {quote} forms, otherwise it still gets hopelessly muddled.


Code Sample
#! perl

$_ = <<END;

{quote=wes, 08:00:10}
  {quote}
     {quote}
        Three quotes
          {quote=steve, 01:15}  yes but  {/quote}
          {quote}  no but {/quote}
          {quote=xxx, 01:17}  yes {/quote}
          get a life, steve
      {/quote}
  {/quote}

  {quote=blah, blah} blah blah {/quote}
  {quote} yawn {/quote}
{/quote}
END

$MAXQUOTES=20;
$n=0;
for( $i = 0; $i < $MAXQUOTES &&  $_ ne $old; $i++)
{

  $old=$_;
  s{(.*)\{quote(=(.+?),\s*(.+?))?\}(.+?)\{/quote\}} {
       $n++;
       if ($2 ne "")
       {
        $x = "$1 {QT$n of=$3 at=$4} $5 {/QT$n}";
       }
       else
       {
         $x = "$1 {QT$n} $5 {/QT$n}";
       }
    }eisx;

 #   print "Iteration $i:\n $_";
}

die "unmatched quotes" if (/{\/?quote}/);
print;



produces
Code Sample

{QT8 of=wes at=08:00:10}
   {QT7}
      {QT6}  
        Three quotes
           {QT5 of=steve at=01:15}   yes but   {/QT5}
           {QT4}   no but  {/QT4}
           {QT3 of=xxx at=01:17}   yes  {/QT3}
          get a life, steve
       {/QT6}
   {/QT7}

   {QT2 of=blah at=blah}  blah blah  {/QT2}
   {QT1}  yawn  {/QT1}
{/QT8}  


edit: purged spurious last if.

My deepest sympathy to anyone that can make any sense of the above "edit" comment.

Do you have the code that handles hyperlinks handy? They've caused me considerable annoyance of late.

  
UnMark



Posts: 97
Joined: Mar. 2006

(Permalink) Posted: May 12 2006,16:10   

Would it be possible to display links to the last few pages in a long thread on the topic page?  For instance, if the last post I read in the UD thread was on page 93 and want to catch up on my lunch break (without logging in), I have to click the link to page 95, then go backwards.

Thanks!

  
Wesley R. Elsberry



Posts: 4474
Joined: May 2002

(Permalink) Posted: May 12 2006,18:17   

Quote

Not sure that a full parser is necessary.


I learned long ago that if one asks, "Does anyone know how to do X?", one is likely to listen to the crickets chirping in response. Say instead, "I don't think X is possible," and you may soon be drowning in code. The slice of humble pie that goes with it is just the price of admission.

--------------
"You can't teach an old dogma new tricks." - Dorothy Parker

    
Wesley R. Elsberry



Posts: 4474
Joined: May 2002

(Permalink) Posted: May 12 2006,18:45   

Here's the code that generates the page links on the forum display page. I'm willing to experiment if someone wants to take a shot at code to also display the links to the final three pages when there are more than seven pages total.

Quote


   my $Pages = ($topic->{'TOPIC_POSTS'} + 1) / $iB::INFO->{'DISPLAY_MAX_POSTS'};
   my ($Int, $Dec) = split /\./,$Pages;
   $Dec > 0 ? ($Pages = $Int + 1) : ($Pages = $Int);
   $Pages = 1 if $Pages < 1;
   if ($Pages > 1) {
       $topic->{'PAGES'} = qq[<span id="small">($Forum::lang->{topic_sp_pages} ];
       my $i = 0;
       for(0 .. $Pages-1) {
           my $RealNo = $i * $iB::INFO->{'DISPLAY_MAX_POSTS'}; my $PageNo = $i + 1;
           if ($PageNo == 4) { $topic->{'PAGES'} .= qq[<a href='$iB::INFO->{'BOARD_URL'}/ikonboard.$iB::INFO->{'CG\
I_EXT'}?s=$iB::SESSION;act=ST;f=$iB::IN{'f'};t=$topic->{'TOPIC_ID'};st=] . ($Pages - 1) * $iB::INFO->{'DISPLAY_MAX_\
POSTS'} . qq['>..$Pages </a>]; last; }
           $topic->{'PAGES'} .= qq[<a href='$iB::INFO->{'BOARD_URL'}/ikonboard.$iB::INFO->{'CGI_EXT'}?s=$iB::SESSI\
ON;act=ST;f=$iB::IN{'f'};t=$topic->{'TOPIC_ID'};st=$RealNo'>$PageNo </a>];
           ++$i;
       }
       $topic->{'PAGES'} .= qq[)</span>];
   }



Note that for topics with 4 or more pages, it simply terminates with linking to the final page. That's what "last" does in Perl as a command.

--------------
"You can't teach an old dogma new tricks." - Dorothy Parker

    
Wesley R. Elsberry



Posts: 4474
Joined: May 2002

(Permalink) Posted: May 12 2006,20:18   

And for Steve_h, here's the section that handles the hyperlink stuff:

Code Sample

       $Txt =~ s!\[email\](\S+?)\[/email\]!<a href="mailto:$1">$1</a>!ig;
       $Txt =~ s!\[url\](\S+?)\[/url\]!"<a href=\"".$obj->fix_real_url($1)."\" target='_blank'>".$obj->chomp_url($1)."</a>"!eig;
       $Txt =~ s!\[url\s*=\s*\&quot\;\s*(\S+?)\s*\&quot\;\s*\](.*?)\[\/url\]!"<a href=\"".$obj->fix_real_url($1)."\" target=\"_blank\">".$obj->chomp_url($2)."</a>"!eisg;
       $Txt =~ s!\[url\s*=\s*(\S+?)\s*\](.*?)\[\/url\]!"<a href=\"".$obj->fix_real_url($1)."\" target=\"_blank\">".$obj->chomp_url($2)."</a>"!eisg;
       $Txt =~ s!\[email\s*=\s*\&quot\;([\.\w\-]+\@[\.\w\-]+\.[\.\w\-]+)\s*\&quot\;\s*\](.*?)\[\/email\]!<a href=\"mailto:$1\">$2</a>!isg;
       $Txt =~ s!\[email\s*=\s*([\.\w\-]+\@[\.\w\-]+\.[\w\-]+)\s*\](.*?)\[\/email\]!<a href=\"mailto:$1\">$2</a>!isg;



--------------
"You can't teach an old dogma new tricks." - Dorothy Parker

    
Wesley R. Elsberry



Posts: 4474
Joined: May 2002

(Permalink) Posted: May 12 2006,21:49   

Testing...

Quote (wes @ 08:00:10)

Quote

Quote

       Three quotes
Quote (steve @ 01:15)
 yes but  

Quote
 no but NCSE says

Quote (xxx @ 01:17)
 yes

         get a life, steve and visit TalkOrigins



Quote (blah @ blah)
blah blah or PT

Quote
yawn



Way to go, Steve_h!

Edited by Wesley R. Elsberry on May 22 2006,09:26

--------------
"You can't teach an old dogma new tricks." - Dorothy Parker

    
Stephen Elliott



Posts: 1754
Joined: Oct. 2005

(Permalink) Posted: May 12 2006,21:56   

Quote (Wesley R. Elsberry @ May 13 2006,01:18)
And for Steve_h, here's the section that handles the hyperlink stuff:

Code Sample

       $Txt =~ s!\[email\](\S+?)\[/email\]!<a href="mailto:$1">$1</a>!ig;
       $Txt =~ s!\[url\](\S+?)\[/url\]!"<a href=\"".$obj->fix_real_url($1)."\" target='_blank'>".$obj->chomp_url($1)."</a>"!eig;
       $Txt =~ s!\[url\s*=\s*\&quot\;\s*(\S+?)\s*\&quot\;\s*\](.*?)\[\/url\]!"<a href=\"".$obj->fix_real_url($1)."\" target=\"_blank\">".$obj->chomp_url($2)."</a>"!eisg;
       $Txt =~ s!\[url\s*=\s*(\S+?)\s*\](.*?)\[\/url\]!"<a href=\"".$obj->fix_real_url($1)."\" target=\"_blank\">".$obj->chomp_url($2)."</a>"!eisg;
       $Txt =~ s!\[email\s*=\s*\&quot\;([\.\w\-]+\@[\.\w\-]+\.[\.\w\-]+)\s*\&quot\;\s*\](.*?)\[\/email\]!<a href=\"mailto:$1\">$2</a>!isg;
       $Txt =~ s!\[email\s*=\s*([\.\w\-]+\@[\.\w\-]+\.[\w\-]+)\s*\](.*?)\[\/email\]!<a href=\"mailto:$1\">$2</a>!isg;


Good grief. Trying to read code makes my eyes bleed.

  
steve_h



Posts: 532
Joined: Jan. 2006

(Permalink) Posted: May 12 2006,23:47   

Wow thanks Wes. I didn't expect you to implement it. I thought you'd say it would be far too slow because it has to loop once for each quote tag. One way to make it faster would be to do this only when text was being input by the user  and turn matched "quote"s to matched IQUOT../IQUOT (or similar) and save that in the DB. Then when viewing you could process the start and end tags separately with simpler regexps (Simple string replacement for end tag) in one pass because you know they already match up. Of course you then have to handle internal tags entered directly by the user. And you'd have to turn IQUOT back to QUOTE for editing. Etc. etc. etc.

Re. the other topic: I'd like to see the page number which contains the first post entered after my last page view (not made in the current session) so that I could go directly to where I left off last time. Alas, I fear that may be impossible  :)

  
jeannot



Posts: 1200
Joined: Jan. 2006

(Permalink) Posted: May 12 2006,23:50   

While you're at it, Wesley, could you change some smiley codes? We often add this one  :0 by mistake.

  
Wesley R. Elsberry



Posts: 4474
Joined: May 2002

(Permalink) Posted: May 13 2006,04:49   

An O(n) algorithm seems worth it to me. If it had been O(n^2) or something, that would have been cause for concern.

BTW, the form of the comments in the database is just a lightly filtered version of what you enter. All of the iB code stuff remains in its original form. Otherwise, editing would require re-coding and then decoding.

Hmmm, emoticons... :0 or :O . OK, the "wow" emoticon now is a colon followed by a capital "O", not the numeral zero.

Edited by Wesley R. Elsberry on May 13 2006,10:08

--------------
"You can't teach an old dogma new tricks." - Dorothy Parker

    
stevestory



Posts: 8884
Joined: Oct. 2005

(Permalink) Posted: May 13 2006,04:51   

test removed

   
Henry J



Posts: 4048
Joined: Mar. 2005

(Permalink) Posted: May 13 2006,17:35   

This should work for the page link generation, if Perl follows rules similar to the languages I've used. It lists the page if page# is 1 or within 3 of the number of pages, and excludes any page#'s between those two ranges.

Quote

   my $Pages = ($topic->{'TOPIC_POSTS'} + 1) / $iB::INFO->{'DISPLAY_MAX_POSTS'};
   my ($Int, $Dec) = split /\./,$Pages;
   $Dec > 0 ? ($Pages = $Int + 1) : ($Pages = $Int);
   $Pages = 1 if $Pages < 1;
   if ($Pages > 1) {
       $topic->{'PAGES'} = qq[<span id="small">($Forum::lang->{topic_sp_pages} ];
       my $i = 0;
       for(0 .. $Pages-1) {
           my $RealNo = $i * $iB::INFO->{'DISPLAY_MAX_POSTS'}; my $PageNo = $i + 1;
           if ($PageNo == 1) { $topic->{'PAGES'} .= qq[<ahref='$iB::INFO->{'BOARD_URL'}/ikonboard.$iB::INFO->{'CG\
I_EXT'}?s=$iB::SESSION;act=ST;f=$iB::IN{'f'};t=$topic->{'TOPIC_ID'};st=$RealNo'>$PageNo </a>]; }
           else if ($PageNo > $Pages-3)
                             { $topic->{'PAGES'} .= qq[<ahref='$iB::INFO->{'BOARD_URL'}/ikonboard.$iB::INFO->{'CG\
I_EXT'}?s=$iB::SESSION;act=ST;f=$iB::IN{'f'};t=$topic->{'TOPIC_ID'};st=$RealNo'>$PageNo </a>]; }
           ++$i;
       }
       $topic->{'PAGES'} .= qq[)</span>];
   }



Henry

  
Wesley R. Elsberry



Posts: 4474
Joined: May 2002

(Permalink) Posted: May 13 2006,18:25   

Thank you, Henry J. I still had a half hour of work there. I really wanted the two-dot ellipsis. Plus, Perl has a reserved word for "else if" that is not "else if" : elsif. The error message was not very helpful, either.

--------------
"You can't teach an old dogma new tricks." - Dorothy Parker

    
stevestory



Posts: 8884
Joined: Oct. 2005

(Permalink) Posted: May 14 2006,10:26   

What Daylight Savings Time kicked in, this board went an hour behind, as displayed on my computer.

   
UnMark



Posts: 97
Joined: Mar. 2006

(Permalink) Posted: May 14 2006,16:06   

Thank you, Henry and Wesley!

  
Henry J



Posts: 4048
Joined: Mar. 2005

(Permalink) Posted: May 15 2006,17:01   

I noticed it now gives links to the first three, then an ellipsis (...), then links to the last three (for topics that have 7 or more pages, I guess). If I'd known those were the specs I could'a done it that way to start with. :)

Not to mention if I'd known that Perl spells "else if" as one word (or if I'd simply put braces around the second "if" statement, as in { if (condition) { ... } else { if (condition2) { ... } else { ... } } }, but I didn't think of it at the time. [Don Adams]Sorry about that, chief [/Don Adams] ).

Henry

  
Alan Fox



Posts: 1365
Joined: Aug. 2005

(Permalink) Posted: May 20 2006,08:31   

Dr. Elsberry

Is there a possibility that recognised file extensions for images could include .JPG, as that's how my image files are stored on my web host?

(And the spellchecker still wants to call you Dr. Elderberry.)

  
Wesley R. Elsberry



Posts: 4474
Joined: May 2002

(Permalink) Posted: May 20 2006,15:04   

Both "jpeg" and "jpg" are already listed as valid extensions.

--------------
"You can't teach an old dogma new tricks." - Dorothy Parker

    
  1132 replies since Oct. 19 2005,12:45 < Next Oldest | Next Newest >  

Pages: (38) < [1] 2 3 4 5 6 ... >   


Track this topic Email this topic Print this topic

[ Read the Board Rules ] | [Useful Links] | [Evolving Designs]