added frappe.render_template and fixed string to html formatting
This commit is contained in:
parent
b0e2fbc363
commit
1bc648b3bd
3 changed files with 9 additions and 2 deletions
|
|
@ -638,6 +638,11 @@ def set_filters(jenv):
|
|||
def get_template(path):
|
||||
return get_jenv().get_template(path)
|
||||
|
||||
def render_template(template, context):
|
||||
from jinja2 import Template
|
||||
template = Template(template)
|
||||
return template.render(**context)
|
||||
|
||||
def get_website_route(doctype, name):
|
||||
return db.get_value("Website Route", {"ref_doctype": doctype, "docname": name})
|
||||
|
||||
|
|
|
|||
|
|
@ -57,12 +57,13 @@ frappe.form.formatters = {
|
|||
},
|
||||
Text: function(value) {
|
||||
if(value) {
|
||||
var tags = ["<p[^>]>", "<div[^>]>", "<br[^>]>"];
|
||||
var tags = ["<p", "<div", "<br"];
|
||||
var match = false;
|
||||
|
||||
for(var i=0; i<tags.length; i++) {
|
||||
if(value.match(tags[i])) {
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -297,11 +297,12 @@ $.extend(_p, {
|
|||
},
|
||||
|
||||
add_span: function(html) {
|
||||
var tags = ["<span[^>]>", "<p[^>]>", "<div[^>]>", "<br[^>]>", "<table[^>]>"];
|
||||
var tags = ["<span", "<p", "<div", "<br", "<table"];
|
||||
var match = false;
|
||||
for(var i=0; i<tags.length; i++) {
|
||||
if(html.match(tags[i])) {
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue