The GtkDialog - tips thread in the Murga forum states
8.) Advanced Syntax - make your code readable
###################################################################################Comments in your code
Gtkdialog doesn't support comments in its xml code. But if we convert all comments before execution, it works. The reason why I use double hash (##) for my comments, is because colors in a <span> tag might be defined as 'red' or '#FF0000'. The latter would be removed by using a single hash.
Well, using double hash (##) is not a good idea because they are used in bash constructs like ${variable##*/}
, however using the Geany default comment markers hash+tilde (#~) is safe. This method to use and then clean comment markers before passing the GUI description to gtkdialog is what I used so far.
By chance I now discovered that comments in XML style <!-- comment -->
are supported in newer versions. The comments may even span multiple lines. In BW64, using gtkdialog version 0.8.5, this works
Code: Select all
#!/bin/sh
export DIALOG='
<!-- This is a comment -->
<edit></edit>
<!-- This is
a multiline
comment -->'
gtkdialog -p DIALOG
In older versions, e.g. 0.8.4 of Slacko 5.6, it would produce a syntax error.
Though I will continue to use #~ markers for backward compatibility, the <!-...--> syntax might be useful for other users.