[as2api-dev] [CVS trunk] Define metadata <link>s between generated pages.

David Holroyd dave at badgers-in-foil.co.uk
Sat, 02 Jul 2005 16:13:48 +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">+94</td><td align="right" id="removed">-5</td><td nowrap="nowrap" align="center"><a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb?rev=168&amp;content-type=text/vnd.viewcvs-markup">168</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb.diff?r1=168&amp;r2=169">-&gt;</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb?rev=169&amp;content-type=text/vnd.viewcvs-markup">169</a></td></tr>
</table>
<pre class="comment">
Define metadata &lt;link&gt;s between generated pages.
These are used as the basis of Mozilla'a 'Site Navigation Bar', among other
things.
</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=168&amp;content-type=text/vnd.viewcvs-markup">168</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb.diff?r1=168&amp;r2=169">-&gt;</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_output.rb?rev=169&amp;content-type=text/vnd.viewcvs-markup">169</a></small></div>
<pre class="diff"><small id="info">--- trunk/as2api/html_output.rb	2005-07-02 11:38:14 UTC (rev 168)
+++ trunk/as2api/html_output.rb	2005-07-02 16:13:47 UTC (rev 169)
@@ -228,9 +228,7 @@
</small></pre><pre class="diff" id="context">   def generate_head
     html_head do
       html_title(title) unless title.nil?
</pre><pre class="diff" id="removed">-      html_link("rel"=&gt;"stylesheet",
-		       "type"=&gt;"text/css",
-		       "href"=&gt;base_path("style.css"))
</pre><pre class="diff" id="added">+      generate_links
</pre><pre class="diff" id="context">       html_meta("name"=&gt;"generator", "content"=&gt;PROJECT_PAGE)
       unless encoding.nil?
         html_meta("http-equiv"=&gt;"Content-Type",
</pre><pre class="diff"><small id="info">@@ -239,6 +237,29 @@
</small></pre><pre class="diff" id="context">     end
   end
 
</pre><pre class="diff" id="added">+  def generate_links
+    html_link("rel"=&gt;"stylesheet",
+             "type"=&gt;"text/css",
+	     "href"=&gt;base_path("style.css"))
+    link_top do |title, href|
+      html_link("rel"=&gt;"top", "title"=&gt;title, "href"=&gt;href)
+    end
+    link_up do |title, href|
+      html_link("rel"=&gt;"up", "title"=&gt;title, "href"=&gt;href)
+    end
+    link_prev do |title, href|
+      html_link("rel"=&gt;"prev", "title"=&gt;title, "href"=&gt;href)
+    end
+    link_next do |title, href|
+      html_link("rel"=&gt;"next", "title"=&gt;title, "href"=&gt;href)
+    end
+  end
+
+  def link_top; end
+  def link_up; end
+  def link_prev; end
+  def link_next; end
+
</pre><pre class="diff" id="context">   def link_for_type(type)
     base_path(type.qualified_name.gsub(/\./, "/")+".html")
   end
</pre><pre class="diff"><small id="info">@@ -433,8 +454,12 @@
</small></pre><pre class="diff" id="context">       @encoding = "utf-8"
     end
     @title = type.qualified_name
</pre><pre class="diff" id="added">+    @prev_type = nil
+    @next_type = nil
</pre><pre class="diff" id="context">   end
 
</pre><pre class="diff" id="added">+  attr_accessor :prev_type, :next_type
+
</pre><pre class="diff" id="context">   def generate_body_content
       if @type.instance_of?(ASClass)
 	html_h1("Class "+@type.qualified_name)
</pre><pre class="diff"><small id="info">@@ -501,6 +526,28 @@
</small></pre><pre class="diff" id="context">     end
   end
 
</pre><pre class="diff" id="added">+  def link_top
+    yield "Overview", base_path("overview-summary.html")
+  end
+
+  def link_up
+    yield "Package #{@type.package_name}", "package-summary.html"
+  end
+
+  def link_prev
+    if @prev_type
+      kind = @prev_type.is_a?(ASInterface) ? "Interface" : "Class"
+      yield "#{kind} #{@prev_type.qualified_name}", link_for_type(@prev_type)
+    end
+  end
+
+  def link_next
+    if @next_type
+      kind = @next_type.is_a?(ASInterface) ? "Interface" : "Class"
+      yield "#{kind} #{@next_type.qualified_name}", link_for_type(@next_type)
+    end
+  end
+
</pre><pre class="diff" id="context">   def field_index_list(type)
     html_div("class"=&gt;"field_index") do
       html_h2("Field Index")
</pre><pre class="diff"><small id="info">@@ -991,8 +1038,12 @@
</small></pre><pre class="diff" id="context">     @package = package
     @title = "Package #{package_display_name_for(@package)} API Documentation"
     @conf = conf
</pre><pre class="diff" id="added">+    @prev_package
+    @next_package
</pre><pre class="diff" id="context">   end
 
</pre><pre class="diff" id="added">+  attr_accessor :prev_package, :next_package
+
</pre><pre class="diff" id="context">   def generate_body_content
       html_h1("Package "+package_display_name_for(@package))
       interfaces = @package.interfaces
</pre><pre class="diff"><small id="info">@@ -1064,6 +1115,20 @@
</small></pre><pre class="diff" id="context">     end
   end
 
</pre><pre class="diff" id="added">+  def link_top
+    yield "Overview", base_path("overview-summary.html")
+  end
+  def link_prev
+    if @prev_package
+      yield "Package #{package_display_name_for(@prev_package)}", base_path(package_link_for(@prev_package, "package-summary.html"))
+    end
+  end
+  def link_next
+    if @next_package
+      yield "Package #{package_display_name_for(@next_package)}", base_path(package_link_for(@next_package, "package-summary.html"))
+    end
+  end
+
</pre><pre class="diff" id="context">   def class_diagram
     dir = File.join(@conf.output_dir, path_name)
     if FileTest.exists?(File.join(dir, "package-classes.png"))
</pre><pre class="diff"><small id="info">@@ -1513,6 +1578,9 @@
</small></pre><pre class="diff" id="context">     end
   end
 
</pre><pre class="diff" id="added">+  def link_top
+    yield "Overview", base_path("overview-summary.html")
+  end
</pre><pre class="diff" id="context"> end
 
 def make_page_list(conf, type_agregator)
</pre><pre class="diff"><small id="info">@@ -1524,15 +1592,36 @@
</small></pre><pre class="diff" id="context">   list &lt;&lt; AllTypesFramePage.new(type_agregator)
 
   # packages..
</pre><pre class="diff" id="added">+  last_package = nil
+  last_pkg_index = nil
</pre><pre class="diff" id="context">   type_agregator.each_package do |package|
</pre><pre class="diff" id="removed">-    <span id="removedchars">list&nbsp;&lt;&lt;</span> PackageIndexPage.new(conf, package)
</pre><pre class="diff" id="added">+    <span id="addedchars">pkg_index&nbsp;=</span> PackageIndexPage.new(conf, package)
+    list &lt;&lt; pkg_index
</pre><pre class="diff" id="context">     list &lt;&lt; PackageFramePage.new(package)
</pre><pre class="diff" id="added">+
+    if last_package
+      pkg_index.prev_package = last_package
+      last_pkg_index.next_package = package
+    end
+    last_package = package
+    last_pkg_index = pkg_index
</pre><pre class="diff" id="context">   end
 
   # types..
</pre><pre class="diff" id="added">+  last_type = nil
+  last_type_page = nil
</pre><pre class="diff" id="context">   type_agregator.each_type do |type|
     if type.document?
</pre><pre class="diff" id="removed">-      <span id="removedchars">list&nbsp;&lt;&lt;</span> TypePage.new(type)
</pre><pre class="diff" id="added">+      <span id="addedchars">type_page&nbsp;=</span> TypePage.new(type)
+      list &lt;&lt; type_page
+
+      if last_type
+	type_page.prev_type = last_type
+	last_type_page.next_type = type
+      end
+
+      last_type = type
+      last_type_page = type_page
</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>