Skip to content

Commit

Permalink
stripped spaces around injected commas: metanorma/isodoc#617
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Nov 21, 2024
1 parent 10aa3b9 commit 2814078
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/isodoc-yaml/i18n-en.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
text: text
at: at
binary_and: "%1<conn> and </conn>%2"
multiple_and: "%1<conn>, and </conn>%2"
binary_and: "%1 <conn>and</conn> %2"
multiple_and: "%1<conn>, and</conn> %2"
2 changes: 1 addition & 1 deletion lib/isodoc/i18n.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def boolean_conj(list, conn)

def enum_comma
%w(Hans Hant).include?(@script) and return "<enum-comma>、</enum-comma>"
"<enum-comma>, </enum-comma>"
"<enum-comma>,</enum-comma> "
end

def cleanup_entities(text, is_xml: true)
Expand Down
8 changes: 4 additions & 4 deletions spec/isodoc/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,17 @@
c = IsoDoc::I18n.new("en", "Latn")
expect(c.boolean_conj([], "and")).to eq ""
expect(c.boolean_conj(%w(a), "and")).to eq "a"
expect(c.boolean_conj(%w(a b), "and")).to eq "a<conn> and </conn>b"
expect(c.boolean_conj(%w(a b c), "and")).to eq "a<enum-comma>, </enum-comma>b<conn>, and </conn>c"
expect(c.boolean_conj(%w(a b c d), "and")).to eq "a<enum-comma>, </enum-comma>b<enum-comma>, </enum-comma>c<conn>, and </conn>d"
expect(c.boolean_conj(%w(a b), "and")).to eq "a <conn>and</conn> b"
expect(c.boolean_conj(%w(a b c), "and")).to eq "a<enum-comma>,</enum-comma> b<conn>, and</conn> c"
expect(c.boolean_conj(%w(a b c d), "and")).to eq "a<enum-comma>,</enum-comma> b<enum-comma>,</enum-comma> c<conn>, and</conn> d"
end

it "does boolean conjunctions in Traditional Chinese" do
c = IsoDoc::I18n.new("zh", "Hant",
i18nhash: YAML.load_file("spec/assets/new.yaml"))
expect(c.boolean_conj([], "and")).to eq ""
expect(c.boolean_conj(%w(a), "and")).to eq "a"
expect(c.boolean_conj(%w(a b), "and")).to eq "a<conn> and </conn>b"
expect(c.boolean_conj(%w(a b), "and")).to eq "a <conn>and</conn> b"
expect(c.boolean_conj(%w(a b c), "and")).to eq "a<enum-comma>、</enum-comma>b<conn>與</conn>c"
expect(c.boolean_conj(%w(a b c d), "and")).to eq "a<enum-comma>、</enum-comma>b<enum-comma>、</enum-comma>c<conn>與</conn>d"
end
Expand Down

0 comments on commit 2814078

Please sign in to comment.