Name:
	Versions
FullName:
	SuikaWiki: cooperation with version control systems
URI:
	IW:SuikaWiki:SuikaWiki

{
Name:
	wikiview/link-viewcvs
FullName:
	LINK element referring ViewCVS page of the wiki page
Format:
	my $ename = $p->{page} || $o->{page};
	$ename =~ s/(.)/sprintf '%%%02X', ord $1/ges;
	$ename =~ s!%2F%2F!.ns/!g;  $ename =~ tr/%//d;
	$p->{href} .= $ename . ($p->{suffix} || '.txt');
	$r = qq(<link);
	  for my $attr (qw/rel rev href class type hreflang charset/) {
	      $r .= qq( $attr="@{[$o->escape($p->{$attr})]}") if $p->{$attr};
	  }
	  for my $attr (qw/title/) {
	      $r .= qq( $attr="@{[$o->formatter('view')->replace($p->{$attr},$o)]}") if $p->{$attr};
	  }
	$r .= ' />';
}

{
Name:
	wikiview/diff-between-previous
FullName:
	Difference between previous version of this WikiPage
Format:
	$r = qq(<pre class="diff">);
	for (split /\n/, $o->escape ($o->database->traverse_diff ($o->{page}))) {
	  if (/^\+(.*)/) {
	    $r .= qq(<ins class="added">$1</ins>\n);
	  } elsif (/^\-(.*)/) {
	    $r .= qq(<del class="deleted">$1</del>\n);
	  } elsif (/^\=(.*)/) {
	    $r .= qq(<span class="same">$1</span>\n);
	  } else {
	    $r .= qq|??? $_\n|;
	  }
	}
	$r .= qq(</pre>);
}

MODULE:
	SuikaWiki::View->definition ('diff')->properties (
	  {media => {type => 'text/html', charset => 1, expires => 120},
	  #xmedia => {type => 'application/xhtml+xml', charset => 1, expires => 120},
	  template => <<EOH});
	%html-start;%html-head(title=>"%res(name=>\\"Diff:WebPageTitle\\");"p,link_meta=>"%predefined-template(name=>links);"p);
	%section(level=>1,add_to_toc=>0,type=>body,title=>"%ns-short-page-name;",heading,content=>"
	  %section(id=>tools1,class=>tools,add_to_toc=>0,content=>\\"%predefined-template(name=>navbar);\\"p);
	  %section(level=>2,id=>\\"diff\\",title=>\\"Diff:Title\\",heading,content=>\\"
	    <p>%res(name=>\\\\\\"Diff:Notice\\\\\\");</p>
	    %diff-between-previous;
	  \\");
	  %section(level=>2,id=>toc,title=>\\"TOC:Title\\",heading,add_to_toc=>0,content=>\\"%toc(drag);\\");
	  %section(class=>tools,add_to_toc=>0,content=>\\\"%predefined-template(name=>navbar);\\"p);
	  %section(id=>footer,add-to-toc=>0,content=>\\"%predefined-template(name=>footer);\\");
	");
	EOH
	
	my $l = SuikaWiki::View->template ('links');
	$l .= <<'EOH';
	%link-wiki(mode=>diff,rel=>history,class=>wiki-cmd,title=>"%res(name=>ViewDiffOfThisPageLink);"p);
	EOH
	
	my $cvsuri = SuikaWiki::Plugin->uri ('cvs_repository');
	$l .= <<EOH if $cvsuri;
	%link-viewcvs(href=>"$cvsuri",rel=>history,class=>wiki-cmd,title=>"%res(name=>ViewHistoryOfThisPageLink);",hreflang=>en);
	EOH

POD:LICENSE:
	Copyright 2003 Wakaba <w@suika.fam.cx>
	
	%%GNUGPL2%%