Skip to content

Commit eec432c

Browse files
committed
java: escape contents of the generated javadocs
1 parent 49ad27c commit eec432c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

schema_salad/java_codegen.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Java code generator for a given schema salad definition."""
22

3+
import html
34
import os
45
import re
56
import shutil
@@ -36,7 +37,7 @@ def _doc_to_doc_string(doc: str | None, indent_level: int = 0) -> str:
3637
lead: Final = " " + " " * indent_level + "* " * indent_level
3738
if doc:
3839
doc_str = f"{lead}<BLOCKQUOTE>\n"
39-
doc_str += "\n".join([f"{lead}{line}" for line in doc.split("\n")])
40+
doc_str += "\n".join([f"{lead}{line}" for line in html.escape(doc).split("\n")])
4041
doc_str += f"{lead}</BLOCKQUOTE>"
4142
else:
4243
doc_str = ""

0 commit comments

Comments
 (0)