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

Leading/Trailing Whitespace #156

Closed
azuby opened this issue May 15, 2014 · 6 comments
Closed

Leading/Trailing Whitespace #156

azuby opened this issue May 15, 2014 · 6 comments

Comments

@azuby
Copy link

azuby commented May 15, 2014

I'm trying to make Twitter Bootstrap Dropdown, which requires a space between the bound button label and the .caret class to look right, and I can't figure out a way to do this in emblem. In slim, I would use either a leading space on the caret or a trailing space on the html ouptut:

.dropdown
    a.btn.btn-default.dropdown-toggle href="#" data-toggle="dropdown"
        => timePeriodLabel
        span.caret

Here are the respective links to the slim documentation:
https://github.com/slim-template/slim#trailing-and-leading-whitespace--
https://github.com/slim-template/slim#output-

The only thing I could find in Emblem was the legacy slim trailing space notation in the "Plain Text" section here: http://emblemjs.com/syntax/

I have tried the following: =>, =<, =', span.caret>, span.caret<

@bj-mcduck
Copy link

+1

@typeoneerror
Copy link

+1

Only way I've been able to achieve this is like so:

.page-header
  h1
    = name
    '
    small = slug

The ' with a blank line forces a space b/t elements. Gross, but works.

@wmlele
Copy link

wmlele commented Sep 25, 2014

+1

I am finding a lot of issues that seem to be related to the fact that emblem doesn't mimic the behaviour of inserting a whitespace on new lines. Is there a fundamental issue that prevents it?

So what about this: any workaround that doesn't leave an extra space in some cases and isn't ugly?

h1
  = if something
    = name
  `
  = if somethingelse
    = another_thing 

@bj-mcduck
Copy link

An extra space sometimes? You can get around a lot of this by using the | and ' characters.

They preserve the white-spaces so:

' Stufff I want before and leaves a space after
= some_output
|  this text has two spaces instead of just one, so it has a space before it now.

The above works, but it'd be nice to have the =< and => abilities or something like it.

@bj-mcduck
Copy link

looks like #132 is a good one for a feature request.

As this is more a question about how to do spacing, rather than a feature request this could be closed.

@wmlele
Copy link

wmlele commented Sep 26, 2014

What I meant is a way to add a space after the element when it is actually followed by another element at the same level (and not if it is the last element in the container), reproducing how newlines between elements are rendered as a whitespace in html and plain handlebars.
I don't use slim, but haml does the right thing most of the times, and I rarely had to force whitespace.

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

4 participants