Commit info for scoop/lib/Scoop:
Modified Files:
Spellchecker.pm Utility.pm
Log Message:
Fix for bug #18 and various other auto-format and spellchecker formatting bugs.
--hulver
Index: Spellchecker.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/Spellchecker.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -r1.8 -r1.9
79,83c79,81
< #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}\'\|]+';
---
> my $url_regexg = '(?:http|ftp|file)://(?:[^\s<]|$)+(?=[\s<]|$)';
> my $entity_regexg = '&#?\w+;';
> my $word_regexg = '[\w\'\|]+';
Index: Utility.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/Utility.pm,v
retrieving revision 1.31
retrieving revision 1.32
diff -r1.31 -r1.32
836a837,847
> # 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;
>
922a934
> s#(?<![A-Za-z0-9])/(\S|\S.*?\S)/(?=[^A-Za-z0-9]|<br>|<p>|$)#<em>$1</em>#gs;
924,926c936
<
< # 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>|$)#<code>$1</code>#gs;
928,929c938,944
< # 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;
---
>
> # 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;