文書整形マクロ

投稿者: Yutaka Emura1 声1 投稿

文書整形マクロです。このマクロを実行する前に、EmEditor の折り返し位置を好きな桁 (たとえば 74 桁) に設定して、指定文字数で折り返しの状態にしてください。 https://emeditorjp.wpengine.com/modules/newbb/viewtopic.php?topic_id=544&forum=4&post_id=2539#forumpost2539 を参照してください。
document.selection.SelectAll(); document.selection.Format(eeFormatJoinLines); nIndent = 0; nLines = document.GetLines( eeGetLineView ); for( y = 1; y <= nLines; y++ ){ document.selection.SetActivePoint( eePosView, 1, y ); xLogical = document.selection.GetActivePointX( eePosLogical ); if( xLogical == 1 ){ sIndent = ""; sLine = document.GetLine( y, eeGetLineView ); for( x = 0; x < sLine.length; x++ ){ ch = sLine.substring( x, x + 1 ); halfwidth = /[ ([{「<^_*]/; fullwidth = /[ (「{<[《『【※・▼▽▲△◆■□○◎●☆★]/; if( halfwidth.test( ch ) ){ sIndent += " "; } else if( fullwidth.test( ch ) ){ sIndent += " "; } else if( ch == "t" ){ sIndent += "t"; } else { break; } } } else if( xLogical > 1 ){ document.writeln( "" ); document.write( sIndent ); } }

このトピックの投稿: 1