diff --git a/xmodule/annotatable_block.py b/xmodule/annotatable_block.py index dbcf0123c59a..9dcc27198d5d 100644 --- a/xmodule/annotatable_block.py +++ b/xmodule/annotatable_block.py @@ -140,9 +140,8 @@ def _render_content(self): """ Renders annotatable content with annotation spans and returns HTML. """ xmltree = etree.fromstring(self.data) - content = etree.tostring(xmltree, encoding='unicode') + self._extract_instructions(xmltree) - xmltree = etree.fromstring(content) xmltree.tag = 'div' if 'display_name' in xmltree.attrib: del xmltree.attrib['display_name'] diff --git a/xmodule/tests/test_annotatable_block.py b/xmodule/tests/test_annotatable_block.py index b9f419ee3a0f..3de253047a8d 100644 --- a/xmodule/tests/test_annotatable_block.py +++ b/xmodule/tests/test_annotatable_block.py @@ -134,3 +134,11 @@ def test_extract_instructions(self): xmltree = etree.fromstring('foo') actual = self.annotatable._extract_instructions(xmltree) # lint-amnesty, pylint: disable=protected-access assert actual is None + + def test_instruction_removal(self): + xmltree = etree.fromstring(self.sample_xml) + instructions = self.annotatable._extract_instructions(xmltree) # pylint: disable=protected-access + + assert instructions is not None + assert "Read the text." in instructions + assert xmltree.find("instructions") is None