10 Star 49 Fork 25

Gitee 极速下载/openPLC

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/openplcproject/openplcproject.github.io
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Rakefile 1.69 KB
一键复制 编辑 原始数据 按行查看 历史
Garret Fick 提交于 2021-12-11 13:38 . Fix typo in the Rakefile
require 'nokogiri'
task :checkhtml do
sh "bundle exec jekyll build"
num_with_errors = 0
last_error = ""
files = Dir['_site/**/*.html']
for file_name in files do
file = File.open(file_name).read
# Max errors is default to nil, which returns 0 error. This just
# needs any positive number of which 10 satisfies the conditions
begin
doc = Nokogiri::HTML5(file, max_errors: 10)
if doc.errors.length > 0
puts("Error: " + file_name + "\n")
doc.errors.each do |err|
puts(err)
last_error = err
end
num_with_errors += 1
else
puts("OK: " + file_name + "\n")
end
rescue => ex
puts("Error: " + file_name + "\n")
puts(ex)
num_with_errors += 1
end
end
if num_with_errors > 0
puts("Num files with errors:" + num_with_errors.to_s + "\n")
raise "One or more files contains an error. Last error: " + last_error
end
end
task :spellcheck do
sh "bundle exec jekyll build"
sh "aspell --lang=en create master ./aspell-dict.rws < ./aspell-dict.txt"
num_with_errors = 0
last_error = ""
files = Dir['_site/**/*.html']
for file_name in files do
misspelled = `cat #{file_name} | aspell --list -H --html-skip=script --add-html-skip=style --add-html-skip=pre --add-html-skip=code --extra-dicts=./aspell-dict.rws | sed '/^$/d'`
if misspelled.length > 0
puts("Error: " + file_name + " words: " + misspelled)
num_with_errors += 1
else
puts("OK: " + file_name)
end
end
if num_with_errors > 0
puts("Num files with errors:" + num_with_errors.to_s + "\n")
raise "One or more files contains an misspelling. Add false positives to aspell-dict.txt"
end
end
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Ruby
1
https://gitee.com/mirrors/openPLC.git
git@gitee.com:mirrors/openPLC.git
mirrors
openPLC
openPLC
master

搜索帮助