In dealing with a bunch of crufty Django template files, I want to indent them.
The files contain:
Surely there is a tool to do this. Most of the tools do silly things when facing unexpected characters. Which one works?
To clarify, what properly indents this code?
{% extends 'layout.html' %}
{% if admin %}
<style type="text/css">
body {
color: purple;
background-color: #d8da3d }
</style>
<p><b>ADMIN SCREEN</b></p>
{% endif %}
<script>
set_active_tab("Welcome");
if (first_time()) { turn_on_highlights(); }
</script>
<table><tr><td>a</td></tr><tr><td>b</td></tr></table>
I've tried various tools, including the Universal Indent GUI, without success.
Yes you will definitely need to know HTML and CSS. Django will take care of the 'back-end' which is basically the programming logic (user sign ins, database connection, page routing) where as HTML and CSS render the information to the user.
The template tags are a way of telling Django that here comes something else than plain HTML. The template tags allows us to to do some programming on the server before sending HTML to the client.
lorem. Displays random “lorem ipsum” Latin text. This is useful for providing sample data in templates. A number (or variable) containing the number of paragraphs or words to generate (default is 1).
Try http://prettydiff.com/?m=beautify
See if that gets what you want. If you specifically need to address HTML tags that do not have a closing pair, such as <br>
, then add the &html
attribute to the address above. It should do everything you need as per the stated requirements.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With