Merge pull request #8370 from tchak/fix-nbsp-from-editor

fix(template): trix will transform double spaces in  
This commit is contained in:
Paul Chavard 2023-01-05 14:24:04 +01:00 committed by GitHub
commit 1c89d3bc21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -17,6 +17,7 @@ module TagsSubstitutionConcern
.sub(/^[[:space:]]+/, '')
.sub(/[[:space:]]+$/, '')
.gsub(/[[:space:]]/, ' ')
.gsub(' ', ' ')
end
define_combinator :doc do

View file

@ -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