Code formatting + Line continuation in Slim
Asked Answered
K

2

6

I've been learning Slim lately and I was wondering if there's a way to format or beautify my code in it. I have been wary of using newlines(pressing Enter) because it causes errors.

The reason I want to format it is because most of my code can't fit the single line of my text editor and what usually happens is that it continues to the next line, which usually ends up to be unreadable for me.

This is usually in just one line:
li #{author.first_name} #{author.last_name} <a href="/">View</a><a href="/">Edit</a><a href="/">Delete</a>

Is there a way or a character to denote a line continuation? I want the links to used the next line so that it would be more readable for me.

Kibosh answered 21/3, 2013 at 3:57 Comment(0)
G
9

You can also use an attributes wrapper to span multiple lines

div[id="#my-id"
  class="my-class" 
  data-author="George Washington"
  data-date="2013-08-21"]
Griefstricken answered 22/8, 2013 at 4:30 Comment(1)
Here's the correct link to attributes wrapperAilment
M
4

Your example can been broken into smaller parts:

li
  =#{author.first_name} #{author.last_name}
    a href="/" View
    a href="/" Edit
    a href="/" Delete
Meares answered 23/3, 2013 at 15:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.