Skip to content

Commit

Permalink
Merge pull request #1530 from strictdoc-project/_diff_changelog
Browse files Browse the repository at this point in the history
export/html: fixes in DIFF and Static HTML export
  • Loading branch information
stanislaw authored Dec 24, 2023
2 parents 2941bf6 + d2206d5 commit da9239e
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 40 deletions.
13 changes: 1 addition & 12 deletions strictdoc/export/html/_static/diff.css
Original file line number Diff line number Diff line change
Expand Up @@ -220,22 +220,11 @@
.diff_node_fields {
display: flex;
flex-direction: column;
/* row-gap: var(--base-rhythm); */

/* in node and in doc as Abstract: */
padding-top: var(--base-rhythm);
margin: var(--base-rhythm) 0;
}

.diff_node > .diff_node_fields {
/* in node only: */
margin-bottom: calc(var(--base-rhythm)*2);
padding-left: calc(var(--base-rhythm)*2);

/* padding-left: calc(var(--base-rhythm)*1.5);
border-left: 1px dotted; */

/* border-left: var(--base-rhythm) solid rgba(0,0,0,0.01);
padding-left: calc(var(--base-rhythm)*1); */
}

.diff_node_field {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
! Enabling this option for PDF is highly not recommended.
#}

{%- if copy_to_clipboard is defined -%}
{%- if copy_to_clipboard is defined and project_config.is_running_on_server and not standalone -%}
<sdoc-field data-controller="copy_to_clipboard">
<sdoc-field-content>
<sdoc-autogen>{{ field_content }}</sdoc-autogen>
Expand Down
8 changes: 5 additions & 3 deletions strictdoc/export/html/templates/components/node/index.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@
in the extending template.
#}

{% set is_not_standalone = project_config.is_running_on_server and not standalone %}

<turbo-frame
{%- if project_config.is_running_on_server %}
{%- if is_not_standalone %}
id="article-{{ sdoc_entity.reserved_mid.get_string_value() }}"
{% endif -%}
>

<sdoc-node
{%- if project_config.is_running_on_server %}
{%- if is_not_standalone %}
data-editable_node="on"
{%- if sdoc_entity.is_section %}
data-controller="anchor_controller"
Expand All @@ -38,7 +40,7 @@
{% endblock sdoc_entity %}

{# node_controls #}
{%- if project_config.is_running_on_server -%}
{%- if is_not_standalone -%}
{% include "components/node/node_controls/index.jinja" %}
{%- endif -%}

Expand Down
8 changes: 5 additions & 3 deletions strictdoc/export/html/templates/components/node/root.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
Expect sdoc_entity = document.
#}

{% set is_not_standalone = project_config.is_running_on_server and not standalone %}

<turbo-frame
{%- if project_config.is_running_on_server %}
{%- if is_not_standalone %}
id="article-{{ sdoc_entity.reserved_mid.get_string_value() }}"
{% endif -%}
>

<sdoc-node
{%- if project_config.is_running_on_server %}
{%- if is_not_standalone %}
data-editable_node="on"
{%- endif %}
node-role="root"
Expand All @@ -23,7 +25,7 @@
{% endblock sdoc_entity %}

{# node_controls #}
{%- if project_config.is_running_on_server and not standalone -%}
{%- if is_not_standalone -%}
{% include "components/node/node_controls/index.jinja" %}
{%- endif -%}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
{% elif change.change_type == "Document modified" %}
{% if change.lhs_document is not none %}
{% with document=change.lhs_document, side="left", self_stats=change_container.lhs_stats, other_stats=change_container.rhs_stats, traceability_index=change_container.traceability_index_lhs %}
{% include "screens/git/fields/document_abstract.jinja" %}
{% include "screens/git/fields/document_fields.jinja" %}
{% endwith %}
{% else %}
<div class="changelog_node_null"></div>
Expand All @@ -101,7 +101,7 @@
{% elif change.change_type == "Document modified" %}
{% if change.rhs_document is not none %}
{% with document=change.rhs_document, side="right", self_stats=change_container.rhs_stats, other_stats=change_container.lhs_stats, traceability_index=change_container.traceability_index_rhs %}
{% include "screens/git/fields/document_abstract.jinja" %}
{% include "screens/git/fields/document_fields.jinja" %}
{% endwith %}
{% else %}
<div class="changelog_node_null"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<span class="document_title">{{ document.title }}</span>
</summary>

{% include "screens/git/fields/document_abstract.jinja" %}
{% include "screens/git/fields/document_fields.jinja" %}

{%- set document_iterator = traceability_index.get_document_iterator(document) -%}
{%- for section_or_requirement in document_iterator.all_content() %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,36 @@

<div class="diff_node_fields">

{% if document.reserved_uid is not none and document_change is not none and document_change.uid_modified %}
<details
{% if document.reserved_uid is not none %}
{% set uid_modified = document.reserved_uid is not none and document_change is not none and document_change.uid_modified %}
<div
class="diff_node_field"
{% if uid_modified %}
modified="{{ side }}"
{% endif %}
>
<summary>
{%- with badge_text = "uid" -%}
{%- include "components/badge/index.jinja" -%}
{%- endwith -%}
</summary>

{% assert document.reserved_uid is not none %}
<div
class="sdoc_pre_content"
>{{ document.reserved_uid }}</div>
</details>
</div>

{% endif %}

{% set title_modified = document_change is not none and document_change.title_modified %}
<details
<div
class="diff_node_field"
{% if title_modified %}
modified="{{ side }}"
{% endif %}
>
<summary>
{%- with badge_text = "title" -%}
{%- include "components/badge/index.jinja" -%}
{%- endwith -%}
</summary>

<div
class="sdoc_pre_content"
Expand All @@ -48,21 +49,20 @@
{{ document.title }}
{%- endif -%}
</div>
</details>
</div>

{% if node.free_texts|length > 0 %}
{% set free_text = node.free_texts[0] %}
{% set free_text_modified = document_change is not none and document_change.free_text_modified %}
<details
<div
class="diff_node_field"
{% if free_text_modified %}
modified="{{ side }}"
{% endif %}
>
<summary>
{%- with badge_text = "abstract" -%}
{%- with badge_text = "free text" -%}
{%- include "components/badge/index.jinja" -%}
{%- endwith -%}
</summary>

<div
class="sdoc_pre_content"
Expand All @@ -78,7 +78,7 @@
{{ free_text.get_parts_as_text_escaped() }}
{%- endif -%}
</div>
</details>
</div>

{% endif %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<div class="diff_node_fields">
{# UID #}
{%- if section.reserved_uid is not none and section.reserved_uid|length > 0 -%}
{% set uid_modified = section_change is not none and section_change.uid_modified %}
<div
class="diff_node_field"
{% if section_change is not none and section_change.uid_modified %}
{% if uid_modified %}
modified="{{ side }}"
{% endif %}
>
Expand All @@ -15,16 +16,17 @@
{%- endif %}

{# TITLE #}
{% set title_modified = section_change is not none and section_change.title_modified %}
<div
class="diff_node_field"
{% if section_change is not none and section_change.title_modified %}
{% if title_modified %}
modified="{{ side }}"
{% endif %}
>
{%- with badge_text = "TITLE" -%}
{%- include "components/badge/index.jinja" -%}
{%- endwith -%}
{% if section_change is not none and section_change.title_modified %}
{% if title_modified %}
{%- if section_change.is_paired_change() -%}
<div class="sdoc_pre_content">{{ section_change.get_colored_title_diff(side) }}</div>
{%- else -%}
Expand All @@ -38,9 +40,10 @@
{# Free text #}
{% if section.free_texts|length > 0 %}
{% set free_text = section.free_texts[0] %}
{% set free_text_modified = section_change is none or section_change.free_text_modified %}
<div
class="diff_node_field"
{% if section_change is none or section_change.free_text_modified %}
{% if free_text_modified %}
modified="{{ side }}"
{% endif %}
>
Expand Down
1 change: 1 addition & 0 deletions strictdoc/server/routers/main_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -1253,6 +1253,7 @@ def cancel_edit_requirement(requirement_mid: str):
link_renderer=link_renderer,
traceability_index=export_action.traceability_index,
project_config=project_config,
standalone=False,
)
return HTMLResponse(
content=output,
Expand Down

0 comments on commit da9239e

Please sign in to comment.