Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support agile extension of Eta class #249

Merged
merged 1 commit into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/compile-string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export function compileToString(this: Eta, str: string, options?: Partial<Option
const config = this.config;
const isAsync = options && options.async;

const compileBody = this.compileBody;

const buffer: Array<AstObject> = this.parse.call(this, str);

// note: when the include function passes through options, the only parameter that matters is the filepath parameter
Expand Down Expand Up @@ -72,7 +74,7 @@ return __eta.res;
* ```
*/

function compileBody(this: Eta, buff: Array<AstObject>) {
export function compileBody(this: Eta, buff: Array<AstObject>) {
const config = this.config;

let i = 0;
Expand Down
3 changes: 2 additions & 1 deletion src/core.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Cacher } from "./storage.ts";
import { compile } from "./compile.ts";
import { compileToString } from "./compile-string.ts";
import { compileToString, compileBody } from "./compile-string.ts";
import { defaultConfig } from "./config.ts";
import { parse } from "./parse.ts";
import { render, renderAsync, renderString, renderStringAsync } from "./render.ts";
Expand All @@ -26,6 +26,7 @@ export class Eta {

compile = compile;
compileToString = compileToString;
compileBody = compileBody;
parse = parse;
render = render;
renderAsync = renderAsync;
Expand Down