Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
# coding: utf-8
require 'rexml/document'
include REXML
doc = Document.new(ARGF)
doc.context[:attribute_quote] = :quote
# 親spanを追加するには%w()内に空白区切りで指定
%w(bold).each do |style|
doc.each_element("//span[@class='#{style}']") do |e|
@kmuto
kmuto / lazy-epub-csscheck.rb
Created August 15, 2016 03:24
怠惰なCSSチェッカー
#!/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]+/