From 3af16f3afe92a7796109a516bdc9b5f4e6acfce6 Mon Sep 17 00:00:00 2001 From: jdp Date: Wed, 17 Mar 2010 00:41:06 -0400 Subject: [PATCH] table of contents generation works properly again --- bin/rocco | 3 +-- lib/rocco/layout.rb | 3 ++- rocco.gemspec | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/rocco b/bin/rocco index 2a1254f..b20f74e 100755 --- a/bin/rocco +++ b/bin/rocco @@ -84,8 +84,7 @@ Dir.mkdir output_dir if !File.directory?(output_dir) sources.each do |filename| rocco = Rocco.new(filename, sources, options) fnparts = filename.split('.') - fnparts.pop - dest = File.join(output_dir, fnparts.join('.') + '.html') + dest = fnparts.slice(0, fnparts.length - 1).join('.') + '.html' puts "rocco: #{filename} -> #{dest}" File.open(dest, 'wb') { |fd| fd.write(rocco.to_html) } end diff --git a/lib/rocco/layout.rb b/lib/rocco/layout.rb index a2d7a80..e89dde2 100644 --- a/lib/rocco/layout.rb +++ b/lib/rocco/layout.rb @@ -28,10 +28,11 @@ class Rocco::Layout < Mustache def sources @doc.sources.sort.map do |source| + srcparts = File.basename(source).split('.') { :path => source, :basename => File.basename(source), - :url => File.basename(source, '.rb') + '.html' + :url => srcparts.slice(0, srcparts.length - 1).join('.') + '.html' } end end diff --git a/rocco.gemspec b/rocco.gemspec index 35c86b9..61d59b3 100644 --- a/rocco.gemspec +++ b/rocco.gemspec @@ -4,7 +4,7 @@ Gem::Specification.new do |s| s.name = 'rocco' s.version = '0.2' - s.date = '2010-03-16' + s.date = '2010-03-17' s.description = "Docco in Ruby" s.summary = s.description