[MKDoc-commit] [1.6] Patch from Sam to solve the problem of links getting mixed up

chris at mkdoc.demon.co.uk chris at mkdoc.demon.co.uk
Wed Jun 7 11:24:01 BST 2006


Log Message:
-----------
[1.6] Patch from Sam to solve the problem of links getting mixed up between
different MKDoc sites which use the same mod_perl, see:
http://www.mkdoc.org/bugs/stable/normal/internal-link/

Tags:
----
mkdoc-1-6

Modified Files:
--------------
    mkd/flo/editor:
        Link.pm

-------------- next part --------------
Index: Link.pm
===================================================================
RCS file: /var/spool/cvs/mkd/flo/editor/Link.pm,v
retrieving revision 1.7.2.21
retrieving revision 1.7.2.22
diff -Lflo/editor/Link.pm -Lflo/editor/Link.pm -u -r1.7.2.21 -r1.7.2.22
--- flo/editor/Link.pm
+++ flo/editor/Link.pm
@@ -33,9 +33,6 @@
 	     flo::editor::Mixin::compute_name
 	     flo::editor::Mixin::normalize_name/;
 
-# keep a global link parser around
-my $link_parser = MKDoc::Util::LinkParser->new();
-
 # placeholder for the URL entry field
 my $EMPTY_URL = 'http://';
 
@@ -66,6 +63,8 @@
 
 sub parse_url {
     my ($self, $url) = @_;
+
+    my $link_parser = MKDoc::Util::LinkParser->new();
     $link_parser->parse($url);
 
     if ($link_parser->is_internal and $link_parser->is_valid) {
@@ -85,6 +84,8 @@
 # template rendering for the URL
 sub render_url {
     my $self = shift;
+    my $link_parser = MKDoc::Util::LinkParser->new();
+
     if ($self->{internal_link}) {
         $link_parser->thaw($self->{internal_link});
         return $link_parser->as_string;
@@ -119,6 +120,7 @@
 	return 0;
     };
 
+    my $link_parser = MKDoc::Util::LinkParser->new();
     $link_parser->parse($self->{url});
     if ($link_parser->is_internal and not $link_parser->is_valid) {
         new MKDoc::Ouch 'component/link/invalid_internal_url';


More information about the MKDoc-commit mailing list