EmEditorみんなでまとめサイト

HTMLタグ一括小文字変換マクロ

最終更新:

匿名ユーザー

- view
だれでも歓迎! 編集

マクロ

//HTML変更1.jsee
//文章全体を対象
//大文字にしたい場合は toLowerCase() を toUpperCase()に変更
document.selection.StartOfDocument();
while(document.selection.Find("<\\s*/?\\s*\\w+",eeFindNext|eeFindReplaceQuiet|eeFindReplaceRegExp)){

document.selection.text=document.selection.text.toLowerCase();

}

&lt>の中の文字を""にはさまれているもの以外は小文字(大文字)に変更するなら

//HTML変更2.jsee
//文章全体を対象
//大文字にしたい場合は toLowerCase() を toUpperCase()に変更
var s,i,out;
with(document.selection){
    StartOfDocument();
    while(Find("<\\s*[^!].*?>",eeFindNext|eeFindReplaceQuiet|eeFindReplaceRegExp)){
        s=text.split("\"");
        //""の対応がとれていない場合は何もしない
        if(!(s.length%2)) continue;
        out="";
        for(i=0;i<s.length;i++){
                if(!(i%2)) out += s[i].toLowerCase();
                else out += "\""+s[i]+"\"";
        }
        text=out;
    }
}

nessieさんMLへの投稿より

ウィキ募集バナー