table of contents generation works properly again

This commit is contained in:
jdp 2010-03-17 00:41:06 -04:00
parent 3b48e38cba
commit 3af16f3afe
3 changed files with 4 additions and 4 deletions

View File

@ -84,8 +84,7 @@ Dir.mkdir output_dir if !File.directory?(output_dir)
sources.each do |filename| sources.each do |filename|
rocco = Rocco.new(filename, sources, options) rocco = Rocco.new(filename, sources, options)
fnparts = filename.split('.') fnparts = filename.split('.')
fnparts.pop dest = fnparts.slice(0, fnparts.length - 1).join('.') + '.html'
dest = File.join(output_dir, fnparts.join('.') + '.html')
puts "rocco: #{filename} -> #{dest}" puts "rocco: #{filename} -> #{dest}"
File.open(dest, 'wb') { |fd| fd.write(rocco.to_html) } File.open(dest, 'wb') { |fd| fd.write(rocco.to_html) }
end end

View File

@ -28,10 +28,11 @@ class Rocco::Layout < Mustache
def sources def sources
@doc.sources.sort.map do |source| @doc.sources.sort.map do |source|
srcparts = File.basename(source).split('.')
{ {
:path => source, :path => source,
:basename => File.basename(source), :basename => File.basename(source),
:url => File.basename(source, '.rb') + '.html' :url => srcparts.slice(0, srcparts.length - 1).join('.') + '.html'
} }
end end
end end

View File

@ -4,7 +4,7 @@ Gem::Specification.new do |s|
s.name = 'rocco' s.name = 'rocco'
s.version = '0.2' s.version = '0.2'
s.date = '2010-03-16' s.date = '2010-03-17'
s.description = "Docco in Ruby" s.description = "Docco in Ruby"
s.summary = s.description s.summary = s.description