import htmlmin
from markupsafe import Markup

from qxlc import app


@app.template_filter("minify")
def minify_filter(text):
    return Markup(htmlmin.minify(text.unescape(), remove_comments=True, remove_empty_space=True))

import htmlmin
from markupsafe import Markup

from qxlc import app


@app.template_filter("minify")
def minify_filter(s):
    return Markup(htmlmin.minify(str(s), remove_comments=True, remove_empty_space=True))

Use str(s) instead of s.unescape() to add support for escaping things inside. (took me a while to find that str() worked)
Use str(s) instead of s.unescape() to add support for escaping things inside. (took me a while to find that str() worked)

  import htmlmin
  from markupsafe import Markup
  
  from qxlc import app
  
  
  @app.template_filter("minify")
- def minify_filter(text):
+ def minify_filter(s):
-     return Markup(htmlmin.minify(text.unescape(), remove_comments=True, remove_empty_space=True))
+     return Markup(htmlmin.minify(str(s), remove_comments=True, remove_empty_space=True))
  
Use str(s) instead of s.unescape() to add support for escaping things inside. (took me a while to find that str() worked)
## Code Before:
import htmlmin
from markupsafe import Markup

from qxlc import app


@app.template_filter("minify")
def minify_filter(text):
    return Markup(htmlmin.minify(text.unescape(), remove_comments=True, remove_empty_space=True))

## Instruction:
Use str(s) instead of s.unescape() to add support for escaping things inside. (took me a while to find that str() worked)
## Code After:
import htmlmin
from markupsafe import Markup

from qxlc import app


@app.template_filter("minify")
def minify_filter(s):
    return Markup(htmlmin.minify(str(s), remove_comments=True, remove_empty_space=True))
