Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid indentation. Jade template

I know i can use tabs or spaces but not both. But i could not find where is the invalid indentation. Tried different variation. But I did not succeed. I got and exception after added

- if (error)
p= error

So my code is shown below:

!!!
html
head
    title= title
    link(rel='stylesheet', href='/stylesheets/#{stylesheet}.css')
    link(rel='stylesheet', href='/stylesheets/bootstrap.min.css')
body
    .container
        .row
            .col-md-4
            .col-md-4
                .well
                    - if (error)
                        p= error
                    form(role='form',action='sessions', method='post')
                        .form-group
                            label(for='Email') Eposta Adresi
                            input#Email.form-control(type='email',name='user[email]',placeholder='E-posta adresi')
                        .form-group
                            label(for='Password') Şifre
                            input#Password.form-control(type='password',name='user[password]', placeholder='Şifre')
                        button.btn.btn-default(type='submit') Giriş

    script(type='text/javascript', src='/javascripts/jquery-1.10.2.min.js')
    script(type='text/javascript', src='/javascripts/bootstrap.min.js')

Full Exception:

12| .well
13| - if (error)
> 14| p= error
15| form(role='form',action='sessions', method='post')
16| .form-group
17| label(for='Email') Eposta Adresi
Invalid indentation, you can use tabs or spaces but not both
at Object.Lexer.indent (C:\Nodejs\NodejsBlog\node_modules\jade\lib\lexer.js:691:15)
at Object.Lexer.next (C:\Nodejs\NodejsBlog\node_modules\jade\lib\lexer.js:789:15)
at Object.Lexer.lookahead (C:\Nodejs\NodejsBlog\node_modules\jade\lib\lexer.js:122:46)
at Object.Parser.lookahead     (C:\Nodejs\NodejsBlog\node_modules\jade\lib\parser.js:116:23)
at Object.Parser.parseCode   (C:\Nodejs\NodejsBlog\node_modules\jade\lib\parser.js:311:17)
at Object.Parser.parseExpr (C:\Nodejs\NodejsBlog\node_modules\jade\lib\parser.js:225:21)
at Object.Parser.block (C:\Nodejs\NodejsBlog\node_modules\jade\lib\parser.js:593:25)
at Object.Parser.tag (C:\Nodejs\NodejsBlog\node_modules\jade\lib\parser.js:722:26)
at Object.Parser.parseTag (C:\Nodejs\NodejsBlog\node_modules\jade\lib\parser.js:625:17)
at Object.Parser.parseExpr (C:\Nodejs\NodejsBlog\node_modules\jade\lib\parser.js:199:21)

Need advise.

like image 811
ftdeveloper Avatar asked Feb 13 '26 22:02

ftdeveloper


1 Answers

This is what vim shows me with :set list:

▸ ▸ ▸ ▸ .col-md-4¬
▸ ▸ ▸ ▸ .col-md-4¬
▸ ▸ ▸ ▸ ▸ .well¬
▸ ▸ ▸ ▸ ▸ ▸ - if (error)¬
    ▸ ▸ ▸ ▸ ▸   ▸ p= error¬
▸ ▸ ▸ ▸ ▸ ▸ form(role='form',action='sessions', method='post')¬

(the triangles are tabs)

So you are mixing tabs and spaces on the offending line.

like image 135
robertklep Avatar answered Feb 16 '26 20:02

robertklep



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!