Changeset 32573 for main/trunk/greenstone2/perllib/docprint.pm
- Timestamp:
- 2018-11-05T19:24:47+13:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/docprint.pm
r32536 r32573 108 108 } 109 109 110 # pass by ref version: gets a ref to a string and returns ref to the modified string 111 # so use this for large strings (fulltext) 112 sub escape_textref { 113 my ($textref) = @_; 114 # special characters in the xml encoding 115 $$textref =~ s/&&/& &/g; 116 $$textref =~ s/&/&/g; # this has to be first... 117 $$textref =~ s/</</g; 118 $$textref =~ s/>/>/g; 119 $$textref =~ s/\"/"/g; 120 121 return $textref; 122 } 123 124 # pass by value - the behaviour of the escape_text method used so far is to pass copies of strings 110 125 sub escape_text { 111 126 my ($text) = @_; 112 # special characters in the xml encoding 113 $text =~ s/&&/& &/g; 114 $text =~ s/&/&/g; # this has to be first... 115 $text =~ s/</</g; 116 $text =~ s/>/>/g; 117 $text =~ s/\"/"/g; 118 119 return $text; 127 my $textref = &escape_textref(\$text); 128 return $$textref; 120 129 } 121 130
Note:
See TracChangeset
for help on using the changeset viewer.