File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -31,9 +31,13 @@ def site_page_files
3131 parseable_site_files . reject { |file | File . basename ( file ) . start_with? ( '_' ) }
3232 end
3333
34+ def content_for filename
35+ open ( "#{ site_dir } /#{ filename } " ) . read ( )
36+ end
37+
3438 def subpages_for filename
3539 links = [ ]
36- content = open ( " #{ site_dir } / #{ filename } " ) . read ( )
40+ content = content_for ( filename )
3741
3842 # (markdown) links of the form: [link text](link_page)
3943 content . scan /\[ .*?\] \( (.*?)\) / do |link , _ |
@@ -57,7 +61,7 @@ def subpages_for filename
5761 end
5862
5963 def next_step_for filename
60- content = open ( " #{ site_dir } / #{ filename } " ) . read ( )
64+ content = content_for ( filename )
6165
6266 # (stepfiles) links of the form: stepfile "next page"
6367 content . scan /next_step\s *["'](.*?)["']/ do |link , _ |
@@ -211,12 +215,11 @@ def toc_list toc_items, level = 0
211215 end
212216
213217 def has_collapsables toc_items
214- toc_items . each do |toc_item |
218+ toc_items . any? do |toc_item |
215219 if toc_item . instance_of? Array
216220 return true
217221 end
218222 end
219- return false
220223 end
221224
222225 def content
You can’t perform that action at this time.
0 commit comments