yast / yast-yast2

YaST module yast2
http://en.opensuse.org/Portal:YaST
GNU General Public License v2.0
54 stars 44 forks source link

do not strip trailing white space in XML elements (bsc#1195910) #1241

Closed wfeldt closed 2 years ago

wfeldt commented 2 years ago

Task

Surrounding white space in some elements may be desired. Like in scripts or other file content. Be more careful when removing it.

The catch

The AutoYaST profile is processed by YaST to construct the final profile. It's written, modified by scripts, then read again, for example. Ensure that during this processing the CDATA 'attribute' to elements is not lost.

Solution

Strip leading white space when reading XML CDATA blocks. And create CDATA blocks when generating XML if an element contains trailing white space.

Note

Why not also keeping leading white space? - It's common to have a leading newline in script sections. They must be removed.

coveralls commented 2 years ago

Coverage Status

Coverage increased (+0.006%) to 41.638% when pulling 6151ff4a3267643dbd7d58ac29c50b2a00eea566 on sw_10 into 6b08011b27346a4364da8d05ed1c2697a2868b90 on master.

wfeldt commented 2 years ago

replaced by https://github.com/yast/yast-yast2/pull/1243