From 800c95830d32fb7521b16f01dbc63027106a6eda Mon Sep 17 00:00:00 2001 From: Xuan Sang LE Date: Sat, 10 Mar 2018 23:24:53 +0100 Subject: [PATCH] normal string format and locale support string format --- src/core/api.coffee | 3 ++- src/core/tags/afx-html.tag | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/api.coffee b/src/core/api.coffee index b1bfa2f..faa7962 100644 --- a/src/core/api.coffee +++ b/src/core/api.coffee @@ -62,7 +62,8 @@ String.prototype.asUint8Array = () -> if not String.prototype.format String.prototype.format = () -> args = arguments - return new FormatedString(@, args) + return @replace /{(\d+)}/g, (match, number) -> + return if typeof args[number] != 'undefined' then args[number] else match String.prototype.f = () -> args = arguments diff --git a/src/core/tags/afx-html.tag b/src/core/tags/afx-html.tag index b5d4bd3..8f15866 100644 --- a/src/core/tags/afx-html.tag +++ b/src/core/tags/afx-html.tag @@ -14,7 +14,7 @@ } this.on("update", function(){ if(self.updateContent) - self.updateContent() + self.root.innerHTML = self.updateContent() }) \ No newline at end of file