From dd5ac0140fd7aab787e484dcd73ddd43aaec6e04 Mon Sep 17 00:00:00 2001 From: Chuck SmileyRekiere Date: Wed, 29 Sep 2021 06:12:34 -0600 Subject: [PATCH] lf_json_convert.py : updated to work around the --raw_lines with \" Signed-off-by: Chuck SmileyRekiere --- py-scripts/tools/lf_json_convert.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/py-scripts/tools/lf_json_convert.py b/py-scripts/tools/lf_json_convert.py index 5f188d44..80f47a60 100755 --- a/py-scripts/tools/lf_json_convert.py +++ b/py-scripts/tools/lf_json_convert.py @@ -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": [ "
{",')
+        file2_fd.write('"text": [ "
**{}**\\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('"
"]\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 _edit + NOTE: CANNOT have extra blank lines at the end of the json to display correctly. ''', description='''\