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 Diff line number Diff line change
Expand Up @@ -10,36 +10,70 @@
<% } %>
</ul>
</def>

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


<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>
<p> This is the automatically generated documentation for
hobo-contrib. If you want to help make it prettier, edit
doc_generator.dryml. </p>


<!-- unfortunately, <repeat> is problematic here -->
<% this.each {|taglib| %>
<h1><%= taglib.name %>.dryml</h1>
<%= taglib.comment_html %>
<% taglib.tag_defs.each {|tag| %>

<h2><%= tag.name %></h2>

<%= tag.comment_intro_html %>

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

<%= tag.comment_rest_html %>

<h3>Source</h3>
<pre><code><%= h tag.source %></code></pre>
<div id="tabs-top">
<ul>
<% this.each {|taglib| %>
<tag-link content="&taglib.name" link="#{taglib.name}-taglib"/>
<% } %>
</ul>
<!-- unfortunately, <repeat> is problematic here -->
<% this.each {|taglib| %>
<div class="taglib" id="#{taglib.name}-taglib">
<%= taglib.comment_html %>
<ul>
<% taglib.tag_defs.each {|tag| %>
<tag-link content="&tag.name" link="#{tag.name}-tag"/>
<% } %>
</ul>
<% taglib.tag_defs.each {|tag| %>
<div id="#{tag.name}-tag">

<h2><%= tag.name %></h2>

<%= tag.comment_intro_html %>

<% if !tag.parameters.empty? %>
<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>
</html>
8 changes: 6 additions & 2 deletions lib/render.rake
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@

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|
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)
}

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

0 comments on commit 55529d8

Please sign in to comment.