From: jj v. a. <we...@ma...> - 2005-08-12 23:31:23
|
Log Message: ----------- Print titles with underscores replaced by non-breaking spaces. It makes the names of courses and problem sets look nicer for students. Also removed a function which was already commented out, and not needed. Modified Files: -------------- webwork-modperl/lib/WeBWorK: ContentGenerator.pm Revision Data ------------- Index: ContentGenerator.pm =================================================================== RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/ContentGenerator.pm,v retrieving revision 1.145 retrieving revision 1.146 diff -Llib/WeBWorK/ContentGenerator.pm -Llib/WeBWorK/ContentGenerator.pm -u -r1.145 -r1.146 --- lib/WeBWorK/ContentGenerator.pm +++ lib/WeBWorK/ContentGenerator.pm @@ -878,7 +878,7 @@ my $r = $self->r; #print "\n<!-- BEGIN " . __PACKAGE__ . "::title -->\n"; - print $r->urlpath->name; + print underscore2nbsp($r->urlpath->name); #print "<!-- END " . __PACKAGE__ . "::title -->\n"; return ""; @@ -1666,24 +1666,23 @@ sub sp2nbsp { my ($str) = @_; return unless defined $str; - #$str =~ s/ / /g; $str =~ s/\s/ /g; return $str; } -# FIXME -- I don't think we need both this and the one above. -# Remove this comment block after some time.(2/6/05) -# =item space2nbsp($string) -# -# Replace spaces in the string with html non-breaking spaces. -# -# =cut -# -# sub space2nbsp { -# my $str = shift; -# $str =~ s/\s/ /g; -# return($str); -# } +=item underscore2nbsp($string) + +A copy of $string is returned with each underscore character replaced by the +C< > entity. + +=cut + +sub underscore2nbsp { + my ($str) = @_; + return unless defined $str; + $str =~ s/_/ /g; + return $str; +} =item errorOutput($error, $details) |