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
def getTxtFileList = { dir-> | |
def list=[] | |
dir.listFiles( { it.name.endsWith('.txt') } as FileFilter ).each{ list.add(it) } | |
list | |
} | |
getTxtFileList(new File('.')).each{ println it } |
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
(function(){ | |
var exportPageAsJpeg = function( myDocument, myPage, myFilePath ){ | |
app.jpegExportPreferences.pageString = myPage.name; | |
myDocument.exportFile(ExportFormat.JPG, File(myFilePath), false); | |
}; | |
//var basePath = '${basePath}'; | |
var basePath = Folder.desktop; | |
var prefix = 'foo-'; |
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
@Grab(group='radeox', module='radeox', version='1.0-b2') | |
import org.radeox.api.engine.context.InitialRenderContext | |
import org.radeox.engine.* | |
import org.radeox.engine.context.* | |
import org.radeox.filter.* |
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
@Grab(group='radeox', module='radeox', version='1.0-b2') | |
import org.radeox.api.engine.context.InitialRenderContext | |
import org.radeox.engine.* | |
import org.radeox.engine.context.* | |
import org.radeox.filter.* | |
import org.radeox.filter.context.* |
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
@Grab(group='radeox', module='radeox', version='1.0-b2') | |
import org.radeox.engine.* | |
import org.radeox.engine.context.* | |
def context = new BaseInitialRenderContext() | |
def engine = new BaseRenderEngine() | |
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
@Grab(group='jdom', module='jdom', version='1.1') | |
import org.jdom.* | |
import org.jdom.input.* | |
xmldata='''<?xml version="1.0"?> | |
<?xml-stylesheet href="style.xsl" type="text/xsl"?> | |
<html> |
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
(import (javax.script ScriptEngineManager ScriptEngine)) | |
(defn markdown-to-html [txt] | |
(let [e (.getEngineByName (ScriptEngineManager.) "JavaScript")] | |
(.eval e (str | |
(slurp "showdown.js") | |
(System/getProperty "line.separator") | |
"var toHtml = function(mdtext){ return new Showdown.converter().makeHtml(mdtext); }")) | |
(.invokeFunction e "toHtml" (let [arr (make-array String 1)] (aset arr 0 txt ) arr)))) |
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
import javax.script.ScriptEngineManager | |
import javax.script.ScriptEngine | |
slurp = { String filename-> new File(filename).getText('UTF-8') } | |
str = { String s0, String s1-> s0+System.getProperty('line.separator')+s1 } | |
markdownToHtml = { String markdownText-> | |
e = new ScriptEngineManager().getEngineByName("JavaScript") | |
e.eval( str( slurp('showdown.js'),'var toHtml = function(mdtext){ return new Showdown.converter().makeHtml(mdtext); };') ) |
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
// 数値参照を普通の文字に変換する | |
def convert = { | |
def r = it | |
if (it.indexOf("&#x") != -1){ | |
def m2 = (it =~ /&#x(.+?);/) | |
if( m2.find() ){ r = (char) Integer.parseInt(m2.group(1), 16) } | |
} | |
else{ | |
def m2 = (it =~ /&#(.+)?;/) |
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
def inputf = new File(args[0]) | |
def outputf = new File(args[1]) | |
def text = inputf.getText('UTF-8') | |
def w = outputf.newWriter('UTF-8') | |
def num = 0 | |
def anchorid = 'unknown' | |
new StringReader(text).each{ line-> |