From f78f877e212f7b0acab6319430213aa56029280d Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Wed, 22 May 2024 16:50:45 -0700 Subject: [PATCH] Support blocks that are the entire file Signed-off-by: Danila Fedorin --- agda.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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