sub getRenderedVersion
 {
  my( $text ) = @_;
  my $result = "";
  foreach( split( /\n/, $text ) ) {
   # link WikiWords:
   s/([\s\(\*])([A-Z]+[a-z]+(?:[A-Z]+[a-zA-Z0-9]*))
/$1&internalLink($2)/geo;
   # other rendering rules omitted...
   # ...
   $result .= $_;
  }
  return $result;
 }

 sub internalLink
 {
  my( $wikiWord ) = @_;
  topicExists( $wikiWord ) ?
    "<a href=\"$wikiWord\">$wikiWord<\/a>"
      : "$wikiWord<a href=\"../edit/$wikiWord\">?</a>";
  }