{foo is awesome and so is {bar}}
####
{foo is not {balanced}
####
{center foo}
||this is comment
####
|| an open brace looks like this {
{beginning of a block
{some function}
end of a block}
####
$text =~ s/\|\|(.*?)\n/\<\!\-\-$1\-\-\>\n/g; #turn line comment form into XML comment form
$text =~ s/<\!\-\-(.*?)\}(.*?)\-\->/<\!\-\-$1 endbrace $2\-\->/gxs; #escape the end braces in comment so they needn't be balanced
$text =~ s/<\!\-\-(.*?)\{(.*?)\-\->/<\!\-\-$1 openbrace $2\-\->/gxs; #ditto for open braces
####
||{paragraph The union of zero or more {glossary citation="type", types }
|| may be denoted using {ONE-OF }. For example, the
|| {glossary type expression } {ctext {one-of int float } } {glossary
|| citation="evaluate", evaluates } to a non- {glossary
|| representational type } that can be used to {glossary declare } a {glossary
|| variable } that can hold either an {INT } or a {FLOAT }. }
####
>
a >
or a . > -->