passing string with html tags to html from python -
i have result list passing python html document
like this:
from flask import render_template flask_bootstrap import bootstrap render_template('search.html', results=result)
result list of lists , looks this:
result= [['xxx', 'yyy', 'mmm', 'fff', '<b>...</b>vvv, <b>jj</b> <b>fkjfkj</b> ahbasb ashdkj akshdkj ajhsdkj ajksds <b>ah</b> gakshd<b>...</b>'], ['xxx', 'yyy', 'mmm', 'fff', '<b>...</b>vvv, <b>jj</b> <b>fkjfkj</b> ahbasb ashdkj akshdkj ajhsdkj ajksds <b>ah</b> gakshd<b>...</b>']]
the search.html code following:
{% extends "bootstrap/base.html" %} {% block title %} name of page {% endblock %} {% block styles %} {{super()}} <link rel=stylesheet type=text/css href="{{ url_for('static', filename='style.css') }}"> {% endblock %} {% block content %} <hr/> <ul> {% if results %} {% hit in results %} <li> {{hit[0]}} | {{hit[1]}} | {{hit[2]}} | {{hit[3]}} | {{hit[4]}} </li> {% endfor %} {% endif %} </ul> </div> {% endblock %}
when run application, html file displays bold tags instead of displaying bold text.
for example displays this:
xxx | yyy | mmm | fff | <b>...</b>vvv, <b>jj</b> <b>fkjfkj</b> ahbasb ashdkj akshdkj ajhsdkj ajksds <b>ah</b> gakshd<b>...</b>
instead of:
xxx | yyy | mmm | fff | ...vvv, jj fkjfkj ahbasb ashdkj akshdkj ajhsdkj ajksds ah gakshd...
i know there simple solution this. cant seem see going wrong.
Comments
Post a Comment