Django if statement with beginning tag in conditional breaking next div - python-3.x

I have the following code in a file in my template folder
{% if permission <= 4 %}
<div class='row'>
The < in my conditional is breaking my next div.
If I use > then it works but that's not how I have my permissions and I don't want to switch it around.
vim detects a break in this conditional by changing the color and the template never loads the div even though the conditional is true.
Session output:
('permission', 0)])
I feel like I'm missing something simple but I can't quite get my search strings to give me what I am looking for.

Someone helped me here: https://forum.djangoproject.com/t/conditional-conflict-in-template-with-following-div/14476
I got distracted by the VIM error and went in the wrong direction.
I changed 'permission' to 'request.session.permission' and it works now.

Related

HTMLBeautify & Sublime - Ignore Empty Lines

Taking over some code created by a previous developer and have a massive HTML formatting clean up task to tackle.
I am using Sublime 3 with HTML Beautify extension to auto format this mess.
https://packagecontrol.io/packages/HTMLBeautify
When the extension is triggered, the HTML is properly indented, however, all the intended empty lines are removed.
Can anyone provide a setting to ignore intended empty lines when using the HTML Beautify Extension?
Thanks in Advance
From a quick perusal of the settings in the README for the package, this setting looks like it might do what you want:
remove_extraline : Set true to remove empty line.
The setting defaults to true, so that would seem to indicate that it's trimming empty lines by default, but changing the setting might stop it from doing that.

How to write square brackets in markdown

I need to write in my gitlab project wiki page a code block that contains square brackets. Unfortunately the square brackets are turn into a link.
I assume gitlab is using markdown language or the gfm flavor.
This is my code:
```javascript
"{bla, """", [[foo],[]]}"
```
The foo],[ part is turn into a link. So basicaly I need a way to write a square brackets tah are not treated as a link. Surprisingly google doesn't provide any answer for such a trivial issue.
The current answer is that you can't do this. It is a know bug in GitLab, specifically in Wiki pages. GitLab markdown correctly handles square brackets in comments, and code blocks entered in issues, but NOT in wiki pages.
Please add your vote (thumbs up) on the issue to try and get it resolved:
https://gitlab.com/gitlab-org/gitlab-ce/issues/18725
Your (not very appealing) options boil down to these:
Use a single line code entry `"{bla, """", [[foo],[]]}"`
Use another syntax in your code block (e.g. {{), and include a note outside the code block saying to replace {{ with [[, etc - Note that you can use double brackets inside single quote blocks in GitLab Markdown.
Use a screenshot of your code.
None of these are very nice solutions, but all you have at the moment.

How to jump to beginning of Tag in HTML vim which has long html content

Following is code
<p>
Some Content
Some Content
My Cursor is here
Some Content
Some Content
</p>
How do I directly Jump to beginning of Tag <p> or </p>
% command needs your cursor to be on tag, I tried other based on 10G. I cant expect number to visible all time.
I think there might be some smarter way to do this.
Using key sequence vatoESC will do it.
Check out the answer here: https://stackoverflow.com/a/10881471/5039312
If you’re open to using a plugin, I use this: https://github.com/tmhedberg/matchit

Sublime text 3 not recognizing html files when using templates

Can't seem to find the exact problem elsewhere...
Basically in my html file at the top I have:
<%inherit file="base.html"/>
This proceeds to screw up all the highlighting in the file and also confuses the commenting shortcut.
This:
Changes into this:
Found the issue. Wasn't aware that this was using Mako as the templating system rather than a more well known one. This package allows you to set the syntax at HTML(Mako)
https://github.com/OmeGak/sublime-text-user-settings
The problem is <%blabla> and </%blabla> are not considered closed.
I'm using a workaround like this: line 4 will close line 1
1 <%block name="content">
2 <%
3 #
4 %>
5 <div>
6 Syntax highlight as before. Emmet works too.
7 </div>
8 </%block>

CKEditor and Font Color saved but not working

I've just installed CKEditor and call it with JS tag.
When I save the text, all the font attributes (indentation, space, size, decoration,etc.) are correctly saved .
The problem is that when I want to edit the data, with CKEditor, all these attributes are well loaded but the COLOR even if, in the example below, it's set to "BLUE"!
Which is very bizarre because when I can see the color style property in my database:
<h3 style=\"\\"color:blue\\"\">
<strong>aulne </strong>kjhqsdf <span style=\"\\"color:#008000;\\"\"><u>kjhkjsdfh </u></span>j'<span style=\"\\"\\\\"\\\\"\\"\"><em>espère </em></span><span style=\"\\"\\\\"\\\\"\\"\">bien<sup>2</sup></span></h3>
I found this old bug post http://dev.fckeditor.net/ticket/116
where no solution is found.
Thank very much,
regards.
I found the problem:
on the php side, before inserting, I was using the "addslash" function I forgot to remove.
Thanks again.
It stopped working when I commented out the stripslashes from the php code. So I was doing the opposite and not stripping the slashes. Once I read the other answer I thought dah, I commented the following out yesterday. Now works fine! Certain PHP modes like safe mode will generate extra slashes to lessen hack attempts so moving code from servers with different modes can cause issues. So this answer is the same but opposite reason. My server is in safe mode so it automatically adds the slashes and I must remove them.
$a10 = stripslashes($a10);

Resources