[as2api-dev] [CVS trunk] Factor a common text-generating pattern out into a new method

David Holroyd dave at badgers-in-foil.co.uk
Sat, 02 Jul 2005 18:10:57 +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">+10</td><td align="right" id="removed">-6</td><td nowrap="nowrap" align="center"><a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb?rev=172&amp;content-type=text/vnd.viewcvs-markup">172</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb.diff?r1=172&amp;r2=173">-&gt;</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb?rev=173&amp;content-type=text/vnd.viewcvs-markup">173</a></td></tr>
</table>
<pre class="comment">
Factor a common text-generating pattern out into a new method
</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=172&amp;content-type=text/vnd.viewcvs-markup">172</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb.diff?r1=172&amp;r2=173">-&gt;</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb?rev=173&amp;content-type=text/vnd.viewcvs-markup">173</a></small></div>
<pre class="diff"><small id="info">--- trunk/as2api/html_output.rb	2005-07-02 18:09:28 UTC (rev 172)
+++ trunk/as2api/html_output.rb	2005-07-02 18:10:57 UTC (rev 173)
@@ -533,7 +533,7 @@
</small></pre><pre class="diff" id="context">   end
 
   def link_up
</pre><pre class="diff" id="removed">-    yield "Package #{@type.package_name}", "package-summary.html"
</pre><pre class="diff" id="added">+    yield package_description_for(@type.package), "package-summary.html"
</pre><pre class="diff" id="context">   end
 
   def link_prev
</pre><pre class="diff"><small id="info">@@ -1025,6 +1025,10 @@
</small></pre><pre class="diff" id="context">   package.name
 end
 
</pre><pre class="diff" id="added">+def package_description_for(package)
+  "Package #{package_display_name_for(package)}"
+end
+
</pre><pre class="diff" id="context"> def package_link_for(package, page)
   return page if package.name == ""
   package_dir_for(package) + "/" + page
</pre><pre class="diff"><small id="info">@@ -1038,7 +1042,7 @@
</small></pre><pre class="diff" id="context">     dir = package_dir_for(package)
     super("package-summary", dir)
     @package = package
</pre><pre class="diff" id="removed">-    @title = "Package #{package_display_name_for(@package)} API Documentation"
</pre><pre class="diff" id="added">+    @title = "#{package_description_for(@package)} API Documentation"
</pre><pre class="diff" id="context">     @conf = conf
     @prev_package = nil
     @next_package = nil
</pre><pre class="diff"><small id="info">@@ -1047,7 +1051,7 @@
</small></pre><pre class="diff" id="context">   attr_accessor :prev_package, :next_package
 
   def generate_body_content
</pre><pre class="diff" id="removed">-      html_h1("Package "+package_display_name_for(@package))
</pre><pre class="diff" id="added">+      html_h1(package_description_for(@package))
</pre><pre class="diff" id="context">       interfaces = @package.interfaces
       unless interfaces.empty?
 	interfaces.sort!
</pre><pre class="diff"><small id="info">@@ -1118,12 +1122,12 @@
</small></pre><pre class="diff" id="context">   end
   def link_prev
     if @prev_package
</pre><pre class="diff" id="removed">-      yield "Package #{package_display_name_for(@prev_package)}", base_path(package_link_for(@prev_package, "package-summary.html"))
</pre><pre class="diff" id="added">+      yield package_description_for(@prev_package), base_path(package_link_for(@prev_package, "package-summary.html"))
</pre><pre class="diff" id="context">     end
   end
   def link_next
     if @next_package
</pre><pre class="diff" id="removed">-      yield "Package #{package_display_name_for(@next_package)}", base_path(package_link_for(@next_package, "package-summary.html"))
</pre><pre class="diff" id="added">+      yield package_description_for(@next_package), base_path(package_link_for(@next_package, "package-summary.html"))
</pre><pre class="diff" id="context">     end
   end
 
</pre><pre class="diff"><small id="info">@@ -1264,7 +1268,7 @@
</small></pre><pre class="diff" id="context">     dir = package_dir_for(package)
     super("package-frame", dir)
     @package = package
</pre><pre class="diff" id="removed">-    @title = "Package #{package_display_name_for(@package)} API Naviation"
</pre><pre class="diff" id="added">+    @title = "#{package_description_for(@package)} API Naviation"
</pre><pre class="diff" id="context">     @doctype_id = :transitional
   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>