[system] / trunk / webwork-modperl / lib / WeBWorK / ContentGenerator.pm Repository:
ViewVC logotype

Diff of /trunk/webwork-modperl/lib/WeBWorK/ContentGenerator.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 512 Revision 522
119 if ($function eq "if") { 119 if ($function eq "if") {
120 push @ifstack, $self->$function(@_, [@args]); 120 push @ifstack, $self->$function(@_, [@args]);
121 } elsif ($function eq "else" and @ifstack > 1) { 121 } elsif ($function eq "else" and @ifstack > 1) {
122 $ifstack[-1] = not $ifstack[-1]; 122 $ifstack[-1] = not $ifstack[-1];
123 } elsif ($function eq "endif" and @ifstack > 1) { 123 } elsif ($function eq "endif" and @ifstack > 1) {
124 pop $ifstack; 124 pop @ifstack;
125 } elsif ($ifstack[-1]) { 125 } elsif ($ifstack[-1]) {
126 print $self->$function(@_, {@args}); 126 print $self->$function(@_, {@args});
127 } 127 }
128 } 128 }
129 } 129 }
130 130
131 if ($ifstack[-1]) { 131 if ($ifstack[-1]) {
132 print substr $line, (defined pos $line) ? pos $line : 0); 132 print substr $line, (defined pos $line) ? pos $line : 0;
133 } 133 }
134 } 134 }
135} 135}
136 136
137# cook_args(STRING) - parses a string of the form ARG1="FOO" ARG2="BAR". Returns 137# cook_args(STRING) - parses a string of the form ARG1="FOO" ARG2="BAR". Returns
144 # Boy I love m//g in scalar context! Go read the camel book, heathen. 144 # Boy I love m//g in scalar context! Go read the camel book, heathen.
145 # First, get the whole token with the quotes on both ends... 145 # First, get the whole token with the quotes on both ends...
146 while ($raw_args =~ m/\G\s*(\w*)="((?:[^"\\]|\\.)*)"/g) { 146 while ($raw_args =~ m/\G\s*(\w*)="((?:[^"\\]|\\.)*)"/g) {
147 my ($key, $value) = ($1, $2); 147 my ($key, $value) = ($1, $2);
148 # ... then, rip out all the protecty backspaces 148 # ... then, rip out all the protecty backspaces
149 $value =~ s/\(.)/$1/g; 149 $value =~ s/\\(.)/$1/g;
150 push @args, $key => $value; 150 push @args, $key => $value;
151 } 151 }
152 152
153 return @args; 153 return @args;
154} 154}

Legend:
Removed from v.512  
changed lines
  Added in v.522

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9