diff --git a/server/ntb/publish/ntb_ninjs.py b/server/ntb/publish/ntb_ninjs.py index 48f8efca2..92a527243 100644 --- a/server/ntb/publish/ntb_ninjs.py +++ b/server/ntb/publish/ntb_ninjs.py @@ -64,6 +64,9 @@ def _transform_to_ninjs(self, article, subscriber, recursive=True): ninjs["descriptions"] = self.format_descriptions(ninjs) if article.get("body_html"): + body_footer = article.get('body_footer', '').strip() + if body_footer: + article['body_html'] += body_footer ninjs["bodies"] = self.format_bodies(article) if ninjs.get("subject"): diff --git a/server/ntb/publish/utils.py b/server/ntb/publish/utils.py index 7dc1b2a1d..1a9409d13 100644 --- a/server/ntb/publish/utils.py +++ b/server/ntb/publish/utils.py @@ -1,9 +1,5 @@ - import re import logging -import superdesk.etree as sd_etree - -from lxml import etree from typing import Dict, List, Optional, Tuple diff --git a/server/ntb/tests/publish/ntb_ninjs_test.py b/server/ntb/tests/publish/ntb_ninjs_test.py index b527604a5..6750f417b 100644 --- a/server/ntb/tests/publish/ntb_ninjs_test.py +++ b/server/ntb/tests/publish/ntb_ninjs_test.py @@ -22,6 +22,7 @@

testNTBMEDIA TO REMOVE

(©MyCompany2023)

+

footer this is

""".strip() with open( @@ -185,6 +186,7 @@ class Ninjs2FormatterTest(TestCase): "version_creator": "ObjectId(" "5640a5eef40235008465242b" ")", "abstract": "

abstract this is

", "body_html": TEST_BODY, + "body_footer": "

footer this is

", "dateline": { "located": { "dateline": "city", @@ -321,8 +323,8 @@ def test_format_item(self): ], "bodies": [ { - "charcount": 148, - "wordcount": 26, + "charcount": 162, + "wordcount": 29, "value": TEST_BODY_EXPECTED, "contenttype": "text/html", } @@ -444,6 +446,7 @@ def test_publish_table(self): { "fields_meta": text_item_with_table["fields_meta"], "body_html": text_item_with_table["body_html"], + "body_footer": "", } ) assert "" in ninjs["bodies"][0]["value"]