/**
	 * Get a new WCSection object based on HTML arguments.
	 * @param array $args = "citeStyle" or "type" (or equivalent foreign words)
	 * @param WCStyle $defaultStyle
	 * @param WCCitationTypeEnum $defaultType
	 * @return WCSection
	 */
	public static function getSection( array $args, $defaultStyle, $defaultType ) {
		foreach( $args as $attrib => $value ) {
			if ( in_array( $attrib, self::$citeStyleAttributeWords ) ) {
				$styleClassName = WCArgumentReader::matchStyleClassName( $value );
			} elseif ( in_array( $attrib, self::$typeAttributeWords ) ) {
				$citationTypeID = WCCitationTypeEnum::match( $value );
				if ( isset( $citationTypeID ) ) {
					$citationType = new WCCitationTypeEnum( $citationTypeID );
				}
			} elseif ( $args[ 'style' ] ) {
				$this->styleHTML = ' style="' . $args[ 'style' ] . '"';
			} elseif ( $args[ 'id' ] ) {
				$this->styleHTML = ' id="' . $args[ 'id' ] . '"';
			}
		}
		if ( isset( $styleClassName ) ) {
			# See if a specific style object has already been defined, and if so, use it.
			$styleObject = WCArticle::getStyle( $styleClassName );
		} else {
			# Use default citation style.
			$styleObject = $defaultStyle;
		}
		if ( isset( $citationType ) ) {
			return new WCSection( $styleObject, $citationType );
		} else {
			return new WCSection( $styleObject, $defaultType );
		}
	}
	/**
	 * Static initializer.
	 */
	public static function init() {
		global $wgWCCitationStyles;
		$defaultStyleName = $wgWCCitationStyles[ self::defaultStyleID ];
		self::$defaultStyle = self::getStyle( $defaultStyleName );
	}
	/**
	 * Handler for 'ParserBeforeTidy' parser hook.
	 *
	 * Called by Parser object near the end of parsing. Renders citations in
	 * html and replaces the citation markers with the html citations.
	 * Also, this method links a style sheet to pages containing citations.
	 *
	 * @static
	 * @global type $wgOut
	 * @global type $wgWCStyleSheet
	 * @param Parser $parser = the parser
	 * @param string $text = the current parsed text of the article
	 */
	public static function onParserBeforeTidy( Parser $parser, &$text ) {
		# Insert citations.
		self::$article->render( $text );
		return True;
	}