Created
August 15, 2016 03:24
-
-
Save kmuto/80650cd2afb40dcdab6ac3d078859e80 to your computer and use it in GitHub Desktop.
怠惰なCSSチェッカー
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# coding: utf-8 | |
# Lazy AutoLayout CSS Checker | |
# Copyright 2016 Kenshi Muto | |
# MIT License | |
lno = 0 | |
ARGF.each do |l| | |
lno += 1 | |
l.chomp! | |
if l =~ /-@-[^\s]+/ | |
puts "#{lno}: #{$&} : @-にすべきでは" | |
elsif l =~ /\s+epub[^:]+/ || l =~ /\Aepub[^:]+/ | |
puts "#{lno}: #{$&} : 「-」から始まるべきでは" | |
elsif l =~ /@\-epubx\-(.+)\s*:/ | |
sub = $1 | |
puts "#{lno}: @-epubx-#{sub} : 存在しないパラメータ" unless | |
%w(page-template when define viewport region page-master partition partition-group flow page-template).include?(sub) | |
elsif l =~ /\-epub\-(.+)\s*:/ | |
sub = $1 | |
puts "#{lno}: -epub-#{sub} : 存在しないパラメータ。-epubxの誤り?" unless | |
%w(hyphens transform transform-origin writing-mode).include?(sub) | |
elsif l =~ /\-epubx\-(.+)\s*:/ | |
sub = $1 | |
puts "#{lno}: -epubx-#{sub} : 存在しないパラメータ。-epubの誤り?" unless | |
%w(flow-into flow-options flow-consume flow-linger flow-property flow-from expr shape-inside shape-outside wrap-flow page utilization enabled min-page-height min-page-width snap-height snap-width required required-partitions conflicting-partitions text-zoom).include?(sub) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment