Skip to content

Commit

Permalink
fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
tycooon committed Dec 25, 2023
1 parent 519e2ac commit 54879bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lib/simplecov-html.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ def assets_path(name)
File.join("./assets", SimpleCov::Formatter::HTMLFormatter::VERSION, name)
end

def to_id(value)
value.gsub(/^[^a-zA-Z]+/, "").gsub(/[^a-zA-Z0-9\-_]/, "")
end

def asset_inline(name)
path = File.join(@public_assets_dir, name)

Expand All @@ -119,7 +123,6 @@ def formatted_source_file(source_file)

# Returns a table containing the given source files
def formatted_file_list(title, source_files)
title_id = title.gsub(/^[^a-zA-Z]+/, "").gsub(/[^a-zA-Z0-9\-_]/, "")
template("file_list").result(binding)
end

Expand Down
4 changes: 2 additions & 2 deletions views/file_list.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="file_list_container" id="<%= title_id %>">
<div class="file_list_container" id="<%= to_id(title) %>">
<h2>
<span class="group_name"><%= title %></span>
(<span class="covered_percent">
Expand All @@ -13,7 +13,7 @@
)
</h2>

<a name="<%= title_id %>"></a>
<a name="<%= to_id(title) %>"></a>

<div>
<b><%= source_files.length %></b> files in total.
Expand Down

0 comments on commit 54879bd

Please sign in to comment.