[DRE-commits] r1634 - in website: plugin src

fourmond at alioth.debian.org fourmond at alioth.debian.org
Sat May 26 22:04:42 UTC 2007


Author: fourmond
Date: 2007-05-26 22:04:42 +0000 (Sat, 26 May 2007)
New Revision: 1634

Added:
   website/plugin/svnauthor.rb
Modified:
   website/src/default.template
Log:
Added a small plugin to know the last editor of each page

Added: website/plugin/svnauthor.rb
===================================================================
--- website/plugin/svnauthor.rb	                        (rev 0)
+++ website/plugin/svnauthor.rb	2007-05-26 22:04:42 UTC (rev 1634)
@@ -0,0 +1,33 @@
+# A webgen plugin to show SVN author information
+#
+# This file is copyright 2007 by Vincent Fourmond, and can be used and
+# redistributed under the same terms as webgen itself.
+#
+# Enjoy !
+
+class SVNAuthor < Tags::DefaultTag
+
+  infos( :name => 'Tag/SVNAuthor',
+         :summary => 
+         "Queries Subversion to know who last modified the file")
+
+  register_tag 'svnAuthor'
+
+  param 'authorNames', {}, "A hash specifying the correspondance " +
+    "svn login -> Real name. "
+  param 'defaultName', "??", "What to display if no one was found"
+
+  def process_tag( tag, chain )
+    info = `svn info #{chain.last.node_info[:src]} 2>/dev/null`
+    if info =~/Last Changed Author:\s*(\w*)/
+      name = $1
+    else
+      name = param('defaultName')
+    end
+    if param('authorNames').key? name
+      name = param('authorNames')[name]
+    end
+    return name
+  end
+
+end

Modified: website/src/default.template
===================================================================
--- website/src/default.template	2007-05-26 21:56:32 UTC (rev 1633)
+++ website/src/default.template	2007-05-26 22:04:42 UTC (rev 1634)
@@ -30,7 +30,8 @@
       </div>
 
       <div id="footer" class="bar">
-        This page was last updated on <b>{filemtime: }</b><br/>
+        This page was last updated on <b>{filemtime: }</b> by 
+	<b> {svnAuthor:} </b><br/>
         This site is generated with <a href="http://webgen.rubyforge.org">webgen</a> on <b>{date: }</b>
       </div>
     </div>




More information about the Pkg-ruby-extras-commits mailing list