Hatena::ブログ(Diary)

C++でゲームプログラミング

2014-06-16

[]haml でシンタックスチェックを行う

haml でシンタックスチェックを行う場合、--check と -trach オプションを付けて実行します。


$ haml --check --trach index.html.haml
index.html.haml:23: Unbalanced brackets. (Haml::SyntaxError)
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/haml-4.0.5/lib/haml/parser.rb:747:in `balance'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/haml-4.0.5/lib/haml/parser.rb:570:in `parse_old_attributes'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/haml-4.0.5/lib/haml/parser.rb:535:in `parse_tag'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/haml-4.0.5/lib/haml/parser.rb:332:in `tag'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/haml-4.0.5/lib/haml/parser.rb:213:in `process_line'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/haml-4.0.5/lib/haml/parser.rb:121:in `parse'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/haml-4.0.5/lib/haml/engine.rb:66:in `initialize'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/haml-4.0.5/lib/haml/exec.rb:297:in `new'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/haml-4.0.5/lib/haml/exec.rb:297:in `process_result'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/haml-4.0.5/lib/haml/exec.rb:43:in `parse'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/haml-4.0.5/lib/haml/exec.rb:23:in `parse!'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/haml-4.0.5/bin/haml:9:in `<top (required)>'
    from C:/Ruby200/bin/haml:23:in `load'
    from C:/Ruby200/bin/haml:23:in `<main>'

こんな感じで出力されます。

あとこれを利用して watchdogs.vim にも haml のシンタックスチェックを追加した。