Skip to content

Commit 3e92cb7

Browse files
committed
Rename current local to target
1 parent f532990 commit 3e92cb7

File tree

4 files changed

+25
-31
lines changed

4 files changed

+25
-31
lines changed

lib/rdoc/generator/darkfish.rb

Lines changed: 21 additions & 27 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,18 +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 = generate_nesting_namespaces_breadcrumb(current, rel_prefix)
354+
breadcrumb = generate_nesting_namespaces_breadcrumb(target, rel_prefix)
357355

358356
@title = "#{klass.type} #{klass.full_name} - #{@options.title}"
359357

360358
debug_msg " rendering #{out_file}"
361359
render_template template_file, out_file do |io|
362360
here = binding
363-
# suppress 1.9.3 warning
364361
here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
365362
here.local_variable_set(:svninfo, svninfo)
363+
here.local_variable_set(:breadcrumb, breadcrumb)
366364
here
367365
end
368366
end
@@ -379,16 +377,16 @@ def generate_class_files
379377
return unless template_file.exist?
380378
debug_msg "Generating class documentation in #{@outputdir}"
381379

382-
current = nil
380+
target = nil
383381

384382
@classes.each do |klass|
385-
current = klass
383+
target = klass
386384

387385
generate_class klass, template_file
388386
end
389387
rescue => e
390388
error = RDoc::Error.new \
391-
"error generating #{current.path}: #{e.message} (#{e.class})"
389+
"error generating #{target.path}: #{e.message} (#{e.class})"
392390
error.set_backtrace e.backtrace
393391

394392
raise error
@@ -413,10 +411,10 @@ def generate_file_files
413411
debug_msg "Generating file documentation in #{@outputdir}"
414412

415413
out_file = nil
416-
current = nil
414+
target = nil
417415

418416
@files.each do |file|
419-
current = file
417+
target = file
420418

421419
if file.text? and page_file.exist? then
422420
generate_page file
@@ -449,9 +447,8 @@ def generate_file_files
449447

450448
render_template template_file, out_file do |io|
451449
here = binding
452-
# suppress 1.9.3 warning
453450
here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
454-
here.local_variable_set(:current, current)
451+
here.local_variable_set(:target, target)
455452
here
456453
end
457454
end
@@ -477,16 +474,15 @@ def generate_page file
477474
search_index_rel_prefix = rel_prefix
478475
search_index_rel_prefix += @asset_rel_path if @file_output
479476

480-
current = file
477+
target = file
481478
asset_rel_prefix = rel_prefix + @asset_rel_path
482479

483480
@title = "#{file.page_name} - #{@options.title}"
484481

485482
debug_msg " rendering #{out_file}"
486483
render_template template_file, out_file do |io|
487484
here = binding
488-
# suppress 1.9.3 warning
489-
here.local_variable_set(:current, current)
485+
here.local_variable_set(:target, target)
490486
here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
491487
here
492488
end
@@ -513,7 +509,6 @@ def generate_servlet_not_found message
513509

514510
render_template template_file do |io|
515511
here = binding
516-
# suppress 1.9.3 warning
517512
here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
518513
here
519514
end
@@ -574,7 +569,6 @@ def generate_table_of_contents
574569

575570
render_template template_file, out_file do |io|
576571
here = binding
577-
# suppress 1.9.3 warning
578572
here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
579573
here
580574
end
@@ -807,15 +801,15 @@ def excerpt(comment)
807801
extracted_text[0...150].gsub(/\n/, " ").squeeze(" ")
808802
end
809803

810-
def generate_table_from_the_current_object(current)
811-
return '' if current.nil?
804+
def generate_table_from_target(target)
805+
return '' if target.nil?
812806
comment =
813-
if current.respond_to? :comment_location then
814-
current.comment_location
807+
if target.respond_to? :comment_location then
808+
target.comment_location
815809
else
816-
current.comment
810+
target.comment
817811
end
818-
current.parse(comment).table_of_contents.dup
812+
target.parse(comment).table_of_contents.dup
819813
end
820814

821815
def generate_ancestor_list(ancestors, klass)
@@ -882,10 +876,10 @@ def generate_sidebar_link(name, path, rel_prefix)
882876
%(<a href="#{rel_prefix}/#{path}">#{name}</a>)
883877
end
884878

885-
def generate_pages_index_content(page_files, rel_prefix, current)
879+
def generate_pages_index_content(page_files, rel_prefix, target)
886880
return '' if page_files.empty?
887881

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

891885
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)