Skip to content

Commit

Permalink
Add file destination to the document
Browse files Browse the repository at this point in the history
  • Loading branch information
caleywoods committed May 15, 2024
1 parent 3861844 commit 25d4328
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions _plugins/pa11y.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# @param differ [Object, #changed_files] The collaborator which lists
# the files that were changed in the last commit.
# @todo Are there cases when the document being checked has no layout?
Document = Struct.new(:path, :layout, :differ) do
Document = Struct.new(:path, :layout, :destination, :differ) do
# @return [Boolean] Whether to scan this document in pa11y-ci
def to_scan?
source_changed? || layout_changed?
Expand Down Expand Up @@ -81,12 +81,13 @@ def check_file_for_changes
document = Document.new(
file.relative_path,
file.data["layout"],
file.destination(NO_ROOT_PATH),
differ
)

if document.to_scan?
File.open(pa11y_target_file, 'a') { |f|
f.write(file.destination(NO_ROOT_PATH) + "\n")
f.write(document.destination + "\n")
}
end
end
Expand Down

0 comments on commit 25d4328

Please sign in to comment.