Highlighting the HTML code in a python file in vim?

There is a need to write a certain amount of cgi scripts in Python. Going to use the standard approach: processing the packet data, took place the template with html code, formatted it, substituting the data values.


The question arises: how not to lose in the ease of writing html code? The pages are tricky so I would like code highlighting, tags in the page code. But this seems completely non-standard functionality — highlight the html code in a text variable in a script on Python.


Has anyone encountered anything similar? Probably not one I have a need to write some cgi-script, which removes the hard page. The idea was to make a page template in a separate html file which is then read.


Use vim. In the editor, not something to master, but learning.

Maybe I did reinvent the wheel?
October 8th 19 at 02:54
2 answers
October 8th 19 at 02:56
Solution
Thank you! This is absolutely what I wanted at the time half an hour ago :-)
I've been immersed in the study of the question, I realized that templating — more beautiful solution, and even found the engine, completely acceptable to me, with separate highlighting for vim — Jinja2. - Elody_Wiso commented on October 8th 19 at 02:59
October 8th 19 at 02:58
> Maybe I did reinvent the wheel?
Yes, take any framework type flask, django, etc. and write what you need. Then using flup, for example, you can tie it to the fastcgi module to the web server. We do not understand why you specifically need the cgi.

Find more questions by tags CGIVimPythonHTML