From cbbf34c2711aa7e5127c175eadfb732929394a0d Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sun, 7 Feb 2016 21:53:47 +0100 Subject: [PATCH] Improved inline markup. --- app/assets/javascripts/app/lib/app_post/i18n.coffee | 3 ++- public/assets/tests/core.js | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/app/lib/app_post/i18n.coffee b/app/assets/javascripts/app/lib/app_post/i18n.coffee index 6183be418..a754c0ade 100644 --- a/app/assets/javascripts/app/lib/app_post/i18n.coffee +++ b/app/assets/javascripts/app/lib/app_post/i18n.coffee @@ -186,7 +186,8 @@ class _i18nSingleton extends Spine.Module # apply inline markup translated - .replace(/\*(.+?)\*/gm, '$1') + .replace(/\|\|(.+?)\|\|/gm, '$1') + .replace(/\|(.+?)\|/gm, '$1') .replace(/_(.+?)_/gm, '$1') .replace(/§(.+?)§/gm, '$1') diff --git a/public/assets/tests/core.js b/public/assets/tests/core.js index a42c514a6..110f66947 100644 --- a/public/assets/tests/core.js +++ b/public/assets/tests/core.js @@ -274,9 +274,12 @@ test( "i18n", function() { translated = App.i18n.translateContent('%s %s test', 123, 'xxx'); equal( translated, '123 xxx test', 'de-de - %s %s' ); - translated = App.i18n.translateContent('*%s* %s test', 123, 'xxx'); + translated = App.i18n.translateContent('|%s| %s test', 123, 'xxx'); equal( translated, '123 xxx test', 'de-de - *%s* %s' ); + translated = App.i18n.translateContent('||%s|| %s test', 123, 'xxx'); + equal( translated, '123 xxx test', 'de-de - *%s* %s' ); + translated = App.i18n.translateContent('_%s_ %s test', 123, 'xxx'); equal( translated, '123 xxx test', 'de-de - _%s_ %s' ); @@ -311,9 +314,12 @@ test( "i18n", function() { translated = App.i18n.translateContent('%s %s test', 123, 'xxx'); equal( translated, '123 xxx test', 'en-us - %s %s' ); - translated = App.i18n.translateContent('*%s* %s test', 123, 'xxx'); + translated = App.i18n.translateContent('|%s| %s test', 123, 'xxx'); equal( translated, '123 xxx test', 'en-us - *%s* %s' ); + translated = App.i18n.translateContent('||%s|| %s test', 123, 'xxx'); + equal( translated, '123 xxx test', 'en-us - *%s* %s' ); + translated = App.i18n.translateContent('_%s_ %s test', 123, 'xxx'); equal( translated, '123 xxx test', 'en-us - _%s_ %s' );