Skip to content

Commit

Permalink
Merge pull request #32 from contentstack/next
Browse files Browse the repository at this point in the history
node type link issue due to attribute changed from href to url
  • Loading branch information
cs-raj authored Sep 27, 2024
2 parents 979daf4 + 7477550 commit 5aac7b9
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 10 deletions.
8 changes: 8 additions & 0 deletions changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
**CHANGELOG**
================


*v1.3.1*
============

Bug Fix: Fixed Link type attributes.

- Fixed link type attribute issue

*v1.3.0*
============

Expand Down
2 changes: 1 addition & 1 deletion contentstack_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
__title__ = 'contentstack_utils'
__author__ = 'contentstack'
__status__ = 'debug'
__version__ = '1.3.0'
__version__ = '1.3.1'
__endpoint__ = 'cdn.contentstack.io'
__contact__ = '[email protected]'
2 changes: 1 addition & 1 deletion contentstack_utils/render/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def render_node(node_type, node_obj: dict, callback):
if node_type == 'p':
return "<p>" + inner_html + "</p>"
if node_type == 'a':
return "<a href=\"{}\">{}</a>".format(node_obj["attrs"]["href"], inner_html)
return "<a href=\"{}\">{}</a>".format(node_obj["attrs"]["url"], inner_html)
if node_type == 'img':
return "<img src=\"{}\" />{}".format(node_obj["attrs"]["src"], inner_html)
if node_type == 'embed':
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pip~=23.3
setuptools~=68.2.0
setuptools~=70.0.0
lxml~=4.9.3
pylint~=3.0.3
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
long_description_content_type="text/markdown",
url="https://github.com/contentstack/contentstack-utils-python",
license='MIT',
version='1.3.0',
version='1.3.1',
install_requires=[

],
Expand Down
2 changes: 1 addition & 1 deletion tests/mocks/supercharged/supercharged.json
Original file line number Diff line number Diff line change
Expand Up @@ -1698,7 +1698,7 @@
"uid": "removed_for_security_reasons",
"type": "a",
"attrs": {
"href": "LINK.com",
"url": "LINK.com",
"target": "_self"
},
"children": [
Expand Down
9 changes: 4 additions & 5 deletions tests/test_util_srte.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,18 @@ def test_linkin_list_in_supercharged_dict_to_html(self):

def test_reference_list_in_supercharged_dict_to_html(self):
array_str = ['reference']
response = response = Utils.json_to_html([self._json_data], array_str, Options())
response = Utils.json_to_html([self._json_data], array_str, Options())
self.assertEqual(Results.refImgHtml, response)

def test_nested_order_list_in_supercharged_dict_to_html(self):
array_str = ['nested_order_list_with_fragment']
Utils.json_to_html([self._json_data], array_str, Options())
self.assertEqual(Results.nested_order_list_with_fragment, "<ol><li><fragment>List Item 1</fragment><ol><li>List Item 1.1</li><li>List Item 1.2</li><li>List Item 1.3</li></ol></li></ol>")


def test_reference_list_in_supercharged_dict_to_html(self):
def test_reference_image_in_supercharged_dict_to_html(self):
array_str = ['reference']
Utils.json_to_html([self._json_data], array_str, Options())
self.assertEqual(Results.linkInPHtml, self._json_data['reference'])
response = Utils.json_to_html([self._json_data], array_str, Options())
self.assertEqual(Results.refImgHtml, response)

def test_nested_order_list_in_supercharged_dict_to_html(self):
array_str = ['nested_order_list_with_fragment']
Expand Down

0 comments on commit 5aac7b9

Please sign in to comment.