Skip to content

Commit

Permalink
Add --title option to set HTML document titles
Browse files Browse the repository at this point in the history
  • Loading branch information
lsegal committed Jul 6, 2009
1 parent 87e150e commit 3684ff9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/yard/cli/yardoc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ def optparse(*args)
opts.on('--no-highlight', "Don't highlight code in docs as Ruby.") do
options[:no_highlight] = true
end

opts.on('--title TITLE', 'Add a specific title to HTML documents') do |title|
options[:title] = title
end

opts.on('-r', '--readme FILE', 'The readme file used as the title page of documentation.') do |readme|
raise Errno::ENOENT, readme unless File.file?(readme)
Expand Down
5 changes: 5 additions & 0 deletions spec/cli/yardoc_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ class YARD::CLI::Yardoc; public :optparse end
Registry.instance.stub!(:load)
end

it "should accept --title" do
@yardoc.optparse('--title', 'hello world')
@yardoc.options[:title].should == :'hello world'
end

it "should select a markup provider when --markup-provider or -mp is set" do
@yardoc.optparse("-M", "test")
@yardoc.options[:markup_provider].should == :test
Expand Down
2 changes: 1 addition & 1 deletion templates/default/fulldoc/html/index.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>YARD Documentation</title>
<title><%= options[:title] || "YARD Documentation" %></title>
</head>
<frameset cols="20%,*">
<frameset rows="13%,45%,42%">
Expand Down

0 comments on commit 3684ff9

Please sign in to comment.