SHARE
TWEET

Untitled

a guest Jun 14th, 2017 124 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. sub format_comment($)
  2. {
  3.      my ($comment)=@_;
  4.  
  5.      # hide >>1 references from the quoting code
  6.      $comment=~s/>>([0-9\-]+)/&gtgt;$1/g;
  7.      
  8.      
  9.      my $handler=sub # fix up >>1 references
  10.      {    
  11.           my $line=shift;          
  12.           $line=~s!&gtgt;([0-9]+)!
  13.                my $res=get_post($1);
  14.                if($res) { '<a href="'.get_reply_link($$res{num},$$res{parent}).'" onclick="highlight('.$1.')">>>'.$1.'</a>' }
  15.                else { ">>$1"; }
  16.           !ge;
  17.          
  18.           $line=~s!>>/([A-z]+)/([0-9]+)#([0-9]+)!
  19.                '<a href="/'.$1.'/res/'.$2.'.html#i'.$3.'">>>/'.$1.'/'.$2.'#'.$3.'</a>'
  20.           !ge;
  21.           return $line;
  22.      };
  23.  
  24.      #if(ENABLE_WAKABAMARK) { $comment=do_wakabamark($comment,$handler) }
  25.      #else { $comment="<p>".simple_format($comment,$handler)."</p>" }
  26.      $comment=~s!(\r?\n|^)(>.*?)(?=$|\r?\n)!$1<span class="unkfunc">$2</span>$3!g;
  27.      $comment=~s!\r?\n!<br />!g;
  28.      $comment=do_bbcode($comment);
  29.      $comment=$comment=simple_format(do_wakabamark($comment,$handler));
  30.      # fix <blockquote> styles for old stylesheets
  31.      $comment=~s/<blockquote>/<blockquote class="unkfunc">/g;
  32.  
  33.      # restore >>1 references hidden in code blocks
  34.      $comment=~s/&gtgt;/>>/g;
  35.  
  36.      return $comment;
  37. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top