Skip to content

Commit 8bf33d8

Browse files
committed
Merge pull request #205 from zzak/options_template_stylesheets
Add RDoc::Options#template_stylesheets
2 parents 7ca0549 + 250aacc commit 8bf33d8

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

lib/rdoc/generator/darkfish.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ def write_style_sheet
196196
options = { :verbose => $DEBUG_RDOC, :noop => @dry_run }
197197

198198
FileUtils.cp @template_dir + 'rdoc.css', '.', options
199+
@options.template_stylesheets.each do |stylesheet|
200+
FileUtils.cp stylesheet, '.', options
201+
end
199202

200203
Dir[(@template_dir + "{js,images}/**/*").to_s].each do |path|
201204
next if File.directory? path

lib/rdoc/generator/template/darkfish/_head.rhtml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
<title><%= h @title %></title>
44

55
<link type="text/css" media="screen" href="<%= asset_rel_prefix %>/rdoc.css" rel="stylesheet">
6+
<% if @options.template_stylesheets.flatten.any? %>
7+
<% @options.template_stylesheets.flatten.each do |stylesheet| %>
8+
<link type="text/css" href="<%= asset_rel_prefix %>/<%= File.basename stylesheet %>" rel="stylesheet">
9+
<% end %>
10+
<% end %>
611

712
<script type="text/javascript">
813
var rdoc_rel_prefix = "<%= rel_prefix %>/";

lib/rdoc/options.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,11 @@ class RDoc::Options
292292

293293
attr_accessor :template_dir
294294

295+
##
296+
# Additional template stylesheets
297+
298+
attr_accessor :template_stylesheets
299+
295300
##
296301
# Documentation title
297302

@@ -350,6 +355,7 @@ def init_ivars # :nodoc:
350355
@tab_width = 8
351356
@template = nil
352357
@template_dir = nil
358+
@template_stylesheets = []
353359
@title = nil
354360
@update_output_dir = true
355361
@verbosity = 1
@@ -878,6 +884,14 @@ def parse argv
878884

879885
opt.separator nil
880886

887+
opt.on("--template-stylesheets=FILES", PathArray,
888+
"Set (or add to) the list of files to",
889+
"include with the html template.") do |value|
890+
@template_stylesheets << value
891+
end
892+
893+
opt.separator nil
894+
881895
opt.on("--title=TITLE", "-t",
882896
"Set TITLE as the title for HTML output.") do |value|
883897
@title = value

0 commit comments

Comments
 (0)