Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RDoc::Options#template_stylesheets #205

Merged
merged 1 commit into from
Jun 28, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/rdoc/generator/darkfish.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ def write_style_sheet
options = { :verbose => $DEBUG_RDOC, :noop => @dry_run }

FileUtils.cp @template_dir + 'rdoc.css', '.', options
@options.template_stylesheets.each do |stylesheet|
FileUtils.cp stylesheet, '.', options
end

Dir[(@template_dir + "{js,images}/**/*").to_s].each do |path|
next if File.directory? path
Expand Down
5 changes: 5 additions & 0 deletions lib/rdoc/generator/template/darkfish/_head.rhtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
<title><%= h @title %></title>

<link type="text/css" media="screen" href="<%= asset_rel_prefix %>/rdoc.css" rel="stylesheet">
<% if @options.template_stylesheets.flatten.any? %>
<% @options.template_stylesheets.flatten.each do |stylesheet| %>
<link type="text/css" href="<%= asset_rel_prefix %>/<%= File.basename stylesheet %>" rel="stylesheet">
<% end %>
<% end %>

<script type="text/javascript">
var rdoc_rel_prefix = "<%= rel_prefix %>/";
Expand Down
14 changes: 14 additions & 0 deletions lib/rdoc/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,11 @@ class RDoc::Options

attr_accessor :template_dir

##
# Additional template stylesheets

attr_accessor :template_stylesheets

##
# Documentation title

Expand Down Expand Up @@ -345,6 +350,7 @@ def init_ivars # :nodoc:
@tab_width = 8
@template = nil
@template_dir = nil
@template_stylesheets = []
@title = nil
@update_output_dir = true
@verbosity = 1
Expand Down Expand Up @@ -873,6 +879,14 @@ def parse argv

opt.separator nil

opt.on("--template-stylesheets=FILES", PathArray,
"Set (or add to) the list of files to",
"include with the html template.") do |value|
@template_stylesheets << value
end

opt.separator nil

opt.on("--title=TITLE", "-t",
"Set TITLE as the title for HTML output.") do |value|
@title = value
Expand Down