diff options
author | Jean Senellart <jean@senellart.com> | 2017-11-30 00:37:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-30 00:37:04 +0300 |
commit | 56466ee67da004c938fbcd22e5f7b87915ab1637 (patch) | |
tree | 8dc2538ea72ee9b442a8b624816f4d32cc7352e0 /onmt | |
parent | 0e5d0fcb248ac3deb89bf84b576603de2de22332 (diff) |
fix #444 (#446)
* fix #444 and add unit test
Diffstat (limited to 'onmt')
-rw-r--r-- | onmt/utils/Placeholders.lua | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/onmt/utils/Placeholders.lua b/onmt/utils/Placeholders.lua index 0d8c2c33..303244db 100644 --- a/onmt/utils/Placeholders.lua +++ b/onmt/utils/Placeholders.lua @@ -10,12 +10,11 @@ local function norm(t) end return v, vrep end - if t:sub(1, string.len('⦅')) == '⦅' then + if t:find('⦅') then local p = t:find('⦆') assert(p, 'invalid placeholder tag: '..t) - local tcontent = t:sub(string.len('⦅')+1, p-1) - local fields = onmt.utils.String.split(tcontent, ':') - return '⦅'..fields[1]..t:sub(p), fields[2] or fields[1] + local fields = onmt.utils.String.split(t, ':') + return fields[1]..t:sub(p), fields[2] or fields[1] end return t end |