Index: /MediaWiki/trunk/FCKeditor.body.php
===================================================================
--- /MediaWiki/trunk/FCKeditor.body.php	(revision 1940)
+++ /MediaWiki/trunk/FCKeditor.body.php	(revision 1941)
@@ -124,4 +124,20 @@
 		return true;
 	}
+	
+	public function onSanitizerAfterFixTagAttributes($text, $element, &$attribs)
+	{
+		$text = preg_match_all("/Fckmw\d+fckmw/", $text, $matches);
+		
+		if (!empty($matches[0][0])) {
+			global $leaveRawTemplates;
+			if (!isset($leaveRawTemplates)) {
+				$leaveRawTemplates = array();
+			}
+			$leaveRawTemplates = array_merge($leaveRawTemplates, $matches[0]);
+			$attribs = array_merge($attribs, $matches[0]);
+		}
+
+		return true;
+	}
 
 	public function registerHooks() {
@@ -139,4 +155,5 @@
 		$wgHooks['ParserBeforeInternalParse'][]         = array($this, "onParserBeforeInternalParse");
 		$wgHooks['EditPageBeforeConflictDiff'][]		= array($this, 'onEditPageBeforeConflictDiff');
+		$wgHooks['SanitizerAfterFixTagAttributes'][]	= array($this, 'onSanitizerAfterFixTagAttributes');
 
 		if ($this->debug) {
Index: /MediaWiki/trunk/FCKeditorParser.body.php
===================================================================
--- /MediaWiki/trunk/FCKeditorParser.body.php	(revision 1940)
+++ /MediaWiki/trunk/FCKeditorParser.body.php	(revision 1941)
@@ -464,4 +464,10 @@
 
 		if (!empty($this->fck_mw_strtr_span)) {
+			global $leaveRawTemplates;
+			if (!empty($leaveRawTemplates)) {
+				foreach ($leaveRawTemplates as $l) {
+					$this->fck_mw_strtr_span[$l] = substr($this->fck_mw_strtr_span[$l], 30, -7);
+				}
+			}
 			$parserOutput->setText(strtr($parserOutput->getText(), $this->fck_mw_strtr_span));
 		}
Index: /MediaWiki/trunk/mw12/FCKeditorParser_OldPP.body.php
===================================================================
--- /MediaWiki/trunk/mw12/FCKeditorParser_OldPP.body.php	(revision 1940)
+++ /MediaWiki/trunk/mw12/FCKeditorParser_OldPP.body.php	(revision 1941)
@@ -464,4 +464,10 @@
 
 		if (!empty($this->fck_mw_strtr_span)) {
+			global $leaveRawTemplates;
+			if (!empty($leaveRawTemplates)) {
+				foreach ($leaveRawTemplates as $l) {
+					$this->fck_mw_strtr_span[$l] = substr($this->fck_mw_strtr_span[$l], 30, -7);
+				}
+			}
 			$parserOutput->setText(strtr($parserOutput->getText(), $this->fck_mw_strtr_span));
 		}
Index: /MediaWiki/trunk/plugins/mediawiki/fckplugin.js
===================================================================
--- /MediaWiki/trunk/plugins/mediawiki/fckplugin.js	(revision 1940)
+++ /MediaWiki/trunk/plugins/mediawiki/fckplugin.js	(revision 1941)
@@ -676,5 +676,11 @@
 					sAttValue = htmlNode.getAttribute( sAttName, 2 ) ;	// We must use getAttribute to get it exactly as it is defined.
 
-				attStr += ' ' + sAttName + '="' + String(sAttValue).replace( '"', '&quot;' ) + '"' ;
+				// leave templates
+				if ( sAttName.StartsWith( '{{' ) && sAttName.EndsWith( '}}' ) ) {
+					attStr += ' ' + sAttName ;
+				}
+				else {
+					attStr += ' ' + sAttName + '="' + String(sAttValue).replace( '"', '&quot;' ) + '"' ;
+				}
 			}
 		}
