Skip to content

Commit b7b9b38

Browse files
shaileshmishrashaileshmishra
authored andcommitted
✨ Anchor tag, img tag and iframe tag
1 parent 8af73c7 commit b7b9b38

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

contentstack_utils/render/options.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ def render_node(node_type, node_obj: dict, callback):
6767
if node_type == 'p':
6868
return "<p>" + inner_html + "</p>"
6969
if node_type == 'a':
70-
return "<a href=\"" + node_obj["attrs"]["url"] + "\">" + inner_html + "</a>"
70+
return "<a href=" + node_obj["attrs"]["href"] + ">" + inner_html + "</a>"
7171
if node_type == 'img':
72-
return "<img src=" + "\""+node_obj["attrs"]["url"] + inner_html + "\" />"
72+
return "<img src=" + node_obj["attrs"]["src"] + " />" + inner_html + ""
7373
if node_type == 'embed':
74-
return "<iframe href=" + node_obj["attrs"]["url"] + ">" + inner_html + "</iframe>"
74+
return "<iframe src=" + node_obj["attrs"]["src"] + ">" + inner_html + "</iframe>"
7575
if node_type == 'h1':
7676
return "<h1>" + inner_html + "</h1>"
7777
if node_type == 'h2':

contentstack_utils/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def __find_embed_keys(entry, path, option: Options, render_callback):
4848
Utils.__get_content(keys, entry, option, render_callback)
4949

5050
@staticmethod
51-
def __get_content(keys_array: list, entry, option: Options, render_callback):
51+
def __get_content(keys_array, entry, option: Options, render_callback):
5252
if keys_array is not None and len(keys_array) > 0:
5353
key = keys_array[0]
5454
if len(keys_array) == 1 and keys_array[0] in entry:
@@ -145,11 +145,11 @@ def json_to_html(entry_obj, key_path: list, option: Options):
145145
def __enumerate_content(content, entry, option):
146146
if len(content) > 0:
147147
if isinstance(content, list):
148-
json_array_rte_content = []
148+
array_content = []
149149
for item in content:
150150
result = Utils.__enumerate_content(item, entry, option)
151-
json_array_rte_content.append(result)
152-
return json_array_rte_content
151+
array_content.append(result)
152+
return array_content
153153
if isinstance(content, dict):
154154
if 'type' and 'children' in content:
155155
if content['type'] == 'doc':

0 commit comments

Comments
 (0)