ITADN

swap_attributes not working

#846Closedandreadellacorte 创建于 2024-08-12
Hi, I am running html proofer as follows ``` %w[ ./test.html ].each do |file| # See https://github.com/gjtorikian/html-proofer?tab=readme-ov-file#configuration HTMLProofer.check_file( file, { allow_missing_href: true, disable_external: true, checks: ["Links", "Images"], ignore_urls: [%r{/docs}, %r{/customer-portal}, %r{/resume-submission}], root_dir: "_site", swap_attributes: { "img": ["data-src", "src"] } } ).run end ``` (note: `swap_attributes: { "img": [["data-src", "src"]] }` doesn't work either)) on this file ``` <html> <body> <p>Blah blah blah. <img alt="An http image" data-src="gpl.png" /></p> </body> </html> ``` and getting ``` For the Images check, the following failures were found: * At ./test.html:3: image has no src or srcset attribute ``` Is my syntax wrong? I copied the command and test from the repo itself.
关闭于 2024-08-19 3 条评论