Automatically support basic HTML tags in translations

This allows front-end translations to use basic (attributeless) HTML tags freely, without the need for the translator call to supply a matching vdom element. Translations can thus make use of styling (<em>, <code>, etc.) as they see fit. The translator call can still optionally supply a vdom element to substitute in more complex tags where necessary (e.g. hyperlinks).

/cc @dcsjapan
This commit is contained in:
Toby Zerner
2016-05-21 20:25:32 +09:30
parent 60e50713e7
commit 58c9a6164a
4 changed files with 5 additions and 5 deletions

View File

@ -74,7 +74,7 @@ export default class Translator {
if (match[2]) {
open.shift();
} else {
let tag = input[match[3]] || [];
let tag = input[match[3]] || {tag: match[3], children: []};
open[0].push(tag);
open.unshift(tag.children || tag);
}