Skip to content

Commit

Permalink
Merge pull request strictdoc-project#1906 from haxtibal/tdmg/fix_link…
Browse files Browse the repository at this point in the history
…_to_anchor_x_sdoc

LINKs: Fix link to anchor in other sdoc
  • Loading branch information
stanislaw authored Jul 1, 2024
2 parents 77465c7 + 913e075 commit f79d01e
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
4 changes: 2 additions & 2 deletions strictdoc/backend/sdoc/models/anchor.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ def get_display_title(self) -> str:
def document(self):
if self.parent.parent.__class__.__name__ == "SDocDocument":
return self.parent.parent
return self.parent.parent.document
return self.parent_node().document

@property
def parent_or_including_document(self):
return self.parent.parent_or_including_document
return self.parent_node().parent_or_including_document

def parent_node(self) -> Any:
# Anchor -> FreeText -> Section|Document
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,13 @@ See the [LINK: AD2] for more details.
See the [LINK: Interface_Control_Document] for more details.
[/FREETEXT]

[TEXT]
STATEMENT: >>>
See the [LINK: AD4] for more details.

See the [LINK: AD5] for more details.

See the [LINK: Supplemental Guide] for more details.
<<<

[/SECTION]
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,21 @@ Anchors end.

[/FREETEXT]

[TEXT]
STATEMENT: >>>
[ANCHOR: AD4]

1) AD4. Threat Model.

[ANCHOR: AD5, Software Tests]

2) AD5. Software Tests.

[ANCHOR: Supplemental Guide]

3) AD6. Supplemental Guide.

Anchors end.
<<<

[/SECTION]
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ RUN: %cat %S/Output/html/03_referencing_anchor_with_LINK_external/input.html | f
CHECK-HTML-DOC: <p>See the <a href="../03_referencing_anchor_with_LINK_external/input2.html#AD1">{{.*}}AD1</a> for more details.</p>
CHECK-HTML-DOC: <p>See the <a href="../03_referencing_anchor_with_LINK_external/input2.html#AD2">{{.*}}Software requirements specification</a> for more details.</p>
CHECK-HTML-DOC: <p>See the <a href="../03_referencing_anchor_with_LINK_external/input2.html#Interface_Control_Document">{{.*}}Interface_Control_Document</a> for more details.</p>
CHECK-HTML-DOC: <p>See the <a href="../03_referencing_anchor_with_LINK_external/input2.html#AD4">{{.*}}AD4</a> for more details.</p>
CHECK-HTML-DOC: <p>See the <a href="../03_referencing_anchor_with_LINK_external/input2.html#AD5">{{.*}}Software Tests</a> for more details.</p>
CHECK-HTML-DOC: <p>See the <a href="../03_referencing_anchor_with_LINK_external/input2.html#Supplemental-Guide">{{.*}}Supplemental Guide</a> for more details.</p>

RUN: %cat %S/Output/html/03_referencing_anchor_with_LINK_external/input2.html | filecheck %s --dump-input=fail --check-prefix CHECK-HTML-DOC2
CHECK-HTML-DOC2:<sdoc-anchor id="AD1"{{.*}}
Expand All @@ -13,3 +16,9 @@ CHECK-HTML-DOC2:<sdoc-anchor id="AD2"{{.*}}
CHECK-HTML-DOC2:<li>AD2. Software requirements specification.</li>
CHECK-HTML-DOC2:<sdoc-anchor id="Interface_Control_Document"{{.*}}
CHECK-HTML-DOC2:<li>AD3. Interface Control Document.</li>
CHECK-HTML-DOC2:<sdoc-anchor id="AD4"{{.*}}
CHECK-HTML-DOC2:<li>AD4. Threat Model.</li>
CHECK-HTML-DOC2:<sdoc-anchor id="AD5"{{.*}}
CHECK-HTML-DOC2:<li>AD5. Software Tests.</li>
CHECK-HTML-DOC2:<sdoc-anchor id="Supplemental Guide"{{.*}}
CHECK-HTML-DOC2:<li>AD6. Supplemental Guide.</li>

0 comments on commit f79d01e

Please sign in to comment.