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

Indentation with tabs does not work #16

Closed
syxolk opened this issue May 21, 2017 · 4 comments
Closed

Indentation with tabs does not work #16

syxolk opened this issue May 21, 2017 · 4 comments

Comments

@syxolk
Copy link
Collaborator

syxolk commented May 21, 2017

Indentation with tabs does not seem work.

This indentex file:

# a:
	# b:
		c

is transpiled to this:

\begin{a}
	# b:
		c
\end{a}

Update: Indentation with a single space works perfectly:

# a:
 # b:
  c

->

\begin{a}
 \begin{b}
  c
 \end{b}
\end{a}
@mp4096
Copy link
Owner

mp4096 commented May 21, 2017

Concerning tabs, the short answer: This is intended behaviour. Tabs are not allowed in indentex.

The long answer: I think that enforcing hard tabs was one of golang's wisest design choices (for the record, I abhor hard tabs). Compare this to Python: PEP8 suggests using soft tabs, so everybody would do this, right? Well, no:

I used to work for Yelp. For historical reasons — probably “the initial developers preferred it” — their mostly-Python codebase had always been indented with tabs.

Hence, I decided to allow only soft tabs in indentex so that everybody's on the same page. Indentex source files must be indented using soft tabs, preferably two characters wide.

There is a further aspect to it, however. Indentex cannot detect mixed tabs and spaces. This can lead to very subtle and nasty edge cases. E.g. a user has configured tabs to be two chars wide and has accidentally written this:

# equation:
····a
»··b

This would be transpiled to

\begin{equation}
····a
\end{equation}
»··b

although visually there is no dedent after a.


As for the indentation with a single space being valid: It's another story. Maybe it might be better to require at least two whitespace chars for a valid indentation. I have to sleep on it.

@mp4096 mp4096 added the wontfix label May 21, 2017
@syxolk
Copy link
Collaborator Author

syxolk commented May 22, 2017

Ok, can we consider this as another silently ignored edge case #8 that could be fixed together with #9 ?

@mp4096
Copy link
Owner

mp4096 commented May 22, 2017

What exactly, tabs or single-space indentation?

Probably it's a good idea to generate transpilation errors for both of them!

@mp4096
Copy link
Owner

mp4096 commented May 24, 2017

Superseded by #24 and #25

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

No branches or pull requests

2 participants