Django tag jinja2

Hello,

I have an old and big project in django. and my html files are .htm.j2 (files jinja templates) and i would like open them in pinegrow but it not work with msg (page contains syntax errors due to jinja tags) i want to force this opening and works with css and tell to pinegrow to ignore vars tags of jinja2

Thanks

1 Like

Hi @ados1991 I don’t know if the information here would be of use to you but you should have a read, it just might help.

he is not helpful because he only works for some tags defined(php, asp, eg…) if i can define custom tag for jinja2, its may hepful but for my personal opnion i think we need the new feature for this, but i will continue to search.

thanks

I have heavily embedded PHP in files that are basically template files that gets generated by PHP and populated with content. Pinegrow can’t do much with that and I only see php code. I don’t use Django but for my PHP laden files in the tree view I use the eye icons to turn off those lines in Pinegrow and this leaves the bare template and I then can work on styling and updating the html.

Alternatively you can remove all the Django code in your files by using something like Notepad++ and either go line by line or use regx find replace to remove the Django tags from your page. I like the Pinegrow way better though because I don’t have to remove the code and it just gets ignored. Takes some time to do if you have a lot of tags. All it does is adds a class to your containers or elements which you can remove with find replace and have it done all at once instead of manually turning each disabled element back on.

1 Like

your solution is good if it is small project but i have big project.

The better way is to create custom like this
var pgScripts = {
’<?php' : { type: 'php', name: 'PHP', close: '?>’ },
’<?=' : { type: 'php', name: 'PHP', close: '?>’ },
’<?' : { type: 'php', name: 'PHP', close: '?>’ },
’{%’ : { type: ‘angular’, name: ‘ANGULAR’, close: ‘%}’ },
’{$’ : { type: ‘django’, name: ‘Django’, close: ‘$}’ },
’<%’ : { type: ‘asp’, name: ‘ASP & ERB’, close: ‘%>’ }
}

in pg-parser.js but i need some documentation code to do this.

I also have this issue (I’m using Pinegrow to design my Flask frontend). Did you have any luck with this?

Where did you find pg-parser.js? That definitely seems like a good place to start, but can’t find it either in my project or in the PineGrow install folder.