mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-10-30 18:27:53 +00:00
lf_json_convert.py : updated to work around the --raw_lines with \"
Signed-off-by: Chuck SmileyRekiere <chuck.smileyrekiere@candelatech.com>
This commit is contained in:
@@ -21,11 +21,13 @@ class file_convert():
|
||||
file_fd = open(self.file, 'r')
|
||||
file2_fd = open(self.file2, 'w+')
|
||||
file2_fd.write('{\n')
|
||||
file2_fd.write('"text": [ "<pre>{",')
|
||||
file2_fd.write('"text": [ "<pre>**{}**\\n",'.format(self.file))
|
||||
for line in file_fd:
|
||||
#print(line)
|
||||
line = line.replace('"','"').replace('\n','')
|
||||
# to avoid --raw_line \" issues the \" it creates a \& which the reader does not like
|
||||
line = line.replace('\&','\\\&')
|
||||
line = '"' + line + '\\n",'
|
||||
|
||||
file2_fd.write('{}\n'.format(line))
|
||||
file2_fd.write('"</pre>"]\n')
|
||||
file2_fd.write('},')
|
||||
@@ -40,6 +42,7 @@ def main():
|
||||
formatter_class=argparse.RawTextHelpFormatter,
|
||||
epilog='''\
|
||||
lf_json_convert.py converts json for cookbook the output is <file>_edit
|
||||
NOTE: CANNOT have extra blank lines at the end of the json to display correctly.
|
||||
|
||||
''',
|
||||
description='''\
|
||||
|
||||
Reference in New Issue
Block a user