From 194e10bf0719b0e23d1bf41cce077d17d329be03 Mon Sep 17 00:00:00 2001 From: Stanislav Pankevich Date: Sun, 21 Jul 2024 11:24:46 +0200 Subject: [PATCH] Code climate: remove unused render_free_text() --- .../document_screen_view_object.py | 3 -- .../view_objects/search_screen_view_object.py | 3 -- .../view_objects/source_file_view_object.py | 3 -- .../export/html/renderers/markup_renderer.py | 35 ------------------- .../screens/document/table/main.jinja | 22 ------------ 5 files changed, 66 deletions(-) diff --git a/strictdoc/export/html/generators/view_objects/document_screen_view_object.py b/strictdoc/export/html/generators/view_objects/document_screen_view_object.py index b5c272cd9..f1c54b507 100644 --- a/strictdoc/export/html/generators/view_objects/document_screen_view_object.py +++ b/strictdoc/export/html/generators/view_objects/document_screen_view_object.py @@ -243,9 +243,6 @@ def render_static_url(self, url: str): def render_local_anchor(self, node): return self.link_renderer.render_local_anchor(node) - def render_free_text(self, document_type, free_text): - return self.markup_renderer.render_free_text(document_type, free_text) - def render_node_statement(self, node): return self.markup_renderer.render_node_statement( self.document_type, node diff --git a/strictdoc/export/html/generators/view_objects/search_screen_view_object.py b/strictdoc/export/html/generators/view_objects/search_screen_view_object.py index f7a4ec304..b64fd9845 100644 --- a/strictdoc/export/html/generators/view_objects/search_screen_view_object.py +++ b/strictdoc/export/html/generators/view_objects/search_screen_view_object.py @@ -93,9 +93,6 @@ def render_static_url(self, url: str): def render_local_anchor(self, node): return self.link_renderer.render_local_anchor(node) - def render_free_text(self, document_type, free_text): - return self.markup_renderer.render_free_text(document_type, free_text) - def date_today(self): return datetime.today().strftime("%Y-%m-%d") diff --git a/strictdoc/export/html/generators/view_objects/source_file_view_object.py b/strictdoc/export/html/generators/view_objects/source_file_view_object.py index b0a40f86e..25442fd93 100644 --- a/strictdoc/export/html/generators/view_objects/source_file_view_object.py +++ b/strictdoc/export/html/generators/view_objects/source_file_view_object.py @@ -67,9 +67,6 @@ def render_static_url(self, url: str): def render_local_anchor(self, node): return self.link_renderer.render_local_anchor(node) - def render_free_text(self, document_type, free_text): - return self.markup_renderer.render_free_text(document_type, free_text) - def date_today(self): return datetime.today().strftime("%Y-%m-%d") diff --git a/strictdoc/export/html/renderers/markup_renderer.py b/strictdoc/export/html/renderers/markup_renderer.py index a0d418143..2a990a0b1 100644 --- a/strictdoc/export/html/renderers/markup_renderer.py +++ b/strictdoc/export/html/renderers/markup_renderer.py @@ -5,7 +5,6 @@ from strictdoc.backend.sdoc.models.document import SDocDocument from strictdoc.backend.sdoc.models.inline_link import InlineLink from strictdoc.backend.sdoc.models.node import SDocNode, SDocNodeField -from strictdoc.backend.sdoc.models.section import FreeText from strictdoc.backend.sdoc.models.type_system import RequirementFieldName from strictdoc.core.project_config import ProjectConfig from strictdoc.core.traceability_index import TraceabilityIndex @@ -142,37 +141,3 @@ def render_node_field( self.cache[(document_type, node_field, truncated)] = output return output - - def render_free_text(self, document_type, free_text): - assert isinstance(free_text, FreeText) - assert self.context_document is not None - - if (document_type, free_text) in self.cache: - return self.cache[(document_type, free_text)] - - parts_output = "" - for part in free_text.parts: - if isinstance(part, str): - parts_output += part - elif isinstance(part, InlineLink): - linkable_node = ( - self.traceability_index.get_linkable_node_by_uid(part.link) - ) - href = self.link_renderer.render_node_link( - linkable_node, self.context_document, document_type - ) - parts_output += self.fragment_writer.write_anchor_link( - linkable_node.get_display_title(), href - ) - elif isinstance(part, Anchor): - parts_output += self.template_anchor.render( - anchor=part, - traceability_index=self.traceability_index, - link_renderer=self.link_renderer, - document_type=DocumentType.document(), - ) - - output = self.fragment_writer.write(parts_output) - self.cache[(document_type, free_text)] = output - - return output diff --git a/strictdoc/export/html/templates/screens/document/table/main.jinja b/strictdoc/export/html/templates/screens/document/table/main.jinja index 0ee342031..f9fc5e37a 100644 --- a/strictdoc/export/html/templates/screens/document/table/main.jinja +++ b/strictdoc/export/html/templates/screens/document/table/main.jinja @@ -166,28 +166,6 @@ {%- endif -%} - {%- if section.free_texts -%} - {%- for free_text in section.free_texts -%} - - - Free text - - - – - - {%- for meta_field_title in view_object.document.enumerate_meta_field_titles() -%} - - - {%- endfor -%} - - {# Children & Parents #} - - - {{ view_object.render_free_text(view_object.document_type, free_text) }} - - - {%- endfor -%} - {%- endif -%} {%- endif %} {%- endfor %}