Changeset 5350
- Timestamp:
- 10/22/09 14:38:23 (3 years ago)
- Location:
- trunk/EasyTimelinePlugin
- Files:
-
- 2 edited
-
lib/Foswiki/Plugins/EasyTimelinePlugin.pm (modified) (3 diffs)
-
tools/EasyTimeline.pl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/EasyTimelinePlugin/lib/Foswiki/Plugins/EasyTimelinePlugin.pm
r3066 r5350 118 118 } 119 119 120 # convert links 121 $text =~ s/\[\[([$Foswiki::regex{mixedAlphaNum}\._\:\/-]*)\]\[([$Foswiki::regex{mixedAlphaNum} \/&\._-]*)\]\]/&renderLink($1, $2, $web, $topic)/egs; 122 120 123 # output the timeline text into the tmp file 121 124 open OUTFILE, ">$tmpFile.txt" … … 131 134 $Foswiki::cfg{Plugins}{$pluginName}{PloticusCmd} . # /usr/local/bin/pl 132 135 ' -T %TMPDIR|F% -A ' . 133 $Foswiki::cfg{ScriptUrlPath} . 'view' . $Foswiki::cfg{ScriptSuffix} . # /bin/view/ 134 '/%WEB|F%'; 136 $Foswiki::cfg{ScriptUrlPath} . 'view' . $Foswiki::cfg{ScriptSuffix}; # /bin/view/ 135 137 &writeDebug("Command: $cmd"); 136 138 my ( $output, $status ) = Foswiki::Sandbox->sysCommand( 137 139 $cmd, 138 140 INFILE => $tmpFile . '.txt', 139 WEB => $web,140 141 TMPDIR => $tmpDir, 141 142 ); … … 223 224 } 224 225 226 # converts Foswiki style links into absolute Mediawiki style links that work with the EasyTimelne.pl script 227 sub renderLink { 228 # [[$link][$title]] 229 my ($link, $title, $web, $topic) = @_; 230 231 if( $link =~ m!^http://! ){ 232 return "[[$link|$title]]" 233 } else { 234 my ( $linkedWeb, $linkedTopic ) = Foswiki::Func::normalizeWebTopicName( '', $link ); 235 my $url = Foswiki::Func::getScriptUrl( $linkedWeb, $linkedTopic, 'view' ); 236 return "[[$url|$title]]"; 237 } 238 } 239 225 240 # ========================= 226 241 sub cleanTmp { -
trunk/EasyTimelinePlugin/tools/EasyTimeline.pl
r3059 r5350 5000 5000 5001 5001 $text =~ s/(\[+) [^\|\]]+ \| ([^\]]*) (\]+)/$1$2$3/gx ; 5002 $text =~ s/(https?)\:/$1colon/gx ;5002 #$text =~ s/(https?)\:/$1colon/gx ; 5003 5003 # $text =~ s/(\[+) [^\:\]]+ \: ([^\]]*) (\]+)/$1$2$3/gx ; #??? 5004 5004 5005 5005 # remove interwiki link prefix 5006 $text =~ s/(\[+) (?:.{2,3}|(?:zh\-.*)|simple|minnan|tokipona) \: ([^\]]*) (\]+)/$1$2$3/gxi ; #???5006 #$text =~ s/(\[+) (?:.{2,3}|(?:zh\-.*)|simple|minnan|tokipona) \: ([^\]]*) (\]+)/$1$2$3/gxi ; #??? 5007 5007 5008 5008 $text =~ s/\[+ ([^\]]+) \]+/{{{$1}}}/x ; … … 5010 5010 $text =~ s/\{\{\{ ([^\}]*) \}\}\}/[[$1]]/x ; 5011 5011 } 5012 # if ($text =~ /\[\[.+\]\]/)5013 # {5014 # $wikilink = $true ;5015 # $link = $text ;5016 # $link =~ s/\n//g ;5017 # $link =~ s/^.*?\[\[/[[/x ;5018 # $link =~ s/\| .*? \]\].*$/]]/x ;5019 # $link =~ s/\]\].*$/]]/x ;5020 # $text =~ s/\[\[ [^\|\]]+ \| (.*?) \]\]/[[$1]]/x ;5021 # $text =~ s/\[\[ [^\:\]]+ \: (.*?) \]\]/[[$1]]/x ;5022 5023 # # remove remaining links5024 # $text =~ s/\[\[ ([^\]]+) \]\]/^%#$1#%^/x ;5025 # $text =~ s/\[+ ([^\]]+) \]+/$1/gx ;5026 # $text =~ s/\^$hPerc\# (.*?) \#$hPerc\^/[[$1]]/x ;5027 # }5028 # elsif ($text =~ /\[.+\]/)5029 # {5030 # $link = $text ;5031 # $link =~ s/\n//g ;5032 # $link =~ s/^.*?\[/[/x ;5033 # $link =~ s/\| .*? \].*$/]/x ;5034 # $link =~ s/\].*$/]/x ;5035 # $link =~ s/\[ ([^\]]+) \]/$1/x ;5036 # $text =~ s/\[ [^\|\]]+ \| (.*?) \]/[[$1]]/x ;5037 5038 # # remove remaining links5039 # $text =~ s/\[\[ ([^\]]+) \]\]/^%#$1#%^/x ;5040 # $text =~ s/\[+ ([^\]]+) \]+/$1/gx ;5041 # $text =~ s/\^$hPerc\# (.*?) \#$hPerc\^/[[$1]]/x ;5042 ## $text =~ s/\[\[ (.*) \]\]/$1/gx ;5043 # }5044 5012 5045 5013 } … … 5047 5015 if ($wikilink) 5048 5016 { 5049 # if ($link =~ /^\[\[.+\:.+\]\]$/) # has a colon in its name 5050 if ($link =~ /^\[\[ (?:.{2,3}|(?:zh\-.*)|simple|minnan|tokipona) \: .+\]\]$/xi) # has a interwiki link prefix 5051 { 5052 # This will fail for all interwiki links other than Wikipedia. 5053 $wiki = lc ($link) ; 5054 $title = $link ; 5055 $wiki =~ s/\[\[([^\:]+)\:.*$/$1/x ; 5056 $title =~ s/^[^\:]+\:(.*)\]\]$/$1/x ; 5057 $title =~ s/ /_/g ; 5058 $link = "http://$wiki.wikipedia.org/wiki/$title" ; 5059 $link = &EncodeURL ($title) ; 5060 if (($hint eq "") && ($title ne "")) 5061 { $hint = "$wiki: $title" ; } 5062 } 5063 else 5064 { 5065 # $wiki = "en" ; 5066 $title = $link ; 5067 $title =~ s/^\[\[(.*)\]\]$/$1/x ; 5068 $title =~ s/ /_/g ; 5069 $link = $articlepath ; 5070 $urlpart = &EncodeURL ($title) ; 5071 $link =~ s/\$1/$urlpart/ ; 5072 if (($hint eq "") && ($title ne "")) 5073 { $hint = "$title" ; } 5074 } 5017 $link =~ s/^\[\[(.*)\]\]$/$1/x ; 5018 $link =~ s/ /_/g ; 5019 if (($hint eq "") && ($link ne "")) 5020 { $hint = "$link" ; } 5021 5075 5022 $hint =~ s/_/ /g ; 5076 5023 }
Note: See TracChangeset
for help on using the changeset viewer.
