[as2api-dev] [CVS trunk] Add title attributes to HTML arround method names, giving the method's signature

David Holroyd dave at badgers-in-foil.co.uk
Fri, 01 Jul 2005 21:03:25 +0000


<html>
<head>
<style><!--
  body {background-color:#ffffff;}
  .file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
  .pathname {font-family:monospace; float:right;}
  .fileheader {margin-bottom:.5em;}
  .diff {margin:0;}
  .tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
  .tasklist ul {margin-top:0;margin-bottom:0;}
  tr.alt {background-color:#eeeeee}
  #added {background-color:#ddffdd;}
  #addedchars {background-color:#99ff99;font-weight:bolder;}
  tr.alt #added {background-color:#ccf7cc;}
  #removed {background-color:#ffdddd;}
  #removedchars {background-color:#ff9999;font-weight:bolder;}
  tr.alt #removed {background-color:#f7cccc;}
  #info {color:#888888;}
  #context {background-color:#eeeeee;}
  td {padding-left:.3em;padding-right:.3em;}
  tr.head {border-bottom-width:1px;border-bottom-style:solid;}
  tr.head td {padding:0;padding-top:.2em;}
  .task {background-color:#ffff00;}
  .comment {padding:4px;border:1px dashed #000000;background-color:#ffffdd}
  .error {color:red;}
  hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="4">Commit in <b><tt>trunk/as2api</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt><a href="#file1">html_output.rb</a></tt></td><td align="right" id="added">+32</td><td align="right" id="removed">-3</td><td nowrap="nowrap" align="center"><a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb?rev=165&amp;content-type=text/vnd.viewcvs-markup">165</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb.diff?r1=165&amp;r2=166">-&gt;</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb?rev=166&amp;content-type=text/vnd.viewcvs-markup">166</a></td></tr>
</table>
<pre class="comment">
Add title attributes to HTML arround method names, giving the method's signature

This text will then appear when the mouse hovers over the method name, in many
browsers.
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname"><a
href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk">trunk</a>/<a
href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api">as2api</a></span><br />
<div class="fileheader"><big><b>html_output.rb</b></big> <small id="info"><a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb?rev=165&amp;content-type=text/vnd.viewcvs-markup">165</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb.diff?r1=165&amp;r2=166">-&gt;</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb?rev=166&amp;content-type=text/vnd.viewcvs-markup">166</a></small></div>
<pre class="diff"><small id="info">--- trunk/as2api/html_output.rb	2005-07-01 20:58:56 UTC (rev 165)
+++ trunk/as2api/html_output.rb	2005-07-01 21:03:24 UTC (rev 166)
@@ -266,6 +266,32 @@
</small></pre><pre class="diff" id="context">     end
   end
 
</pre><pre class="diff" id="added">+  def signature_for_method(method)
+    sig = ""
+    if method.access.is_static
+      sig &lt;&lt; "static "
+    end
+    unless method.access.visibility.nil?
+      sig &lt;&lt; "#{method.access.visibility.body} "
+    end
+    sig &lt;&lt; "function "
+    sig &lt;&lt; method.name
+    sig &lt;&lt; "("
+    method.arguments.each_with_index do |arg, index|
+      sig &lt;&lt; ", " if index &gt; 0
+      sig &lt;&lt; arg.name
+      if arg.arg_type
+	sig &lt;&lt; ":"
+	sig &lt;&lt; arg.arg_type.name
+      end
+    end
+    sig &lt;&lt; ")"
+    if method.return_type
+      sig &lt;&lt; ":"
+      sig &lt;&lt; method.return_type.name
+    end
+    sig
+  end
</pre><pre class="diff" id="context"> 
   def link_for_method(method)
     if @type == method.containing_type
</pre><pre class="diff"><small id="info">@@ -276,14 +302,17 @@
</small></pre><pre class="diff" id="context">   end
 
   def link_method(method)
</pre><pre class="diff" id="added">+    sig = signature_for_method(method)
</pre><pre class="diff" id="context">     if method.containing_type.document?
</pre><pre class="diff" id="removed">-      html_a("href"=&gt;link_for_method(method)) do
</pre><pre class="diff" id="added">+      html_a("href"=&gt;link_for_method(method)<span id="addedchars">,&nbsp;"title"=&gt;sig</span>) do
</pre><pre class="diff" id="context"> 	pcdata(method.name)
 	pcdata("()")
       end
     else
</pre><pre class="diff" id="removed">-      pcdata(method.name)
-      pcdata("()")
</pre><pre class="diff" id="added">+      html_span("title"=&gt;sig) do
+	pcdata(method.name)
+	pcdata("()")
+      end
</pre><pre class="diff" id="context">     end
   end
 
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -&gt; email">CVSspam</a> 0.2.11</small></center>
</body></html>