X-Git-Url: https://git.kianting.info/?a=blobdiff_plain;f=src%2Flibclo%2Findex.ts;fp=src%2Flibclo%2Findex.ts;h=b83b050305552038ea26ff110718e30c75844891;hb=d8b33fabf7ffab673f4cd6a8201aadacf3624b41;hp=0000000000000000000000000000000000000000;hpb=a59e1673073b613ea12bd8a0cfa7800826d50dce;p=clo diff --git a/src/libclo/index.ts b/src/libclo/index.ts new file mode 100644 index 0000000..b83b050 --- /dev/null +++ b/src/libclo/index.ts @@ -0,0 +1,49 @@ +import {tkTree} from "../parser"; + + +function foo(arr : tkTree): tkTree{ + for (let i = 0; i < arr.length; i++) { + + } + if (Array.isArray(arr)){ + arr.push("balabala"); + } + return arr; +} + +export class Clo{ + mainStream : Array; + preprocessors : Array; + attributes: object ; // a4 size(x,y) + + + constructor(){ + this.preprocessors = []; + this.mainStream = []; + this.attributes = {"page" : [793.7, 1122.5]}; + this.preprocessorRegister(foo); + } + + /** + * register a function of preprocessor + * @param f a function + */ + public preprocessorRegister(f : Function){ + this.preprocessors.push(f); + } + + public generatePdf(){ + // preprocessed + var prepro = this.mainStream; + for (var i = 0; i