Support blocks that are the entire file

Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
Danila Fedorin 2024-05-22 16:50:45 -07:00
parent 5d0b903c03
commit f78f877e21

View File

@ -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