$q =~ s! (/\w[\S]+/[\S]+)! <code>$1</code>!g;
$a =~ s/[\s\n]+$/\n/;
$a =~ s/^\s+//;
- while ($a =~ s/^(\s*)\*/$1<ul>\n$1<li>/m) {
+ while ($a =~ s/^(\s*)\*/$1<ul>\n$1<li>/m) {
while ($a =~ s/(<li>.*\n\s*)\*/$1<li>/g) {}
$a =~ s:(.*\n)(\s*)(<li>[^\n]+\n):$1$2$3$2</ul>\n:s
}