diff --git a/agda.rb b/agda.rb index b188cfa..c0dfcad 100644 --- a/agda.rb +++ b/agda.rb @@ -117,6 +117,12 @@ class Handler last_line = last_line_attr.to_s.to_i end + if first_line and last_line + line_range = first_line..last_line + else + line_range = 1.. + end + full_path = t.attribute("data-file-path").to_s full_path_dirs = Pathname(full_path).each_filename.to_a @@ -148,7 +154,7 @@ class Handler # of code output. We can iterate over these and match them up with # the line numbers we got from reading the Agda HTML output. lines = t.css("pre.chroma code[data-lang] .line") - lines.zip((first_line..last_line)).each do |line, line_no| + lines.zip(line_range).each do |line, line_no| line_info = agda_info[line_no] next unless line_info