when i use atom-beautify for Django Templates code
<link rel="stylesheet" href="{% static "css/lightbox.css" %}">
add space between static ""
<link rel="stylesheet" href="{% static " css/lightbox.css " %}">
The beautified code should have looked like:
<link rel="stylesheet" href="{% static "css/lightbox.css" %}">
Atom Beautify: Beautify EditorHere is a link to the debug.md Gist:
debug.md Gist to this issueI need you to generate Atom Beautify's debug.md file and paste it to a gist. The defect is most likely in Pretty Diff and most likely related to the nested quotes... but I want to be certain.
In the mean time you can immediately solve this problem by converting those two middle double quotes to single quotes.
I just enhanced Pretty Diff's markup parser to support this on its branch 2.1.3. I would still like the debug.md file in case you are not using Pretty Diff as your beautifier.
https://gist.github.com/anonymous/b093db8dd10a6b8d4cfa01801b3eea6f
HI this is debug.md thanks
Awesome. Opening an issue with JSBeautify.
Closing this as a third-party bug.
Updated today and still seeing this issue. Using better syntax fixed the parsing issue as recommended above.
@spaceneenja which grammars worked and which did not work for you? We could change Atom-Beautify's default beautifiers for Django.
Sure, I changed:
<a href="{% url "order" %}">
<link type='text/less' rel="stylesheet" href="{% static "less/header.less" %}">
To:
<a href="{% url 'order' %}">
<link type='text/less' rel="stylesheet" href="{% static 'less/header.less' %}">
Now it works just fine!
Oh, so this isn't a bug? Just need to not use double-quotes (e.g. ") within double-quotes? Awesome! 馃憤
Exactly. It is valid Django syntax however, so I suppose beautify shouldn't mess with it.
Beautify adds a space before and after each item in the second quotes.
<a href="{% url " order " %}">
Updating someone's dirty old code however was a quick and easy fix and seems so obvious now.
Awesome package btw!
Most helpful comment
In the mean time you can immediately solve this problem by converting those two middle double quotes to single quotes.