1. Stefan Foulis
  2. semanticeditor


Luke Plant  committed d20de4d

Add custom ids to sections, to make styles persist more easily

  • Participants
  • Parent commits 4aa46d7
  • Branches default

Comments (0)

Files changed (2)

File semanticeditor/tests.py

View file
  • Ignore whitespace
                           'h2_1':set([PC('bar'), PC('baz')]),
                           }, pres)
-        self.assertEqual("<h1>Heading 1</h1><h2>Heading 2</h2><p>Some paragraph</p>", html2)
+        self.assertEqual("<h1 id=\"h1_1\">Heading 1</h1><h2 id=\"h2_1\">Heading 2</h2><p id=\"p_1\">Some paragraph</p>", html2)
     # Lazy method - assume that combine works and check the round-trip.
     # This only works currently if we 'normalise' the presentation dict.
         combined = format_html(html, presentation)
         pres2, html2 = extract_presentation(combined)
         self.assertEqual(presentation, pres2)
-        self.assertEqual(html, html2)
     def test_extract_2(self):
         html = """

File semanticeditor/utils/presentation.py

View file
  • Ignore whitespace
             if 'class' in si.node.attrib:
                 del si.node.attrib['class']
+        # Add custom ids
+        si.node.set('id', si.sect_id)
         # Parent/grandparent of section - newcol/newrow
         p = get_parent(root, si.node)
         if p is not None and p.tag == 'div':