Commit d0885382 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Recognize Chinese full-stop char as sentence end.

To please our asian fellows.
parent acc1da97
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -355,7 +355,7 @@ module JsDuck
    end

    def first_sentence(str)
      str.sub(/\A(.+?\.)\s.*\Z/m, "\\1")
      str.sub(/\A(.+?(\.|\343\200\202))\s.*\Z/m, "\\1")
    end

    # Returns true when input should get shortened.
+3 −0
Original line number Diff line number Diff line
@@ -536,6 +536,9 @@ describe JsDuck::DocFormatter do
    it "ignores first empty sentence" do
      @formatter.first_sentence(". Hi John. This is me.").should == ". Hi John."
    end
    it "understands chinese/japanese full-stop character as end of sentence" do
      @formatter.first_sentence("Some Chinese Text\343\200\202 And some more\343\200\202").should == "Some Chinese Text\343\200\202"
    end
  end

end