function escapedchar_pre($string) {
//Replaces escaped control characters with a placeholder BEFORE processing
- $escapedcharacters = array("\\#", "\\=", "\\{", "\\}", "\\~", "\\n" ); //dlnsk
- $placeholders = array("&&035;", "&&061;", "&&123;", "&&125;", "&&126;", "&&010" ); //dlnsk
+ $escapedcharacters = array("\\:", "\\#", "\\=", "\\{", "\\}", "\\~", "\\n" ); //dlnsk
+ $placeholders = array("&&058;", "&&035;", "&&061;", "&&123;", "&&125;", "&&126;", "&&010" ); //dlnsk
$string = str_replace("\\\\", "&&092;", $string);
$string = str_replace($escapedcharacters, $placeholders, $string);
function escapedchar_post($string) {
//Replaces placeholders with corresponding character AFTER processing is done
- $placeholders = array("&&035;", "&&061;", "&&123;", "&&125;", "&&126;", "&&010"); //dlnsk
- $characters = array("#", "=", "{", "}", "~", "\n" ); //dlnsk
+ $placeholders = array("&&058;", "&&035;", "&&061;", "&&123;", "&&125;", "&&126;", "&&010"); //dlnsk
+ $characters = array(":", "#", "=", "{", "}", "~", "\n" ); //dlnsk
$string = str_replace($placeholders, $characters, $string);
return $string;
}
} // end function readquestion($lines)
function repchar( $text, $format=0 ) {
- // escapes 'reserved' characters # = ~ { ) and removes new lines
+ // escapes 'reserved' characters # = ~ { ) : and removes new lines
// also pushes text through format routine
- $reserved = array( '#', '=', '~', '{', '}', "\n","\r");
- $escaped = array( '\#','\=','\~','\{','\}','\n','' ); //dlnsk
+ $reserved = array( '#', '=', '~', '{', '}', ':', "\n","\r");
+ $escaped = array( '\#','\=','\~','\{','\}','\:','\n','' ); //dlnsk
$newtext = str_replace( $reserved, $escaped, $text );
$format = 0; // turn this off for now
$wrong_feedback = $this->repchar( $wrong_feedback );
$right_feedback = $this->repchar( $right_feedback );
- $expout .= "::".$question->name."::".$tfname.$this->repchar( $question->questiontext,$textformat )."{".$this->repchar( $answertext );
+ $expout .= "::".$this->repchar($question->name)."::".$tfname.$this->repchar( $question->questiontext,$textformat );
+ $expout .= "{".$this->repchar( $answertext );
if ($wrong_feedback!="") {
$expout .= "#".$wrong_feedback;
}
$expout .= "}\n";
break;
case MULTICHOICE:
- $expout .= "::".$question->name."::".$tfname.$this->repchar( $question->questiontext, $textformat )."{\n";
+ $expout .= "::".$this->repchar($question->name)."::".$tfname.$this->repchar( $question->questiontext, $textformat )."{\n";
foreach($question->options->answers as $answer) {
if ($answer->fraction==1) {
$answertext = '=';
$expout .= "}\n";
break;
case SHORTANSWER:
- $expout .= "::".$question->name."::".$tfname.$this->repchar( $question->questiontext, $textformat )."{\n";
+ $expout .= "::".$this->repchar($question->name)."::".$tfname.$this->repchar( $question->questiontext, $textformat )."{\n";
foreach($question->options->answers as $answer) {
$weight = 100 * $answer->fraction;
$expout .= "\t=%".$weight."%".$this->repchar( $answer->answer )."#".$this->repchar( $answer->feedback )."\n";
$expout .= "}\n";
break;
case NUMERICAL:
- $expout .= "::".$question->name."::".$tfname.$this->repchar( $question->questiontext, $textformat )."{#\n";
+ $expout .= "::".$this->repchar($question->name)."::".$tfname.$this->repchar( $question->questiontext, $textformat )."{#\n";
foreach ($question->options->answers as $answer) {
if ($answer->answer != '') {
$expout .= "\t=".$answer->answer.":".(float)$answer->tolerance."#".$this->repchar( $answer->feedback )."\n";
$expout .= "}\n";
break;
case MATCH:
- $expout .= "::".$question->name."::".$tfname.$this->repchar( $question->questiontext, $textformat )."{\n";
+ $expout .= "::".$this->repchar($question->name)."::".$tfname.$this->repchar( $question->questiontext, $textformat )."{\n";
foreach($question->options->subquestions as $subquestion) {
$expout .= "\t=".$this->repchar( $subquestion->questiontext )." -> ".$this->repchar( $subquestion->answertext )."\n";
}