Skip to content

Commit

Permalink
Merge pull request strictdoc-project#1924 from strictdoc-project/stan…
Browse files Browse the repository at this point in the history
…islaw/fix_type_issue

Code climate: remove unused render_free_text()
  • Loading branch information
stanislaw authored Jul 21, 2024
2 parents 0cc71cd + 194e10b commit e73eac4
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
35 changes: 0 additions & 35 deletions strictdoc/export/html/renderers/markup_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
22 changes: 0 additions & 22 deletions strictdoc/export/html/templates/screens/document/table/main.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -166,28 +166,6 @@
{%- endif -%}
</td>
</tr>
{%- if section.free_texts -%}
{%- for free_text in section.free_texts -%}
<tr>
<td class="content-view-td content-view-td-type">
Free text
</td>
<td class="content-view-td content-view-td-meta">
</td>
{%- for meta_field_title in view_object.document.enumerate_meta_field_titles() -%}
<td class="content-view-td content-view-td-meta">
</td>
{%- endfor -%}
<td class="content-view-td content-view-td-meta">
{# Children & Parents #}
</td>
<td class="content-view-td" colspan="50">
<sdoc-autogen>{{ view_object.render_free_text(view_object.document_type, free_text) }}</sdoc-autogen>
</td>
</tr>
{%- endfor -%}
{%- endif -%}
{%- endif %}
{%- endfor %}
</table>
Expand Down

0 comments on commit e73eac4

Please sign in to comment.