Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion strictdoc/export/html/generators/project_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ def export(
):
if isinstance(node, SDocSection):
document_tree_stats.total_sections += 1
if len(node.free_texts) == 0:

contains_text_nodes = any(
isinstance(node_, SDocNode)
and node_.node_type == "TEXT"
for node_ in node.section_contents
)
if contains_text_nodes:
document_tree_stats.sections_without_free_text += 1

if isinstance(node, SDocNode):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[DOCUMENT]
TITLE: Hello world doc

[SECTION]
TITLE: Section 1 (with text)

[TEXT]
STATEMENT: >>>
Text
<<<

[/SECTION]

[SECTION]
TITLE: Section 2 (with text)

[TEXT]
STATEMENT: >>>
Text
<<<

[/SECTION]

[SECTION]
TITLE: Section 3 (without text)

[/SECTION]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[project]
title = "Test project"

features = [
"PROJECT_STATISTICS_SCREEN",
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
RUN: %strictdoc export %S --output-dir Output | filecheck %s --dump-input=fail
CHECK: Published: Hello world doc

RUN: %check_exists --file "%S/Output/html/project_statistics.html"

RUN: %cat "%S/Output/html/project_statistics.html" | filecheck %s --dump-input=fail --check-prefix CHECK-HTML
CHECK-HTML: Total sections
CHECK-HTML: 3
CHECK-HTML: Sections without any text
CHECK-HTML: 2
CHECK-HTML: Total requirements
CHECK-HTML: 1
Loading