From: Gabriel Wicke Date: Tue, 1 Jun 2004 22:19:22 +0000 (+0000) Subject: nowiki handling X-Git-Tag: 1.5.0alpha1~3086 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=afd3aaa6d1855bb65475e38745e04f6c62da939a;p=lhc%2Fweb%2Fwiklou.git nowiki handling nowiki areas are wrapped in $content ){ if( $render ){ - $nowiki_content[$marker] = wfEscapeHTMLTagsOnly( $content ); + # use span to mark nowiki areas, note the trailing whitespace in span to avoid collisions with other spans + $nowiki_content[$marker] = ''.wfEscapeHTMLTagsOnly( $content ).""; } else { $nowiki_content[$marker] = "$content"; } @@ -1019,12 +1022,17 @@ class Parser } foreach ( $textLines as $oLine ) { $lastPrefixLength = strlen( $lastPrefix ); - $preCloseMatch = preg_match("/<\\/pre/i", $oLine ); $preOpenMatch = preg_match("/
/", $oLine );
 			if (!$this->mInPre) {
 				$this->mInPre = !empty($preOpenMatch);
 			}
-			if ( !$this->mInPre ) {
+			if (!$this->mInNowiki) {
+				$this->mInNowiki = !empty($nowikiOpenMatch);
+			}
+			if ( !$this->mInPre && !$this->mInNowiki ) {
 				# Multiple prefixes may abut each other for nested lists.
 				$prefixLength = strspn( $oLine, "*#:;" );
 				$pref = substr( $oLine, 0, $prefixLength );
@@ -1104,8 +1112,11 @@ class Parser
 					} else {
 						$inBlockElem = true;
 					}
-				} else if ( !$inBlockElem && !$this->mInPre ) {
-					if ( " " == $t{0} and trim($t) != '' ) {
+				} else if ( 
+					!$inBlockElem && !$this->mInPre && 
+					(!$this->mInNowiki || ($nowikiOpenMatch && trim($nowikiOpenMatches[1]) == ''  ) ) ) 
+					{
+					if ( " " == $t{0} and trim($t) != '' and (!$this->mInNowiki || $nowikiOpenMatch && strlen($nowikiOpenMatches[1]) > 0 ) ) {
 						// pre
 						if ($this->mLastSection != 'pre') {
 							$paragraphStack = false;
@@ -1140,6 +1151,7 @@ class Parser
 						}
 					}
 				}
+				if($nowikiCloseMatch) $this->mInNowiki = false;
 			}
 			if ($paragraphStack === false) {
 				$output .= $t."\n";