準備
brew install tidy-html5
手順
cp show.slim show.pug
vi show.pug # correct syntax manually
slimrb -o sort_attrs=true _show.slim | tidy -q -config ~/config.txt - > slim.html
pug -o . _show.pug && tidy -q -config ~/config.txt _show.html > pug.html
# check checksum
md5 -r slim.html show.html
テンプレートにhtmlに無いタグが入っているとエラーになるので new-blocklevel-tags
に追加する。
揉めてたけど追加するしかない。Support custom elements · Issue #119 · htacg/tidy-html5
// sample config file for HTML tidy
indent: auto
doctype: html5
indent-spaces: 2
drop-empty-elements: no
wrap: 1024
markup: yes
sort-attributes: alpha
output-xml: no
input-xml: no
show-warnings: yes
numeric-entities: yes
quote-marks: yes
quote-nbsp: yes
quote-ampersand: no
break-before-br: no
uppercase-tags: no
uppercase-attributes: no
char-encoding: latin1
new-inline-tags: cfif, cfelse, math, mroot,
mrow, mi, mn, mo, msqrt, mfrac, msubsup, munderover,
munder, mover, mmultiscripts, msup, msub, mtext,
mprescripts, mtable, mtr, mtd, mth
new-blocklevel-tags: cfoutput, cfquery,
offer-list-item,
loading-indicator
new-empty-tags: cfelse