diff --git a/src/bootstraparse/modules/context_mngr.py b/src/bootstraparse/modules/context_mngr.py index 33b126b..7f1229b 100644 --- a/src/bootstraparse/modules/context_mngr.py +++ b/src/bootstraparse/modules/context_mngr.py @@ -335,7 +335,7 @@ class SeContainer(BaseContainer): type = "structural_elements" def export(self, exm): - self.subtype = self[0].content[0] + self.subtype = "se_"+self[0].content[0] return super().export(exm) diff --git a/src/bootstraparse/templates/bootstrap.yml b/src/bootstraparse/templates/bootstrap.yml index 86350c5..8978566 100644 --- a/src/bootstraparse/templates/bootstrap.yml +++ b/src/bootstraparse/templates/bootstrap.yml @@ -1,8 +1,11 @@ structural_elements: - div: ["
", "
"] diff --git a/tests/modules/test_export.py b/tests/modules/test_export.py index 5c2ff41..d5e64a0 100644 --- a/tests/modules/test_export.py +++ b/tests/modules/test_export.py @@ -12,12 +12,14 @@ __templates = config.ConfigLoader(pathresolver.b_path("templates/")) __XF = pytest.mark.xfail _all_templates = { "structural_elements": [ - ["div", __GLk(1)], - ["article", __GLk(1)], - ["aside", __GLk(1)], - ["section", __GLk(1)], + ["se_div", __GLk(1)], + ["se_article", __GLk(1)], + ["se_aside", __GLk(1)], + ["se_section", __GLk(1)], ["header", __GLk(1)], ["display", __GLk(1)], + ["se_body", __GLk(1)], + ["se_nav", __GLk(1)], ], "inline_elements": [ ["link", __GLk(1)], @@ -86,7 +88,7 @@ def test_export_response(): ("table", "t_head"), ("table", "t_row"), ("table", "t_cell"), - ("structural_elements", "div"), + ("structural_elements", "se_div"), ]) def test_transform(export_type, export_subtype): """ @@ -118,7 +120,7 @@ def test_get_template_error(): def test_with_optionnals(): em = export.ExportManager(__config, __templates) - em(export.ExportRequest("structural_elements", "div", _opts)) # noqa E741 + em(export.ExportRequest("structural_elements", "se_div", _opts)) # noqa E741 def test_format_optionnals(): @@ -147,6 +149,7 @@ def test_bad_header(): @pytest.mark.parametrize("export_type, export_subtype, line", zipped_templates) def test_get_templates(export_type, export_subtype, line): + print(line) em = export.ExportManager(__config, __templates) # assert type(em.get_templates()) is dict print(export_type, export_subtype)