I'll take a look at it later today, hopefully. I was out of town all
weekend and I still feel like shit, so I haven't gotten around to
rolling scoop cvs back to get your changes from last week out.

BTW, someone told me you had a bug fix that you put in somewhere in that
commit. Is this it, or was it something else? If it was something else,
could you send it out so I can get it into the RC?

-j

On 17/02/04 10:05 +0000, Hulver wrote:
> I'm assuming that we're still doing the "somebody else check and commit
> patches to cvs" thing?
> 
> If not, please tell me, and I'll commit these myself.
> 
> This patch contains lots of little fixes that really improve the
> autoformat and spellchecker code.
> 
> It also fixes the misplaced <a href="quote> bug, and stops &amp; being
> transformed to & on preview.
> 
> Quite a few of the problems where due to scoop not transforming text it
> put in the <TEXTAREA> on input forms.
> 
> This caused problems with urls in Mozilla, although IE seemed to handle
> it OK.
> 
> Wrong.
> ------
> 
> <TEXTAREA>This is some text & some more.<br><a
> href="http://www.hulver.com/">HuSi!</a>
> </TEXTAREA>
> 
> 
> Right.
> ------
> 
> <TEXTAREA>This is some text &amp; some more.&lt;br&gt;&lt;a
> href=&quot;http://www.hulver.com/&quot;&gt;HuSi!&lt;/a&gt;
> </TEXTAREA>
> 
> 
> The admin tools (box & block editors) where doing this, but not the
> story and comment entry forms.
> 
> That was why the missing " in a <A> tag would screw up the page.
> 
> gazbo did the auto-format & spellchecker fixes. It really improves the
> way that auto-format handles urls, and it handles the funny urls
> including ones that contain urls like 
> http://www.hulver.com/?redirect=http://www.hulver.com/
> 
> And urls that contain other autoformat characters, =/* etc.
> 
> So, bugs fixed (from scoop.k5)
> 
> html checker may be having trouble escaping lone pointy brackets
> correctly
> auto-format is linkifying before running clean_html, which can screw up
> links with more than one http in them
> + some others that wern't listed, like the &amp; -> & on preview bug.
> -- 
> http://www.hulver.com/scoop/
> 
> Hulver's site.

> Index: Scoop/Spellchecker.pm
> ===================================================================
> RCS file: /cvs/scoop/scoop/lib/Scoop/Spellchecker.pm,v
> retrieving revision 1.8
> diff -c -r1.8 Spellchecker.pm
> *** Scoop/Spellchecker.pm	28 Jan 2004 14:27:05 -0000	1.8
> --- Scoop/Spellchecker.pm	17 Feb 2004 09:38:30 -0000
> ***************
> *** 76,86 ****
>   	$S->_spellcheck_init();   # set up unless we already have
>   	warn "Init done\n" if $DEBUG;
>   
> ! 	#my $url_regexg = '(?:http|ftp|file)://[^\s<]+(?=\s)';
> ! 	my $url_regexg = '(?:http|ftp|file)://(?:[^\s<\Z])+(?=[\s<]|\Z)';
> ! 	my $entity_regexg = '&\w+;';
> ! 	# word_regexg is unicode aware
> ! 	my $word_regexg = '[\p{IsAlnum}\'\|]+';
>   
>   	$callback = undef unless ref($callback) && (ref($callback) eq 'CODE');
>   	warn "Set callback\n" if $DEBUG;
> --- 76,84 ----
>   	$S->_spellcheck_init();   # set up unless we already have
>   	warn "Init done\n" if $DEBUG;
>   
> ! 	my $url_regexg = '(?:http|ftp|file)://(?:[^\s<]|$)+(?=[\s<]|$)';
> ! 	my $entity_regexg = '&#?\w+;';
> ! 	my $word_regexg = '[\w\'\|]+';
>   
>   	$callback = undef unless ref($callback) && (ref($callback) eq 'CODE');
>   	warn "Set callback\n" if $DEBUG;
> Index: Scoop/Utility.pm
> ===================================================================
> RCS file: /cvs/scoop/scoop/lib/Scoop/Utility.pm,v
> retrieving revision 1.30
> diff -c -r1.30 Utility.pm
> *** Scoop/Utility.pm	28 Jan 2004 14:27:05 -0000	1.30
> --- Scoop/Utility.pm	17 Feb 2004 09:38:31 -0000
> ***************
> *** 834,839 ****
> --- 852,868 ----
>   	s#&amp;#\x03#g; # \x03 == & for now
>   	s#&quot;#\x04#g; # \x04 == " for now
>   
> + 	# Escape any potentially special chars within tags and URLs exactly as if 
> + 	# the user had escaped them with a backslash
> + 	my $url_regexg = '(?:http|ftp|file)://(?:[^\s<]|\Z)+(?=[\s<]|\Z)';
> + 	my $tag_regex = '<[^><]*?>';
> + 
> + 	s!($url_regexg|$tag_regex)!
> + 		my $a = $1;
> + 		$a =~ s#([^a-zA-Z0-9])#chr(ord($1)|0x80)#ge;
> + 		$a
> + 	!ge;
> + 
>   	$_ = $S->_auto_bold_italic($_);
>   	$_ = $S->_auto_create_ul($_);
>   	$_ = $S->_auto_create_ol($_);
> ***************
> *** 895,907 ****
>   
>   	# Only match [*=_/] when there's no space between them and the affected
>   	# text
>   	s#(?<![A-Za-z0-9])\*(\S|\S.*?\S)\*(?=[^A-Za-z0-9]|<br>|<p>|$)#<strong>$1</strong>#gs;
> ! 
> ! 	# Don't match '="' as a closing tag, as it is probably an attribute
> ! 	s#(?<![A-Za-z0-9])=(\S|\S.*?\S)=(?=[^A-Za-z0-9"]|<br>|<p>|$)#<code>$1</code>#gs;
>   	s#(?<![A-Za-z0-9])_(\S|\S.*?\S)_(?=[^A-Za-z0-9]|<br>|<p>|$)#<em>$1</em>#gs;
> ! 	# We have to make sure we don't match the / in closing tags or URLs
> ! 	s#(?<![A-Za-z0-9/:<=])/(\S|\S.*?[^\s<:/])/(?=[^A-Za-z0-9]|<br>|<p>|$)#<em>$1</em>#gs;
>   
>   	return $_;
>   }
> --- 924,940 ----
>   
>   	# Only match [*=_/] when there's no space between them and the affected
>   	# text
> + 	s#(?<![A-Za-z0-9])/(\S|\S.*?\S)/(?=[^A-Za-z0-9]|<br>|<p>|$)#<em>$1</em>#gs;
>   	s#(?<![A-Za-z0-9])\*(\S|\S.*?\S)\*(?=[^A-Za-z0-9]|<br>|<p>|$)#<strong>$1</strong>#gs;
> ! 	s#(?<![A-Za-z0-9])=(\S|\S.*?\S)=(?=[^A-Za-z0-9]|<br>|<p>|$)#<code>$1</code>#gs;
>   	s#(?<![A-Za-z0-9])_(\S|\S.*?\S)_(?=[^A-Za-z0-9]|<br>|<p>|$)#<em>$1</em>#gs;
> ! 
> ! 	# Special chars in URLs and tags have already been properly identified and
> ! 	# escaped - no need for these ad-hoc hacks.
> ! 		# Don't match '="' as a closing tag, as it is probably an attribute
> ! 		# s#(?<![A-Za-z0-9])=(\S|\S.*?\S)=(?=[^A-Za-z0-9"]|<br>|<p>|$)#<code>$1</code>#gs;
> ! 		# We have to make sure we don't match the / in closing tags or URLs
> ! 		# s#(?<![A-Za-z0-9/:<=])/(\S|\S.*?[^\s<:/])/(?=[^A-Za-z0-9]|<br>|<p>|$)#<em>$1</em>#gs;
>   
>   	return $_;
>   }
> Index: Scoop/Comments/Post.pm
> ===================================================================
> RCS file: /cvs/scoop/scoop/lib/Scoop/Comments/Post.pm,v
> retrieving revision 1.66
> diff -c -r1.66 Post.pm
> *** Scoop/Comments/Post.pm	13 Feb 2004 10:39:42 -0000	1.66
> --- Scoop/Comments/Post.pm	17 Feb 2004 09:38:33 -0000
> ***************
> *** 218,233 ****
>   	# Filter subject and comment for output
>   	$subject =~ s/&quot;/"/g;
>   
> ! 	$subject =~ s/&amp;/&/g;
> ! 	$subject =~ s/&/&amp;/g;	
>   	
> ! 	$comment =~ s/&amp;/&/g;
> ! 	$comment =~ s/&/&amp;/g;
>   	
> ! 	$subject =~ s/\%\%/&#37;&#37;/g;
> ! 	$comment =~ s/\%\%/&#37;&#37;/g;
>   
> ! 	$subject =~ s/"/&quot;/g;
>   	my $textarea_cols= $S->{prefs}->{textarea_cols} || $S->{UI}->{VARS}->{default_textarea_cols};
>   	my $textarea_rows= $S->{prefs}->{textarea_rows} || $S->{UI}->{VARS}->{default_textarea_rows};
>   	$form .= qq|
> --- 221,238 ----
>   	# Filter subject and comment for output
>   	$subject =~ s/&quot;/"/g;
>   
> ! 	#$subject =~ s/&amp;/&/g;
> ! 	#$subject =~ s/&/&amp;/g;	
>   	
> ! 	#$comment =~ s/&amp;/&/g;
> ! 	#$comment =~ s/&/&amp;/g;
>   	
> ! 	#$subject =~ s/\%\%/&#37;&#37;/g;
> ! 	#$comment =~ s/\%\%/&#37;&#37;/g;
> ! 	$comment = $S->comment_text($comment);
> ! 	$subject = $S->comment_text($subject);
>   
> ! 	#$subject =~ s/"/&quot;/g;
>   	my $textarea_cols= $S->{prefs}->{textarea_cols} || $S->{UI}->{VARS}->{default_textarea_cols};
>   	my $textarea_rows= $S->{prefs}->{textarea_rows} || $S->{UI}->{VARS}->{default_textarea_rows};
>   	$form .= qq|
> ***************
> *** 444,452 ****
>   	my $S = shift;
>   	my $text = shift;
>   
> ! 	$text =~ s/&amp;/&/g;
>   	$text =~ s/&/&amp;/g;
>   	$text =~ s/\%\%/&#37;&#37;/g;
>   
>   	return $text;
>   }
> --- 449,460 ----
>   	my $S = shift;
>   	my $text = shift;
>   
> ! 	#$text =~ s/&amp;/&/g;
>   	$text =~ s/&/&amp;/g;
>   	$text =~ s/\%\%/&#37;&#37;/g;
> + 	$text =~ s/</&lt;/g;
> + 	$text =~ s/>/&gt;/g;
> + 	$text =~ s/"/&quot;/g;
>   
>   	return $text;
>   }
> ***************
> *** 516,522 ****
>   	$subject =~ s/&#139;/</g;
>   	$subject =~ s/&#155;/>/g;
>   
> ! 	$subject =~ s/&amp;/&/g;
>   	$subject =~ s/&quot;/"/g;
>   
>   	# Translate &'s first, so we don't translate what we do later
> --- 515,521 ----
>   	$subject =~ s/&#139;/</g;
>   	$subject =~ s/&#155;/>/g;
>   
> ! 	#$subject =~ s/&amp;/&/g;
>   	$subject =~ s/&quot;/"/g;
>   
>   	# Translate &'s first, so we don't translate what we do later




-- 

----------------------------------------------
/* You are not expected to understand this. */

Captain_Tenille
http://www.satanosphere.com/
http://www.kuro5hin.org/
jeremy at satanosphere.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.kuro5hin.org/pipermail/scoop-dev/attachments/20040217/aa401ebd/attachment.bin