fix(template): trix will transform double spaces in
This commit is contained in:
parent
fa6fc077b4
commit
26e02c7173
2 changed files with 4 additions and 2 deletions
|
@ -17,6 +17,7 @@ module TagsSubstitutionConcern
|
||||||
.sub(/^[[:space:]]+/, '')
|
.sub(/^[[:space:]]+/, '')
|
||||||
.sub(/[[:space:]]+$/, '')
|
.sub(/[[:space:]]+$/, '')
|
||||||
.gsub(/[[:space:]]/, ' ')
|
.gsub(/[[:space:]]/, ' ')
|
||||||
|
.gsub(' ', ' ')
|
||||||
end
|
end
|
||||||
|
|
||||||
define_combinator :doc do
|
define_combinator :doc do
|
||||||
|
|
|
@ -545,11 +545,12 @@ describe TagsSubstitutionConcern, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'normalize white spaces' do
|
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([
|
expect(tokens).to eq([
|
||||||
{ text: "hello " },
|
{ text: "hello " },
|
||||||
{ tag: "Jour(s) fixe(s) souhaité(s) :" },
|
{ 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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue