diff options
author | Paul Phillips <paulp@improving.org> | 2011-06-24 20:07:03 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-06-24 20:07:03 +0000 |
commit | d8912db1436a42474ddd45007569246ee2af9000 (patch) | |
tree | efd8f97c3f0f06441496d5669ab544583ceefcb6 /test | |
parent | 2a9781ee4c342baa4975c5834fb2cdea599df4e2 (diff) | |
download | scala-d8912db1436a42474ddd45007569246ee2af9000.tar.gz scala-d8912db1436a42474ddd45007569246ee2af9000.tar.bz2 scala-d8912db1436a42474ddd45007569246ee2af9000.zip |
Another one I missed which was fixed by r25149.
Diffstat (limited to 'test')
-rw-r--r-- | test/files/pos/bug2281.scala | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/files/pos/bug2281.scala b/test/files/pos/bug2281.scala new file mode 100644 index 0000000000..fc4ae1ca25 --- /dev/null +++ b/test/files/pos/bug2281.scala @@ -0,0 +1,41 @@ +import scala.collection.mutable.ArrayBuffer + +class A { + def f(x: Boolean) = if (x) <br/><br/> else <br/> +} + +class B { + def splitSentences(text : String) : ArrayBuffer[String] = { + val outarr = new ArrayBuffer[String] + var outstr = new StringBuffer + var prevspace = false + val ctext = text.replaceAll("\n+","\n") + ctext foreach {c => + outstr append c + if(c == '.' || c == '!' || c == '?' || c == '\n' || c == ':' || c == ';' || (prevspace && c == '-') ){ + outarr += outstr.toString + outstr = new StringBuffer + } + if(c == '\n'){ + outarr += "\n\n" + } + prevspace = c == ' ' + } + if(outstr.length > 0){ + outarr += outstr.toString + } + outarr + } + + def spanForSentence(x : String,picktext : String) = + if(x == "\n\n"){ + <br/><br/> + }else{ + <span class='clicksentence' style={if(x == picktext) "background-color: yellow" else ""}>{x}</span> + } + + def selectableSentences(text : String, picktext : String) = { + val sentences = splitSentences(text) + sentences.map(x => spanForSentence(x,picktext)) + } +}
\ No newline at end of file |