Skip to content

Instantly share code, notes, and snippets.

@so-c
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save so-c/9369368 to your computer and use it in GitHub Desktop.
Save so-c/9369368 to your computer and use it in GitHub Desktop.
Mirror House Annex更新用ユーティリティ。サクラエディタで動作。
/*
* 台詞を発言者を現すクラスを指定したタグで括る。
* 事前条件:双司の台詞と希の台詞が空行を挟んで交互に並んでいること。
*
* 1:双司の台詞
* 2:空行
* 3:希の台詞
* ...
* 2n+1: 双司の台詞
* 2n+2: 空行
* 2n+3: 希の台詞
* ...
*/
(function(){
var lineCounts = Editor.GetLineCount(0),
soshiStartTag = "<div class=\"kakko soshi\">",
nozomiStartTag ="<div class=\"kakko nozomi\">" ,
endTag = "</div>",
i;
Editor.TextWrapMethod(0); // 0:折り返さない
Editor.GoFileTop( );
for (i = 0; i < lineCounts; i += 2) {
Editor.GoLineTop(1);
if (i % 4 === 0) {
Editor.InsText(soshiStartTag);
}
if (i % 4 === 2) {
Editor.InsText(nozomiStartTag);
}
Editor.GoLineEnd();
Editor.InsText(endTag);
Editor.Down2( );
}
}())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment