[LON-CAPA-cvs] cvs: modules /gerd/Wiki convert.pl

www www at source.lon-capa.org
Thu Dec 15 08:46:12 EST 2011


www		Thu Dec 15 13:46:12 2011 EDT

  Modified files:              
    /modules/gerd/Wiki	convert.pl 
  Log:
  Take care of shockwave movies
  
  
Index: modules/gerd/Wiki/convert.pl
diff -u modules/gerd/Wiki/convert.pl:1.9 modules/gerd/Wiki/convert.pl:1.10
--- modules/gerd/Wiki/convert.pl:1.9	Thu Dec 15 03:18:04 2011
+++ modules/gerd/Wiki/convert.pl	Thu Dec 15 13:46:11 2011
@@ -142,8 +142,11 @@
 # ----------------------------------------------------- Substitutions
        $line=~s/\<img class=\"tex inlinemath\" alt=\"([^\"]+)\"[^\>]+\>/<m>\$$1\$<\/m>/gs;
        $line=~s/\<img class=\"tex\" alt=\"([^\"]+)\"[^\>]+\>/<m>\\\[$1\\\]<\/m>/gs;
-       $line=~s/\<a href\=\"[^\"]+\" title=\"([^\"]+)\"\>/&alink($targetdir,$1)/gse;
+       $line=~s/\<a href\=\"[^\"]+\" title=\"([^\"]+)\"[^\>]*\>/&alink($targetdir,$1)/gse;
        $line=~s/\<a[^\>]+title\=([^\"]+)\"[^\>]+\>\s*\<img[^\>]+\>\s*\<\/a\>/&imglink($targetdir,$1)/gse;
+       $line=~s/\<EMBED\s+src\=\"([^\"]+)\"(.*)\s+NAME\=\"[^\"]+/&embedfragment($targetdir,$1,$2)/gse;
+       $line=~s/\<PARAM NAME\=movie VALUE\=\"([^\"]+)\"/&paramfragment($targetdir,$1)/gse;
+       $line=~s/\<OBJECT(.*)\s+id\=\"([^\"]+)\"/&objectfragment($1,$targetdir,$2)/gse;
 # ------------------------------------------------- End Substitutions
        $output.=$line."\n";
     }
@@ -169,6 +172,28 @@
    return '<img src="'.&rellink(@_).'" />';
 }
 
+sub embedfragment {
+   my ($targ,$ref,$other)=@_;
+   my ($file)=($ref=~/\/([^\/]+)$/);
+   $file="file:$file";
+   return '<EMBED src="'.&rellink($targ,$file).'" '.$other.' name="'.&rellink($targ,$file);
+}
+
+sub paramfragment {
+   my ($targ,$ref)=@_;
+   my ($file)=($ref=~/\/([^\/]+)$/);
+   $file="file:$file";
+   return '<param name="movie" value="'.&rellink($targ,$file).'"';
+}
+
+sub objectfragment {
+   my ($other,$targ,$ref)=@_;
+   my ($file)=($ref=~/\/([^\/]+)$/);
+   $file="file:$file";
+   return '<OBJECT'.$other.' id="'.&rellink($targ,$file).'"';
+}
+
+
 sub rellink {
    my ($srcdir,$ref)=@_;
    $ref=~s/\_/ /g;




More information about the LON-CAPA-cvs mailing list