File tree Expand file tree Collapse file tree 4 files changed +52
-1
lines changed
strictdoc/export/html/generators
tests/integration/features/project_statistics/10_metric_sections_without_text Expand file tree Collapse file tree 4 files changed +52
-1
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,13 @@ def export(
39
39
):
40
40
if isinstance (node , SDocSection ):
41
41
document_tree_stats .total_sections += 1
42
- if len (node .free_texts ) == 0 :
42
+
43
+ contains_text_nodes = any (
44
+ isinstance (node_ , SDocNode )
45
+ and node_ .node_type == "TEXT"
46
+ for node_ in node .section_contents
47
+ )
48
+ if contains_text_nodes :
43
49
document_tree_stats .sections_without_free_text += 1
44
50
45
51
if isinstance (node , SDocNode ):
Original file line number Diff line number Diff line change
1
+ [DOCUMENT]
2
+ TITLE: Hello world doc
3
+
4
+ [SECTION]
5
+ TITLE: Section 1 (with text)
6
+
7
+ [TEXT]
8
+ STATEMENT: >>>
9
+ Text
10
+ <<<
11
+
12
+ [/SECTION]
13
+
14
+ [SECTION]
15
+ TITLE: Section 2 (with text)
16
+
17
+ [TEXT]
18
+ STATEMENT: >>>
19
+ Text
20
+ <<<
21
+
22
+ [/SECTION]
23
+
24
+ [SECTION]
25
+ TITLE: Section 3 (without text)
26
+
27
+ [/SECTION]
Original file line number Diff line number Diff line change
1
+ [project ]
2
+ title = " Test project"
3
+
4
+ features = [
5
+ " PROJECT_STATISTICS_SCREEN" ,
6
+ ]
Original file line number Diff line number Diff line change
1
+ RUN: %strictdoc export %S --output-dir Output | filecheck %s --dump-input=fail
2
+ CHECK: Published: Hello world doc
3
+
4
+ RUN: %check_exists --file "%S/Output/html/project_statistics.html"
5
+
6
+ RUN: %cat "%S/Output/html/project_statistics.html" | filecheck %s --dump-input=fail --check-prefix CHECK-HTML
7
+ CHECK-HTML: Total sections
8
+ CHECK-HTML: 3
9
+ CHECK-HTML: Sections without any text
10
+ CHECK-HTML: 2
11
+ CHECK-HTML: Total requirements
12
+ CHECK-HTML: 1
You can’t perform that action at this time.
0 commit comments