Loading Rakefile +1 −1 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ end def load_sdk_vars if File.exists?("sdk-vars.rb") require "sdk-vars.rb" require "./sdk-vars.rb" else puts "Error: sdk-vars.rb not found." puts Loading lib/jsduck/doc_formatter.rb +2 −1 Original line number Diff line number Diff line # -*- coding: utf-8 -*- require 'rubygems' require 'rdiscount' require 'strscan' Loading Loading @@ -337,7 +338,7 @@ module JsDuck end def first_sentence(str) str.sub(/\A(.+?(\.|\343\200\202))\s.*\Z/m, "\\1") str.sub(/\A(.+?(\.|。))\s.*\Z/mu, "\\1") end # Returns true when input should get shortened. Loading spec/doc_formatter_spec.rb +5 −4 Original line number Diff line number Diff line # -*- coding: utf-8 -*- require "jsduck/doc_formatter" require "jsduck/relations" Loading Loading @@ -483,12 +484,12 @@ describe JsDuck::DocFormatter do it "counts multi-byte characters correctly when measuring text length" do # Text ending with a-umlaut character @formatter.shorten("123456789\303\244").should == "123456789\303\244 ..." @formatter.shorten("123456789ä").should == "123456789ä ..." end it "shortens text with multi-byte characters correctly" do # Text containing a-umlaut character @formatter.shorten("123456\303\2448901").should == "123456\303\244..." @formatter.shorten("123456ä8901").should == "123456ä..." end it "strips HTML tags when shortening" do Loading Loading @@ -524,7 +525,7 @@ describe JsDuck::DocFormatter do it "counts multi-byte characters correctly" do # Text ending with a-umlaut character @formatter.too_long?("123456789\303\244").should == false @formatter.too_long?("123456789ä").should == false end end Loading @@ -549,7 +550,7 @@ describe JsDuck::DocFormatter 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" @formatter.first_sentence("Some Chinese Text。 And some more。").should == "Some Chinese Text。" end end Loading Loading
Rakefile +1 −1 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ end def load_sdk_vars if File.exists?("sdk-vars.rb") require "sdk-vars.rb" require "./sdk-vars.rb" else puts "Error: sdk-vars.rb not found." puts Loading
lib/jsduck/doc_formatter.rb +2 −1 Original line number Diff line number Diff line # -*- coding: utf-8 -*- require 'rubygems' require 'rdiscount' require 'strscan' Loading Loading @@ -337,7 +338,7 @@ module JsDuck end def first_sentence(str) str.sub(/\A(.+?(\.|\343\200\202))\s.*\Z/m, "\\1") str.sub(/\A(.+?(\.|。))\s.*\Z/mu, "\\1") end # Returns true when input should get shortened. Loading
spec/doc_formatter_spec.rb +5 −4 Original line number Diff line number Diff line # -*- coding: utf-8 -*- require "jsduck/doc_formatter" require "jsduck/relations" Loading Loading @@ -483,12 +484,12 @@ describe JsDuck::DocFormatter do it "counts multi-byte characters correctly when measuring text length" do # Text ending with a-umlaut character @formatter.shorten("123456789\303\244").should == "123456789\303\244 ..." @formatter.shorten("123456789ä").should == "123456789ä ..." end it "shortens text with multi-byte characters correctly" do # Text containing a-umlaut character @formatter.shorten("123456\303\2448901").should == "123456\303\244..." @formatter.shorten("123456ä8901").should == "123456ä..." end it "strips HTML tags when shortening" do Loading Loading @@ -524,7 +525,7 @@ describe JsDuck::DocFormatter do it "counts multi-byte characters correctly" do # Text ending with a-umlaut character @formatter.too_long?("123456789\303\244").should == false @formatter.too_long?("123456789ä").should == false end end Loading @@ -549,7 +550,7 @@ describe JsDuck::DocFormatter 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" @formatter.first_sentence("Some Chinese Text。 And some more。").should == "Some Chinese Text。" end end Loading