Skip to content

Commit

Permalink
MDL-7913 Improved category detection (again) to extract all characters.
Browse files Browse the repository at this point in the history
  • Loading branch information
thepurpleblob committed Jan 5, 2007
1 parent dd0730c commit 5363b55
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions question/format/gift/format.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

<?php // $Id$
//
///////////////////////////////////////////////////////////////
// The GIFT import filter was designed as an easy to use method
// for teachers writing questions as a text file. It supports most
Expand Down Expand Up @@ -141,14 +141,17 @@ function readquestion($lines) {
$text = $this->escapedchar_pre($text);

// Look for category modifier
if (ereg( '^\$CATEGORY: *([A-Za-z0-9/]+)[[:space:]]', $text, $matches)) {
$newcategory = $matches[1];
if (ereg( '^\$CATEGORY:', $text)) {
// $newcategory = $matches[1];
$newcategory = trim(substr( $text, 10 ));

// build fake question to contain category
$question->qtype = 'category';
$question->category = $newcategory;
return $question;
}



// QUESTION NAME parser
if (substr($text, 0, 2) == "::") {
Expand Down

0 comments on commit 5363b55

Please sign in to comment.