Skip to content

Commit

Permalink
Escape XML special characters
Browse files Browse the repository at this point in the history
Fixes #2
  • Loading branch information
yannjor committed Apr 1, 2021
1 parent 350a4c6 commit 9112e69
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion jsontoopml.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import sys
import os.path
from os import path
from html import escape

if not len(sys.argv) == 3:
exit("Need jsontoopml.py <input file> <output file>\n")
Expand Down Expand Up @@ -69,7 +70,7 @@
elif "\"title\"" in infile:
# if matched, its last info needed, write out.
work = infile.split("\"")
otitle = work[3];
otitle = escape(work[3]) # Escape XML special characters
outf.write(" <outline\n")
outf.write(" title=\"" + otitle + "\"\n")
outf.write(" text=\"" + otitle + "\"\n")
Expand Down

0 comments on commit 9112e69

Please sign in to comment.