Elegant way to skip script tag for shpaml

I started using excellent shpaml . But soon I ran into a problem that my js code inside script tags is also being processed. Is there a way to tweak / extend python shpaml so that it skips the script or any tag that is configured for exception.

I know that I can use the prefix, but this is not acceptable for my team. I also agree with that.

TIA

+4
source share
4 answers

Finally I forked shpaml for the following

  • Skip processing if script / style tag is detected
  • if the block inside such a tag already has a prefix with a channel, and then it is processed as before

I hope that the author agrees with this. So answer my own question.

Fork here https://bitbucket.org/shon/shpaml_website

0
source

Use the verbatim tag e.g.

script type="text/javascript" VERBATIM $(function() { alert("hello world!); }); 
+2
source

You can look for alternative template languages, such as Is there a HAML implementation for use with Python and Django .

0
source

Try:

 script type="text/javascript" src='/path/to/script' | {# #} 
0
source

Source: https://habr.com/ru/post/1347249/


All Articles