Skip to content

Commit

Permalink
Update app/angular/src/client/preview/angular-beta/ComputesTemplateFr…
Browse files Browse the repository at this point in the history
…omComponent.ts

Co-authored-by: ThibaudAV <thibaud.avenier@gmail.com>
  • Loading branch information
stefan-schweiger and ThibaudAV committed Jan 9, 2022
1 parent b7374f8 commit 9d6a750
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -172,7 +172,14 @@ const buildTemplate = (
[/([\w[\]]+)(\s*,[\w\s-[\],]+)+/, `$1`],
[/#([\w-]+)/, ` id="$1"`],
[/((\.[\w-]+)+)/, (_, c) => ` class="${c.split`.`.join` `.trim()}"`],
[/(\[.+?])/g, (_, a) => ` ${a.slice(1, -1)}`],
[
/([\S]+)(.*)/,
(template, elementSelector) => {
return voidElements.some((element) => elementSelector === element)
? template.replace(/([\S]+)(.*)/, `<$1$2${inputs}${outputs} />`)
: template.replace(/([\S]+)(.*)/, `<$1$2${inputs}${outputs}>${innerTemplate}</$1>`);
},
],
];

const template = templateReplacers.reduce(
Expand Down

0 comments on commit 9d6a750

Please sign in to comment.