Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/365450 )
Change subject: Add Css classes in quiz extension to provide flexibility
......................................................................
Add Css classes in quiz extension to provide flexibility
This change adds the option of showing question numbering even if there
is only one question in quiz.This can be achieved by giving class=number
to the quiz.
Bug: T148624
Change-Id: I9c749745359739327b82c2525cfb29283829a7f9
---
M Quiz.class.php
1 file changed, 6 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/50/365450/1
diff --git a/Quiz.class.php b/Quiz.class.php
index 0a43cfa..4b8c183 100644
--- a/Quiz.class.php
+++ b/Quiz.class.php
@@ -81,7 +81,11 @@
}
$this->mShuffle = !( array_key_exists( 'shuffle', $argv ) &&
$argv['shuffle'] == 'none' );
$this->mCaseSensitive = !( array_key_exists( 'case', $argv ) &&
$argv['case'] == '(i)' );
-
+ $classes = array_key_exists( 'class', $argv ) ? $argv['class']
: '' ;
+ $class = explode( ';', $classes );
+ foreach( $class as $val ){
+ $this->isClass[ $val ] = 1;
+ }
// Patterns used in several places
$this->mIncludePattern = '`^\{\{:?(.*)\}\}[ \t]*`m';
}
@@ -250,7 +254,7 @@
$output = '';
$questionPattern = '`(.*?[^|\}])\}[ \t]*(\n(.*)|$)`s';
$this->numberQuestions = count( $unparsedQuestions );
- $numDisplay = $this->numberQuestions > 1;
+ $numDisplay = $this->numberQuestions > 1 ? 1 : ( isset(
$this->isClass['number'] ) ? 1 : 0 );
foreach ( $unparsedQuestions as $unparsedQuestion ) {
// If this "unparsedQuestion" is not a full question,
// we put the text into a buffer to add it at the
beginning of the next question.
--
To view, visit https://gerrit.wikimedia.org/r/365450
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9c749745359739327b82c2525cfb29283829a7f9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits