File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -323,7 +323,7 @@ def generate_index
323
323
# suppress 1.9.3 warning
324
324
here . local_variable_set ( :asset_rel_prefix , asset_rel_prefix )
325
325
# some partials rely on the presence of current variable to render
326
- here . local_variable_set ( :current , @main_page ) if @main_page
326
+ here . local_variable_set ( :current , @main_page )
327
327
here
328
328
end
329
329
rescue => e
@@ -807,6 +807,17 @@ def excerpt(comment)
807
807
extracted_text [ 0 ...150 ] . gsub ( /\n / , " " ) . squeeze ( " " )
808
808
end
809
809
810
+ def generate_table_from_the_current_object ( current )
811
+ return '' if current . nil?
812
+ comment =
813
+ if current . respond_to? :comment_location then
814
+ current . comment_location
815
+ else
816
+ current . comment
817
+ end
818
+ current . parse ( comment ) . table_of_contents . dup
819
+ end
820
+
810
821
def generate_ancestor_list ( ancestors , klass )
811
822
return '' if ancestors . empty?
812
823
Original file line number Diff line number Diff line change 1
- <%- comment = if current.respond_to? :comment_location then
2
- current.comment_location
3
- else
4
- current.comment
5
- end
6
- table = current.parse(comment).table_of_contents.dup
7
-
8
- if table.length > 1 then %>
1
+ <%- table = generate_table_from_the_current_object(current) -%>
2
+ <%- if table.length > 1 %>
9
3
<div class ="nav-section ">
10
4
< h3 > Table of Contents</ h3 >
11
5
You can’t perform that action at this time.
0 commit comments