Merge pull request #8370 from tchak/fix-nbsp-from-editor
fix(template): trix will transform double spaces in
This commit is contained in:
commit
1c89d3bc21
2 changed files with 4 additions and 2 deletions
|
@ -17,6 +17,7 @@ module TagsSubstitutionConcern
|
|||
.sub(/^[[:space:]]+/, '')
|
||||
.sub(/[[:space:]]+$/, '')
|
||||
.gsub(/[[:space:]]/, ' ')
|
||||
.gsub(' ', ' ')
|
||||
end
|
||||
|
||||
define_combinator :doc do
|
||||
|
|
|
@ -545,11 +545,12 @@ describe TagsSubstitutionConcern, type: :model do
|
|||
end
|
||||
|
||||
it 'normalize white spaces' do
|
||||
tokens = TagsSubstitutionConcern::TagsParser.parse("hello --Jour(s) fixe(s)\xc2\xA0souhaité(s)\xc2\xA0:-- world".encode('utf-8'))
|
||||
tokens = TagsSubstitutionConcern::TagsParser.parse("hello --Jour(s) fixe(s)\xc2\xA0souhaité(s)\xc2\xA0:-- world --B.8 COMMUNE o\xC3\xB9 est situ\xC3\xA9e le site d'exploitation--".encode('utf-8'))
|
||||
expect(tokens).to eq([
|
||||
{ text: "hello " },
|
||||
{ tag: "Jour(s) fixe(s) souhaité(s) :" },
|
||||
{ text: " world" }
|
||||
{ text: " world " },
|
||||
{ tag: "B.8 COMMUNE où est située le site d'exploitation" }
|
||||
])
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue