Skip to content

Commit 8c89756

Browse files
committed
Rename current local to target
1 parent 6de02eb commit 8c89756

File tree

4 files changed

+25
-32
lines changed

4 files changed

+25
-32
lines changed

lib/rdoc/generator/darkfish.rb

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,8 @@ def generate_index
320320

321321
render_template template_file, out_file do |io|
322322
here = binding
323-
# suppress 1.9.3 warning
324323
here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
325-
# some partials rely on the presence of current variable to render
326-
here.local_variable_set(:current, @main_page)
324+
here.local_variable_set(:target, @main_page)
327325
here
328326
end
329327
rescue => e
@@ -340,7 +338,7 @@ def generate_index
340338
def generate_class klass, template_file = nil
341339
setup
342340

343-
current = klass
341+
target = klass
344342

345343
template_file ||= @template_dir + 'class.rhtml'
346344

@@ -351,19 +349,18 @@ def generate_class klass, template_file = nil
351349
search_index_rel_prefix += @asset_rel_path if @file_output
352350

353351
asset_rel_prefix = rel_prefix + @asset_rel_path
354-
svninfo = get_svninfo(current)
352+
svninfo = get_svninfo(target)
355353

356-
breadcrumb = # used in templates
357-
breadcrumb = generate_nesting_namespaces_breadcrumb(current, rel_prefix)
354+
breadcrumb = generate_nesting_namespaces_breadcrumb(target, rel_prefix)
358355

359356
@title = "#{klass.type} #{klass.full_name} - #{@options.title}"
360357

361358
debug_msg " rendering #{out_file}"
362359
render_template template_file, out_file do |io|
363360
here = binding
364-
# suppress 1.9.3 warning
365361
here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
366362
here.local_variable_set(:svninfo, svninfo)
363+
here.local_variable_set(:breadcrumb, breadcrumb)
367364
here
368365
end
369366
end
@@ -380,16 +377,16 @@ def generate_class_files
380377
return unless template_file.exist?
381378
debug_msg "Generating class documentation in #{@outputdir}"
382379

383-
current = nil
380+
target = nil
384381

385382
@classes.each do |klass|
386-
current = klass
383+
target = klass
387384

388385
generate_class klass, template_file
389386
end
390387
rescue => e
391388
error = RDoc::Error.new \
392-
"error generating #{current.path}: #{e.message} (#{e.class})"
389+
"error generating #{target.path}: #{e.message} (#{e.class})"
393390
error.set_backtrace e.backtrace
394391

395392
raise error
@@ -414,10 +411,10 @@ def generate_file_files
414411
debug_msg "Generating file documentation in #{@outputdir}"
415412

416413
out_file = nil
417-
current = nil
414+
target = nil
418415

419416
@files.each do |file|
420-
current = file
417+
target = file
421418

422419
if file.text? and page_file.exist? then
423420
generate_page file
@@ -450,9 +447,8 @@ def generate_file_files
450447

451448
render_template template_file, out_file do |io|
452449
here = binding
453-
# suppress 1.9.3 warning
454450
here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
455-
here.local_variable_set(:current, current)
451+
here.local_variable_set(:target, target)
456452
here
457453
end
458454
end
@@ -478,16 +474,15 @@ def generate_page file
478474
search_index_rel_prefix = rel_prefix
479475
search_index_rel_prefix += @asset_rel_path if @file_output
480476

481-
current = file
477+
target = file
482478
asset_rel_prefix = rel_prefix + @asset_rel_path
483479

484480
@title = "#{file.page_name} - #{@options.title}"
485481

486482
debug_msg " rendering #{out_file}"
487483
render_template template_file, out_file do |io|
488484
here = binding
489-
# suppress 1.9.3 warning
490-
here.local_variable_set(:current, current)
485+
here.local_variable_set(:target, target)
491486
here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
492487
here
493488
end
@@ -514,7 +509,6 @@ def generate_servlet_not_found message
514509

515510
render_template template_file do |io|
516511
here = binding
517-
# suppress 1.9.3 warning
518512
here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
519513
here
520514
end
@@ -575,7 +569,6 @@ def generate_table_of_contents
575569

576570
render_template template_file, out_file do |io|
577571
here = binding
578-
# suppress 1.9.3 warning
579572
here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
580573
here
581574
end
@@ -808,15 +801,15 @@ def excerpt(comment)
808801
extracted_text[0...150].gsub(/\n/, " ").squeeze(" ")
809802
end
810803

811-
def generate_table_from_the_current_object(current)
812-
return '' if current.nil?
804+
def generate_table_from_target(target)
805+
return '' if target.nil?
813806
comment =
814-
if current.respond_to? :comment_location then
815-
current.comment_location
807+
if target.respond_to? :comment_location then
808+
target.comment_location
816809
else
817-
current.comment
810+
target.comment
818811
end
819-
current.parse(comment).table_of_contents.dup
812+
target.parse(comment).table_of_contents.dup
820813
end
821814

822815
def generate_ancestor_list(ancestors, klass)
@@ -883,10 +876,10 @@ def generate_sidebar_link(name, path, rel_prefix)
883876
%(<a href="#{rel_prefix}/#{path}">#{name}</a>)
884877
end
885878

886-
def generate_pages_index_content(page_files, rel_prefix, current)
879+
def generate_pages_index_content(page_files, rel_prefix, target)
887880
return '' if page_files.empty?
888881

889-
dir = current&.full_name&.[](/\A[^\/]+(?=\/)/) || current&.page_name
882+
dir = target&.full_name&.[](/\A[^\/]+(?=\/)/) || target&.page_name
890883
grouped_files = page_files.group_by { |f| f.full_name[/\A[^\/]+(?=\/)/] || f.page_name }
891884

892885
traverse_tree(grouped_files) do |name, files|

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
<div id="fileindex-section" class="nav-section">
33
<h3>Pages</h3>
44

5-
<%= generate_pages_index_content(@page_files, rel_prefix, current) %>
5+
<%= generate_pages_index_content(@page_files, rel_prefix, target) %>
66
</div>
77
<%- end -%>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<%- table = generate_table_from_the_current_object(current) -%>
1+
<%- table = generate_table_from_target(target) -%>
22
<%- if table.length > 1 %>
33
<div class="nav-section">
44
<h3>Table of Contents</h3>
55

66
<%- display_link = proc do |heading| -%>
7-
<a href="#<%= heading.label current %>"><%= heading.plain_html %></a>
7+
<a href="#<%= heading.label target %>"><%= heading.plain_html %></a>
88
<%- end -%>
99

1010
<%- list_siblings = proc do -%>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<%= render '_sidebar_search.rhtml' %>
88
</div>
99

10-
<%= render '_sidebar_table_of_contents.rhtml' if defined?(current) %>
10+
<%= render '_sidebar_table_of_contents.rhtml' %>
1111
<%= render '_sidebar_pages.rhtml' %>
1212
<%= render '_sidebar_classes.rhtml' %>
1313

0 commit comments

Comments
 (0)