Browse Source

step wise bulletpoints-mst

version2
venkata akhil 11 months ago
parent
commit
5aafe41452
  1. 30
      smart_service/apis/v2/master.py

30
smart_service/apis/v2/master.py

@ -187,6 +187,7 @@ def new_publish():
data = []
if module == 'Feature Finder':
flag, data = get_feature_finder(vehicle, variant, language)
elif module == 'Repair/Service Check Sheet':
@ -212,9 +213,16 @@ def new_publish():
reg_str = "<p>"
res = re.findall(reg_str, pw['content'])
if res:
pw['content'] = re.sub('<p>','<p style="color: #fff">',pw['content'] )
pw['content'] = re.sub('<div>','',pw['content'])
pw['content'] = re.sub('</div>','',pw['content'])
pw['content'] = re.sub('<p>','<div style="color: #fff;margin:0px !important;">',pw['content'] )
pw['content'] = re.sub('</p>','</div>',pw['content'] )
cnverted_data = re.sub(CLEANR_back_slash,"'",pw['content'])
pw['content'] = cnverted_data
else:
pw['content'] = '<p style="color: #fff">'+pw['content']+'</p>'
pw['content'] = '<div style="color: #fff;margin:0px !important;">'+pw['content']+'</div>'
cnverted_data = re.sub(CLEANR_back_slash,"'",pw['content'])
pw['content'] = cnverted_data
# VALID_TAGS = ['div', 'p']
# soup = BeautifulSoup(pw['content'])
# for tag in soup.findAll('p'):
@ -244,18 +252,26 @@ def new_publish():
cnverted_data = re.sub(CLEANR_back_slash,"'",qp_rhs['content'])
qp_rhs['content'] = cnverted_data
elif module == 'Training Information':
# flag, data = get_training_information(vehicle, language)
pass
elif module == 'Mahindra Special Tool Information':
CLEANR_back_slash = re.compile("\"")
html_code_ul = '<ul style="list-style-type: none; padding-left: 0px;"><span style="width: 0;height: 0;border-top: 6px solid transparent;border-left: 8px solid red;border-bottom: 6px solid transparent;position: absolute;margin-top: 3px;"></span>'
html_code_li = '<li style="margin-left: 15px;padding: 0px 1px 5px 0px;"data-list="bullet">'
flag, data = get_special_tool_information(vehicle)
for dt in data:
if len(dt['instructions'])>0:
for c_t in dt['instructions']:
if c_t['content_type'] == 'Description':
if c_t['content']:
c_t['content'] = html_code_ul+html_code_li+c_t['content']+'</li>'+'</ul>'
cnverted_data = re.sub(CLEANR_back_slash,"'",c_t['content'])
c_t['content'] = cnverted_data
elif module == 'PDI Inspection':
pass

Loading…
Cancel
Save