多个语法错误 haml 无法定位结束语句

Multiple Syntax Errors haml cant locate end statement

我是 haml 的新手 我试图让 haml 到 erb 的注册表显示 3 个结束语句中的 2 个。我理解它的询问结束语句,它在 haml 中不存在,我不知道如何打算将这些位置的结束语句放在一起。

reg.html.haml:13: syntax error, unexpected end-of-input, expecting keyword_end
reg.html.haml:28: syntax error, unexpected end-of-input, expecting keyword_end
reg.html.haml:31: syntax error, unexpected end-of-input, expecting keyword_end

    %h1 Registration

    = form_for :article, url:articles_path do |f|


        - if @article.errors.any?
            #error_explanation
                %h3
                    = pluralized(@articles.error.count, "Error")
                    prohibited this article from being saved:
                %ul
                    %li= @article.errors.full_messages.each do |msg|
                    %li= msg


        %p
            = f.label :username
            = f.text_field :username
        %p
            = f.label :password
            = f.password_field :password
        %p
            = f.label :email
            = f.text_field :email
        %p
            = f.label :address
            = f.text_area :address
        %p
            = f.submit
    %p
        = link_to 'Back', articles_path
        = link_to 'Home', controller: 'welcome'

试试这个

%h1 Registration
= form_for :article, url:articles_path do |f|
    - if @article.errors.any?
        #error_explanation
            %h3
                = pluralized(@articles.error.count, "Error")
                prohibited this article from being saved
            %ul
                - @article.errors.full_messages.each do |msg|
                    %li= msg
    %p
        = f.label :username
        = f.text_field :username
    %p
        = f.label :password
        = f.password_field :password
    %p
        = f.label :email
        = f.text_field :email
    %p
        = f.label :address
        = f.text_area :address
    %p
        = f.submit
%p
    = link_to 'Back', articles_path
    = link_to 'Home', controller: 'welcome'