From 6a596f17862906bb41b537ac7b8871d0cda1224b Mon Sep 17 00:00:00 2001 From: ford prior <108086978+ford-at-aws@users.noreply.github.com> Date: Wed, 27 Sep 2023 15:08:29 -0400 Subject: [PATCH] Fix autoescape fo Jinja template (#5419) --- .doc_gen/images/__init__.py | 0 .doc_gen/images/render-blurbs.py | 15 ++++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 .doc_gen/images/__init__.py diff --git a/.doc_gen/images/__init__.py b/.doc_gen/images/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/.doc_gen/images/render-blurbs.py b/.doc_gen/images/render-blurbs.py index 03fc7c198bb..c00fa25740d 100644 --- a/.doc_gen/images/render-blurbs.py +++ b/.doc_gen/images/render-blurbs.py @@ -1,18 +1,19 @@ +import os + import jinja2 import yaml -import os env = jinja2.Environment( - loader=jinja2.FileSystemLoader(os.path.dirname(__file__)) + loader=jinja2.FileSystemLoader(os.path.dirname(__file__)), + autoescape=jinja2.select_autoescape( + enabled_extensions=("html", "xml"), default_for_string=True + ), ) -with open('../metadata/sdks.yaml', 'r') as file: +with open("../metadata/sdks.yaml", "r") as file: metadata = yaml.safe_load(file) for language in metadata.keys(): metadata[language] - shortname = metadata[language]['property'] + shortname = metadata[language]["property"] template = env.get_template("template.txt") print(template.render(language=language, shortname=shortname)) - - -