Skip to content

Commit

Permalink
make documentation less ugly
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanlarsen committed Mar 10, 2009
1 parent fb1a175 commit 55529d8
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 27 deletions.
84 changes: 59 additions & 25 deletions lib/doc_generator.dryml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,36 +10,70 @@
<% } %> <% } %>
</ul> </ul>
</def> </def>

<def tag="tag-link" attrs="link, content">
<li>
<a href="##{link}">
<span>
<%= content %>
</span>
</a>
</li>
</def>




<html> <html>
<head>
<link type="text/css" href="stylesheets/themes/smoothness/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="javascripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="javascripts/jquery-ui-1.7.custom.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#tabs-top").tabs();
jQuery(".taglib").tabs();
jQuery(".source").accordion({collapsible: true, active: false, autoHeight: false });
});
</script>
</head>
<body> <body>
<p> This is the automatically generated documentation for <div id="tabs-top">
hobo-contrib. If you want to help make it prettier, edit <ul>
doc_generator.dryml. </p> <% this.each {|taglib| %>

<tag-link content="&taglib.name" link="#{taglib.name}-taglib"/>

<% } %>
<!-- unfortunately, <repeat> is problematic here --> </ul>
<% this.each {|taglib| %> <!-- unfortunately, <repeat> is problematic here -->
<h1><%= taglib.name %>.dryml</h1> <% this.each {|taglib| %>
<%= taglib.comment_html %> <div class="taglib" id="#{taglib.name}-taglib">
<% taglib.tag_defs.each {|tag| %> <%= taglib.comment_html %>

<ul>
<h2><%= tag.name %></h2> <% taglib.tag_defs.each {|tag| %>

<tag-link content="&tag.name" link="#{tag.name}-tag"/>
<%= tag.comment_intro_html %> <% } %>

</ul>
<% if !tag.parameters.empty? %> <% taglib.tag_defs.each {|tag| %>
<h3>Parameters</h3> <div id="#{tag.name}-tag">
<param-list with="&tag.parameters"/>
<% end %> <h2><%= tag.name %></h2>


<%= tag.comment_rest_html %> <%= tag.comment_intro_html %>


<h3>Source</h3> <% if !tag.parameters.empty? %>
<pre><code><%= h tag.source %></code></pre> <h3>Parameters</h3>
<param-list with="&tag.parameters"/>
<% end %>

<%= tag.comment_rest_html %>


<div class="source">
<h3><a href="#">Source</a></h3>
<pre><code><%= h tag.source %></code></pre>
</div>

</div>
<% } %>
</div>
<% } %> <% } %>
<% } %> </div>
</body> </body>
</html> </html>
8 changes: 6 additions & 2 deletions lib/render.rake
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@


desc "generate documentation" desc "generate documentation"
file "../hobo-contrib-gh-pages/documentation.html" => ["#{RAILS_ROOT}/app/views/taglibs/doc_generator.dryml", :environment]+Dir["#{RAILS_ROOT}/../hobo-contrib/taglibs/**/*.dryml"] do |t| file "../hobo-contrib-gh-pages/documentation.html" => ["#{RAILS_ROOT}/app/views/taglibs/doc_generator.dryml", :environment]+Dir["#{RAILS_ROOT}/../hobo-contrib/taglibs/**/*.dryml"] do |t|
taglibs = Dir["#{RAILS_ROOT}/../hobo-contrib/taglibs/**/*.dryml"].map {|filename|
require 'maruku'

taglibs = Dir["#{RAILS_ROOT}/../hobo-contrib/taglibs/**/*.dryml"].reject {|filename|
File.basename(filename).match(/^hobo-contrib-.*/)
}.map {|filename|
Hobo::Dryml::DrymlDoc::Taglib.new("#{RAILS_ROOT}/../hobo-contrib/taglibs", filename) Hobo::Dryml::DrymlDoc::Taglib.new("#{RAILS_ROOT}/../hobo-contrib/taglibs", filename)
} }


require 'maruku'
src = open(t.prerequisites.first).read src = open(t.prerequisites.first).read
locals = [] locals = []
imports = [] imports = []
Expand Down

0 comments on commit 55529d8

Please sign in to comment.