From: tla Date: Wed, 14 Aug 2013 12:40:01 +0000 (+0200) Subject: Better regexp to quote-wrap words in stemma dot. Fixes #19, again. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4770d07784e75a7f842b061a359f7e4d5644fe51;p=scpubgit%2Fstemmaweb.git Better regexp to quote-wrap words in stemma dot. Fixes #19, again. --- diff --git a/lib/stemmaweb/Controller/Root.pm b/lib/stemmaweb/Controller/Root.pm index f2488ad..51d7dff 100644 --- a/lib/stemmaweb/Controller/Root.pm +++ b/lib/stemmaweb/Controller/Root.pm @@ -352,10 +352,10 @@ sub stemma :Local :Args(2) { if( $ok eq 'full' ) { my $dot = $c->request->body_params->{'dot'}; # Graph::Reader::Dot does not handle bare unicode. We get around this - # by wrapping all words in double quotes, but then we have to undo it - # for the initial 'digraph stemma' statement. Horrible hack. - $dot =~ s/\b(\w+)\b/"$1"/g; - $dot =~ s/"(digraph|stemma)"/$1/g; + # by wrapping all words in double quotes, as long as they aren't already + # wrapped, and as long as they aren't the initial 'digraph stemma'. + # Horrible HACK. + $dot =~ s/(?