This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CmdParser { | |
def args | |
def cli | |
def CmdParser( def args ){ | |
this.args = args | |
cli = new CliBuilder() | |
cli.i(argName:'input', required:true ,args:1 , 'input file') | |
cli.o(argName:'output', required:true ,args:1 , 'output file') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > | |
<xsl:output method="xml" indent="yes" encoding="UTF-8" /> | |
<xsl:template match="@*|node()" > | |
<xsl:copy> | |
<xsl:apply-templates select="@*|node()" /> | |
</xsl:copy> | |
</xsl:template> | |
</xsl:stylesheet> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// [使い方] | |
// groovy -c UTF-8 -i src.xml -o compact.xml | |
// | |
// [機能] | |
// src.xml のインデント・改行等を削除してコンパクト形式に変換する/Pretty形式にも変換可能 | |
// | |
// [依存] | |
// - jdom.jar | |
// - CmdProc.groovy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IndUtil { | |
// Windows専用 | |
// WindowsスタイルのファイルパスをExtendScriptで使える形式に変換して返す. | |
static String toIndPath( File filePath ){ | |
//def path = filePath.absolutePath | |
def path = filePath.canonicalPath | |
path.replaceAll('\\\\','/') | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// InDesign ドキュメントのXMLツリーから 要素 "Image" を探し出し、その position 属性の値を表示. | |
// | |
function procImage( eImage ){ | |
var attrs = eImage.xmlAttributes | |
for(var i=0; i<attrs.length; i++){ | |
var attr = attrs.item(i); | |
if( attr.name == 'position' ){ | |
alert( attr.value ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Rhino を使って JavaScript からローカルファイルを読む. | |
// | |
importPackage(java.io); | |
var filename = "foo.txt"; | |
var br = BufferedReader( InputStreamReader( FileInputStream( filename ) ) ); | |
while( line= br.readLine() ){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// {cdate:yyyy-mm-dd} 形式のタイムスタンプを必要なら追加する. | |
// | |
class BlogUtils { | |
static def ENC = 'UTF-8' | |
boolean hasCdate( File f ){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// {key:value} スタイル表記のマクロプロセッサ | |
// | |
import java.util.regex.Pattern | |
class MacroProcessor { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MacroProcessor.groovyの利用例 | |
// | |
// マクロをどう処理するかを記述 | |
def proc( macroText ){ | |
def mp = new MacroProcessor( macroText ) | |
'<span aid:cstyle="' + mp.key + '">' + mp.value + '</span>' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MacroProcessor.groovyを利用する便利クラス | |
// | |
class TextProcessor { | |
def 変換処理のClosure | |
def TextProcessor(Closure 変換処理のClosure){ | |
this.変換処理のClosure = 変換処理のClosure | |
} |
OlderNewer