[as2api-dev] [CVS trunk] Skip sections listing methods / fields if they're going
to be empty anyway
David Holroyd
dave at badgers-in-foil.co.uk
Mon, 18 Jul 2005 16:18:17 +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">+41</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=204&content-type=text/vnd.viewcvs-markup">204</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb.diff?r1=204&r2=205">-></a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb?rev=205&content-type=text/vnd.viewcvs-markup">205</a></td></tr>
</table>
<pre class="comment">
Skip sections listing methods / fields if they're going to be empty anyway
</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=204&content-type=text/vnd.viewcvs-markup">204</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb.diff?r1=204&r2=205">-></a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb?rev=205&content-type=text/vnd.viewcvs-markup">205</a></small></div>
<pre class="diff"><small id="info">--- trunk/as2api/html_output.rb 2005-07-17 14:10:14 UTC (rev 204)
+++ trunk/as2api/html_output.rb 2005-07-18 16:18:16 UTC (rev 205)
@@ -561,13 +561,31 @@
</small></pre><pre class="diff" id="context"> end
end
</pre><pre class="diff" id="removed">- field_index_list(@type) if @type.fields? && @type.inherited_fields?
- method_index_list(@type) if @type.methods?
</pre><pre class="diff" id="added">+ field_index_list(@type) if has_or_inherits_documentable_fields?(@type)
+ method_index_list(@type) if has_or_inherits_documentable_methods?(@type)
</pre><pre class="diff" id="context"> constructor_detail(@type) if @type.constructor? && document_member?(@type.constructor)
</pre><pre class="diff" id="removed">- field_detail_list(@type) if @type.fields?
- method_detail_list(@type) if @type.methods?
</pre><pre class="diff" id="added">+ field_detail_list(@type) if has_documentable_fields?(@type)
+ method_detail_list(@type) if has_documentable_methods?(@type)
</pre><pre class="diff" id="context"> end
</pre><pre class="diff" id="added">+ def has_or_inherits_documentable_fields?(astype)
+ return true if has_documentable_fields?(astype)
+ astype.each_ancestor do |ancestor|
+ return true if has_documentable_fields?(ancestor)
+ end
+
+ false
+ end
+
+ def has_or_inherits_documentable_methods?(astype)
+ return true if has_documentable_methods?(astype)
+ astype.each_ancestor do |ancestor|
+ return true if has_documentable_methods?(ancestor)
+ end
+
+ false
+ end
+
</pre><pre class="diff" id="context"> def navigation
html_ul("class"=>"main_nav") do
html_li do
</pre><pre class="diff"><small id="info">@@ -618,7 +636,7 @@
</small></pre><pre class="diff" id="context"> list_fields(type)
if type.has_ancestor?
type.each_ancestor do |type|
</pre><pre class="diff" id="removed">- if type.fields?
</pre><pre class="diff" id="added">+ if has_documentable_fields?(type)
</pre><pre class="diff" id="context"> html_h4 do
pcdata("Inherited from ")
link_type(type)
</pre><pre class="diff"><small id="info">@@ -632,6 +650,15 @@
</small></pre><pre class="diff" id="context"> end
end
</pre><pre class="diff" id="added">+ def has_documentable_fields?(astype)
+ return false if astype.is_a?(ASInterface)
+ astype.each_field do |asfield|
+ return true if document_member?(asfield)
+ end
+
+ false
+ end
+
</pre><pre class="diff" id="context"> def list_fields(type, href_prefix="")
fields = type.fields.sort
index = 0
</pre><pre class="diff"><small id="info">@@ -658,7 +685,7 @@
</small></pre><pre class="diff" id="context"> list_methods(type, known_method_names)
if type.has_ancestor?
type.each_ancestor do |type|
</pre><pre class="diff" id="removed">- if type.methods?
</pre><pre class="diff" id="added">+ if has_documentable_methods?(type)
</pre><pre class="diff" id="context"> html_h4 do
pcdata("Inherited from ")
link_type(type)
</pre><pre class="diff"><small id="info">@@ -672,6 +699,14 @@
</small></pre><pre class="diff" id="context"> end
end
</pre><pre class="diff" id="added">+ def has_documentable_methods?(astype)
+ astype.methods.each do |asmethod|
+ return true if document_member?(asmethod)
+ end
+
+ false
+ end
+
</pre><pre class="diff" id="context"> def list_methods(type, known_method_names, href_prefix="")
methods = type.methods.select do |method|
!known_method_names.include?(method.name) && document_member?(method)
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -> email">CVSspam</a> 0.2.11</small></center>
</body></html>