/**
	 * 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 );
		}
	}
	public static function init() {
		parent::init( self::$magicWordKeys, self::$substitutes,
				self::$magicWordArray, self::$flipMagicWordKeys );
		self::$inline     = new self( self::inline );
		self::$note       = new self( self::note );
		self::$biblio     = new self( self::biblio );
		self::$authorDate = new self( self::authorDate );
	}
	/**
	 * Recognize and process the flags.
	 *
	 * @global type $wikiCitationValidateArguments
	 */
	protected function matchFlags() {
		global $wikiCitationValidateArguments;
		foreach( $this->flags as $flag ) {
			# Match flag for citation type.
			$citationType = WCCitationTypeEnum::match( $flag );
			if ( $citationType ) {
				$this->citationType = $citationType;
				continue;
			}
			# Match flag for citation length.
			$citationLength = WCCitationLengthEnum::match( $flag );
			if ( $citationLength ) {
				$this->citationLength = $citationLength;
				continue;
			}
			# If the function encounters an unknown flag, an error is thrown.
			if ( $wikiCitationValidateArguments ) {
				throw new WCException( 'wc-flag-unknown', $flag );
			}
		}

		# Throw exception for explicit "short bibliography" citation.
		if ( isset( $this->citationLength )
			&& isset( $this->citationLength )
			&& $this->citationLength->key == WCCitationLengthEnum::short
			&& $this->citationType->key == WCCitationTypeEnum::biblio
			&& $wikiCitationValidateArguments )
		{
			if ( $wikiCitationValidateArguments) {
				throw new WCException(
					'wc-incompatible-flags',
					new WCCitationLengthEnum( WCCitationLengthEnum::short ),
					new WCCitationTypeEnum( WCCitationTypeEnum::biblio )
				);
			} else {
				$this->citationLength->key = WCCitationLengthEnum::long;
			}
		}

	}