3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

.slimを.pugに変換したあとでhtmlを確認する

Posted at

準備

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
3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?