1+ @startuml
2+
3+ ' ############################################
4+ ' ---------------------------------------------
5+ ' introduce "newline" into a List in order to
6+ ' break it down after each colon
7+ !function formatListSL ($text )
8+ !$result = ""
9+ !$index = 0
10+ !$text_length = %strlen ($text )
11+
12+ !while ($index < $text_length )
13+ !$char = %substr ($text , $index , 1 )
14+ !$index = $index + 1
15+
16+ !if ($char == "[")
17+ !continue
18+ !endif
19+
20+ !if ($char == "]")
21+ !break
22+ !endif
23+
24+ !$result = $result + $char
25+
26+ !if ($char == ",")
27+ !$result = $result + "\n "
28+ !endif
29+ !endwhile
30+
31+ !return $result
32+ !endfunction
33+
34+
35+
36+
37+ ' ############################################
38+ ' ---------------------------------------------
39+ ' introduce "newline" into a string in order to
40+ ' break it down into several lines according
41+ ' to a given char width of a line.
42+ !function _PUMLABreakLineNL ($text )
43+ ! $result = ""
44+ ! $current_line = ""
45+ ! $current_word = ""
46+ ! $current_length = 0
47+ ! $text_length = %strlen ($text )
48+ ! $index = 0
49+
50+ !while ($index < $text_length )
51+ ! $char = %substr ($text , $index , 1 )
52+ ! $index = $index + 1
53+
54+ !if ($char == " ")
55+ !if ($current_length + %strlen ($current_word ) > $PUMReqContentWidth )
56+ ! $result = $result + $current_line + "%newline ()"
57+ ! $current_line = $current_word
58+ ! $current_length = %strlen ($current_word )
59+ !else
60+ !if ($current_length > 0 )
61+ ! $current_line = $current_line + " "
62+ ! $current_length = $current_length + 1
63+ !endif
64+ ! $current_line = $current_line + $current_word
65+ ! $current_length = $current_length + %strlen ($current_word )
66+ !endif
67+ ! $current_word = ""
68+ !else
69+ ! $current_word = $current_word + $char
70+ !endif
71+ !endwhile
72+
73+ !if (%strlen ($current_word ) > 0 )
74+ !if ($current_length + %strlen ($current_word ) > $PUMReqContentWidth )
75+ ! $result = $result + $current_line + "%newline ()"
76+ ! $current_line = $current_word
77+ !else
78+ !if ($current_length > 0 )
79+ ! $current_line = $current_line + " "
80+ !endif
81+ ! $current_line = $current_line + $current_word
82+ !endif
83+ !endif
84+
85+ !return $result + $current_line
86+ !endfunction
87+
88+ ' ############################################
89+ ' ---------------------------------------------
90+ ' introduce "\\" into a string in order to
91+ ' break it down into several lines according
92+ ' to a given char width of a line.
93+ !function _PUMLABreakLineSL ($text )
94+ ! $result = ""
95+ ! $current_line = ""
96+ ! $current_word = ""
97+ ! $current_length = 0
98+ ! $text_length = %strlen ($text )
99+ ! $index = 0
100+
101+ !while ($index < $text_length )
102+ ! $char = %substr ($text , $index , 1 )
103+ ! $index = $index + 1
104+
105+ !if ($char == " ")
106+ !if ($current_length + %strlen ($current_word ) > $PUMReqContentWidth )
107+ ! $result = $result + $current_line + " \n "
108+ ! $current_line = $current_word
109+ ! $current_length = %strlen ($current_word )
110+ !else
111+ !if ($current_length > 0 )
112+ ! $current_line = $current_line + " "
113+ ! $current_length = $current_length + 1
114+ !endif
115+ ! $current_line = $current_line + $current_word
116+ ! $current_length = $current_length + %strlen ($current_word )
117+ !endif
118+ ! $current_word = ""
119+ !else
120+ ! $current_word = $current_word + $char
121+ !endif
122+ !endwhile
123+
124+ !if (%strlen ($current_word ) > 0 )
125+ !if ($current_length + %strlen ($current_word ) > $PUMReqContentWidth )
126+ ! $result = $result + $current_line + " \n "
127+ ! $current_line = $current_word
128+ !else
129+ !if ($current_length > 0 )
130+ ! $current_line = $current_line + " "
131+ !endif
132+ ! $current_line = $current_line + $current_word
133+ !endif
134+ !endif
135+
136+ !return $result + $current_line
137+ !endfunction
138+
1139' ############################################
2140' ---------------------------------------------
3141' create a req as an object with reduced number
12150' the $r object should not be possible here...
13151object $r . alias {
14152|= type | $r . type |
15- |= content | $r . content |
153+ |= content | _PUMLABreakLineSL ( $r . content ) |
16154|= status | $r . status |
17155}
18156%set_variable_value ($robjid , "%true()" )
@@ -100,6 +238,7 @@ PUMLAPutElementErrorCheck($int_suc, $alias)
100238!$cntall = $cntall +1
101239!if $count == $cntall
102240!$int_suc = %true ()
241+ !$r . content = _PUMLABreakLineSL ($r . content )
103242json $r . alias $r
104243!endif
105244!endfor
@@ -125,7 +264,7 @@ note as allreqstable
125264!foreach $r in $allreqs . reqs
126265!$cntall = $cntall +1
127266| | | | | | | |
128- | $cntall | $r . alias | $r . type | $r . content | $r . status | $r . derived_from | $r . derived_to | $r . in_file |
267+ | $cntall | $r . alias | $r . type | _PUMLABreakLineSL ( $r . content ) | $r . status | formatListSL ( $r . derived_from ) | formatListSL ( $r . derived_to ) | $r . in_file |
129268!endfor
130269
131270A total of $cntall requirements .
0 commit comments