Skip to content

Commit

Permalink
Switch to using @ for include, includeFile
Browse files Browse the repository at this point in the history
  • Loading branch information
nebrelbug committed Apr 3, 2020
1 parent 99e92b8 commit 6d5b449
Show file tree
Hide file tree
Showing 19 changed files with 96 additions and 38 deletions.
2 changes: 1 addition & 1 deletion browser-tests/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ <h4>Template</h4>
<% } %>
<% } %>

This is a partial: <%= E.include("mypartial") %>
Partial: <% @include("mypartial") %>
</textarea
>
</div>
Expand Down
26 changes: 20 additions & 6 deletions dist/browser/eta.dev.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/browser/eta.dev.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/browser/eta.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/browser/eta.min.js.map

Large diffs are not rendered by default.

26 changes: 20 additions & 6 deletions dist/eta.cjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/eta.cjs.js.map

Large diffs are not rendered by default.

26 changes: 20 additions & 6 deletions dist/eta.es.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/eta.es.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/types/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface EtaConfig {
interpolate: string;
raw: string;
exec: string;
special: string;
};
e: (str: string) => string;
plugins: Array<{
Expand Down
2 changes: 1 addition & 1 deletion dist/types/parse.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EtaConfig } from './config';
export declare type TagType = 'r' | 'e' | 'i' | '';
export declare type TagType = 'r' | 'e' | 'i' | 's' | '';
export interface TemplateObject {
t: TagType;
val: string;
Expand Down
2 changes: 1 addition & 1 deletion examples/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var template = `
Partial
-------
<%=E.include('template1', {name: 'Ben'})%>
<% @include('template1', {name: 'Ben'})%>
`

Eta.templates.define('template1', Eta.compile('Hi <%=it.name%>'))
Expand Down
3 changes: 3 additions & 0 deletions src/compile-string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ function compileScope (buff: Array<AstObject>, env: EtaConfig) {
} else if (type === 'e') {
// execute
returnStr += content + '\n' // you need a \n in case you have <% } %>
} else if (type === 's') {
returnStr += 'tR+=E.' + content + ';'
// reference
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface EtaConfig {
interpolate: string
raw: string
exec: string
special: string
}
e: (str: string) => string
plugins: Array<{ processFnString?: Function; processAST?: Function }>
Expand Down Expand Up @@ -55,6 +56,7 @@ var defaultConfig: EtaConfig = {
parse: {
interpolate: '=',
raw: '~',
special: '@',
exec: ''
},
async: false,
Expand Down

0 comments on commit 6d5b449

Please sign in to comment.