Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spurious invalid indentation exception #50

Closed
hlship opened this issue Aug 2, 2013 · 5 comments
Closed

Spurious invalid indentation exception #50

hlship opened this issue Aug 2, 2013 · 5 comments

Comments

@hlship
Copy link

hlship commented Aug 2, 2013

When compiling the following template:

.sidebar-placeholder
    h1 Sidebar Empty
    p.lead
      | The sidebar is used when selecting certain objects or operations
      | in the main user interface. It will open when needed,
      | and can be closed using the
      button
        i.icon-chevron-left
      |  button.

which is (I believe) valid; I get an "invalid indentation" exception on line 4.

I've pasted the same text into http://naltatis.github.io/jade-syntax-docs/ and it generates my expected HTML output.

@naltatis
Copy link
Member

naltatis commented Aug 2, 2013

Are you indenting with tabs or spaces?
jade4j is a bit stricter with indentation than jade.js.
If the first indentation you use are two spaces, you have to use two spaces in the complete file.

@hlship
Copy link
Author

hlship commented Aug 2, 2013

I'm indenting with two spaces.

@hlship
Copy link
Author

hlship commented Aug 2, 2013

$ find ../../client/ -name \*.jade | xargs od -a
0000000    .   s   i   d   e   b   a   r   -   p   l   a   c   e   h   o
0000020    l   d   e   r  nl  sp  sp  sp  sp   h   1  sp   S   i   d   e
0000040    b   a   r  sp   E   m   p   t   y  nl  sp  sp  sp  sp   p   .
0000060    l   e   a   d  nl  sp  sp  sp  sp  sp  sp   |  sp   T   h   e
0000100   sp   s   i   d   e   b   a   r  sp   i   s  sp   u   s   e   d
0000120   sp   w   h   e   n  sp   s   e   l   e   c   t   i   n   g  sp
0000140    c   e   r   t   a   i   n  sp   o   b   j   e   c   t   s  sp
0000160    o   r  sp   o   p   e   r   a   t   i   o   n   s  nl  sp  sp
0000200   sp  sp  sp  sp   |  sp   i   n  sp   t   h   e  sp   m   a   i
0000220    n  sp   u   s   e   r  sp   i   n   t   e   r   f   a   c   e
0000240    .  sp   I   t  sp   w   i   l   l  sp   o   p   e   n  sp   w
0000260    h   e   n  sp   n   e   e   d   e   d   ,  nl  sp  sp  sp  sp
0000300   sp  sp   |  sp   a   n   d  sp   c   a   n  sp   b   e  sp   c
0000320    l   o   s   e   d  sp   u   s   i   n   g  sp   t   h   e  nl
0000340   sp  sp  sp  sp  sp  sp   b   u   t   t   o   n   :  sp   i   .
0000360    i   c   o   n   -   c   h   e   v   r   o   n   -   l   e   f
0000400    t  nl  sp  sp  sp  sp  sp  sp   |  sp  sp   b   u   t   t   o
0000420    n   .  nl  sp  sp  sp  sp   .   s   i   d   e   b   a   r   (
0000440    n   g   -   c   l   a   s   s   =   "   {  sp   o   p   e   n
0000460    :  sp   o   p   e   n  sp   }   "   )  nl  sp  sp   .   t   h
0000500    u   m   b   -   c   o   l   u   m   n   (   t   o   o   l   t
0000520    i   p   -   p   l   a   c   e   m   e   n   t   =   "   l   e
0000540    f   t   "   ,  sp   t   o   o   l   t   i   p   =   "   C   l
0000560    i   c   k  sp   t   o  sp   h   i   d   e   /   s   h   o   w
0000600    "   ,  sp   n   g   -   c   l   i   c   k   =   "   t   o   g
0000620    g   l   e   O   p   e   n   (   )   "   )  nl  sp  sp  sp  sp
0000640    .   t   h   u   m   b   .   b   t   n  nl  sp  sp  sp  sp  sp
0000660   sp   i   (   n   g   -   c   l   a   s   s   =   "   {   '   i
0000700    c   o   n   -   c   h   e   v   r   o   n   -   l   e   f   t
0000720    '   :  sp   o   p   e   n   ,  sp   '   i   c   o   n   -   c
0000740    h   e   v   r   o   n   -   r   i   g   h   t   '   :  sp   !
0000760    o   p   e   n   }   "   )  nl  sp  sp   .   c   o   n   t   e
0001000    n   t  nl
0001003

Are you developing on Windows or Mac/Linux? I'm wondering if there's a line-ending issue confusing the parser. I'm on Mac, so each line ends with a \n character.

@hlship
Copy link
Author

hlship commented Aug 2, 2013

Ok, I can see it now; at some point I indented with 4 spaces (the h1) and then tried to use 2 space indentation for the contents of the p element. I'm able to make progress now, so that's cool.

@hlship
Copy link
Author

hlship commented Aug 2, 2013

At the very least, I'd love to see a more useful error message to help me diagnose this, i.e., "expected 4 spaces, saw 2 spaces" or something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants