Index: FCKeditor.body.php
===================================================================
--- FCKeditor.body.php	(revision 1929)
+++ FCKeditor.body.php	(working copy)
@@ -123,7 +123,23 @@
 				
 		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() {
 		global $wgHooks, $wgExtensionFunctions;
 
@@ -138,6 +154,7 @@
 		$wgHooks['LanguageGetMagic'][]                  = array($this, "onLanguageGetMagic");
 		$wgHooks['ParserBeforeInternalParse'][]         = array($this, "onParserBeforeInternalParse");
 		$wgHooks['EditPageBeforeConflictDiff'][]		= array($this, 'onEditPageBeforeConflictDiff');
+		$wgHooks['SanitizerAfterFixTagAttributes'][]	= array($this, 'onSanitizerAfterFixTagAttributes');
 
 		if ($this->debug) {
 			/*
Index: FCKeditorParser.body.php
===================================================================
--- FCKeditorParser.body.php	(revision 1896)
+++ FCKeditorParser.body.php	(working copy)
@@ -463,6 +463,12 @@
 		}
 
 		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: mw12/FCKeditorParser_OldPP.body.php
===================================================================
--- mw12/FCKeditorParser_OldPP.body.php	(revision 1896)
+++ mw12/FCKeditorParser_OldPP.body.php	(working copy)
@@ -463,6 +463,12 @@
 		}
 
 		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));
 		}
 		if (!empty($this->fck_matches)) {
Index: plugins/mediawiki/fckplugin.js
===================================================================
--- plugins/mediawiki/fckplugin.js	(revision 1897)
+++ plugins/mediawiki/fckplugin.js	(working copy)
@@ -672,7 +672,13 @@
 				else
 					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;' ) + '"' ;
+				}
 			}
 		}
 		return attStr ;
