「利用者:Nijcadmin/FY2012」の版間の差分

提供:脳科学辞典
ナビゲーションに移動 検索に移動
編集の要約なし
編集の要約なし
17行目: 17行目:
                         $rep = $this->fck_addToStrtr(htmlspecialchars($match[3], ENT_QUOTES), false);
                         $rep = $this->fck_addToStrtr(htmlspecialchars($match[3], ENT_QUOTES), false);
                         $rep2 = sprintf('[[%s%s|%s]]', $match[1], $match[2], $rep);
                         $rep2 = sprintf('[[%s%s|%s]]', $match[1], $match[2], $rep);
                         $text = str_replace($match[0], $rep2, $text);
                         $pos = strpos($text, $match[0]);
                        $text = substr_replace($text, $rep2, $pos, strlen($match[0]));
                 }
                 }
         }
         }

2012年9月18日 (火) 18:20時点における版

2012年9月18日(火)

FCKEditor で Image のキャプションにタグを使うと余計なコードが挿入される

  • WYSIWYG 入力フォームのレンダリング時にキャプションも HTML 変換してしまうのが原因
  • イメージのタイトル部分だけ変換しないようにしてしまうことで対処
function strip( $text, $state, $stripcomments = false , $dontstrip = array () ) {
        global $wgContLang, $wgUseTeX, $wgScriptPath, $wgVersion, $wgHooks, $wgExtensionFunctions;

        wfProfileIn( __METHOD__ );

        // NIJC: 2012/09/18 - escape to convert html for image caption
        if (preg_match_all('/\[\[([a-zA-Z0-9]+:[^\]]+)((?:\|[^\]]+)*)(?:\|([^\|]+))\]\]/Us', $text, $matches, PREG_SET_ORDER)) {
                foreach ($matches as $match) {
                        $rep = $this->fck_addToStrtr(htmlspecialchars($match[3], ENT_QUOTES), false);
                        $rep2 = sprintf('[[%s%s|%s]]', $match[1], $match[2], $rep);
                        $pos = strpos($text, $match[0]);
                        $text = substr_replace($text, $rep2, $pos, strlen($match[0]));
                }
         }

         $render = ($this->mOutputType == OT_HTML);

2012年8月19日(日)

Animation GIF のサイムネイルが生成されない

  • 「サムネイルの作成中にエラーが発生しました」と出力される
  • 変換にメモリを使いすぎないよう画像サイズに制限が入っている
    • アニメーションGIFの場合 縦 x 横 x フレーム数で計算するため大きくなる模様
  • 最大サイズを増やせばいい
$wgMaxImageArea = 5.00e7;

2012年7月14日(土)

リンクの直後に半角文字があると半角文字も含めリンクとして表示されてしまう

  • Mediawiki の仕様の模様
  • 参考URL http://www.mediawiki.org/wiki/Help:Links
    • Word-ending links, Avoiding word-ending links あたりを参照
  • TextRichEditor(FCKEditor) では表記が異なっている
    • 同様の動作をさせるのは結構難しそう

TextRichEditorで置換を行なうと余計なコードが入力されてしまう

  • 例えば「前」を「後」に置換すると
置換前
置換<span style="background-color: navy; color: white;" />後
  • とりあえず,空タグはTextRichEditor終了時に削り取るコードを追加

  • extensions/FCKeditor/plugins/mediawiki/fckplugin.js を以下のように修正
case 'fck_mw_gallery' :
        sNodeName = 'gallery' ;
        break ;

case 'fck_mw_onlyinclude' :
        sNodeName = 'onlyinclude' ;

        break ;
// NIJC: remove empty span elements
default:
        if ( htmlNode.innerHTML.match(/^\s*$/) )
                return;
}