feat(i18n): add an HtmlParser decorator (#10645)

* fix(i18n): merge retains attributes w/o value

* feat(i18n): allow attributes on ng-container (i.e. i18n)

* feat(i18n): add an HtmlParser decorator

* style: clang format
This commit is contained in:
Victor Berchet
2016-08-11 21:00:35 -07:00
committed by vikerman
parent 7606c96c80
commit 50345b8c36
14 changed files with 333 additions and 23 deletions

View File

@ -28,15 +28,15 @@ export class ParseTreeResult {
}
export class Parser {
constructor(private _getTagDefinition: (tagName: string) => TagDefinition) {}
constructor(public getTagDefinition: (tagName: string) => TagDefinition) {}
parse(
source: string, url: string, parseExpansionForms: boolean = false,
interpolationConfig: InterpolationConfig = DEFAULT_INTERPOLATION_CONFIG): ParseTreeResult {
const tokensAndErrors =
lex.tokenize(source, url, this._getTagDefinition, parseExpansionForms, interpolationConfig);
lex.tokenize(source, url, this.getTagDefinition, parseExpansionForms, interpolationConfig);
const treeAndErrors = new _TreeBuilder(tokensAndErrors.tokens, this._getTagDefinition).build();
const treeAndErrors = new _TreeBuilder(tokensAndErrors.tokens, this.getTagDefinition).build();
return new ParseTreeResult(
treeAndErrors.rootNodes,