diff options
author | Antoine Gourlay <antoine@gourlay.fr> | 2014-09-03 10:39:22 +0200 |
---|---|---|
committer | Antoine Gourlay <antoine@gourlay.fr> | 2014-09-03 10:39:22 +0200 |
commit | d153ceeed133adfefe6c44a56f8ee502c1278e89 (patch) | |
tree | 5ad0b2d6857e63cf0d3a31f797475cf6d5fba241 /src | |
parent | 2f78ddd3d011457b9afb0078f20e3b612f1e087e (diff) | |
download | scala-d153ceeed133adfefe6c44a56f8ee502c1278e89.tar.gz scala-d153ceeed133adfefe6c44a56f8ee502c1278e89.tar.bz2 scala-d153ceeed133adfefe6c44a56f8ee502c1278e89.zip |
SI-8113 allow a newline between a link target and title
Parsing "[[http://foo.bar link title]]" stops at the first whitespace.
This breaks pretty badly in:
[[http://foo.bar
link title]]
It stops after "link", interprets what it parsed as a link to a member,
obviously fails, and then just ouputs "title".
It should at least return a proper error, or, even better, just allow a
newline between the target and title. I went for the latter.
Diffstat (limited to 'src')
-rwxr-xr-x | src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala b/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala index d5e2f9a2c4..6f81739031 100755 --- a/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala +++ b/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala @@ -681,10 +681,10 @@ trait CommentFactoryBase { this: MemberLookupBase => jump("[[") val parens = 2 + repeatJump('[') val stop = "]" * parens - val target = readUntil { check(stop) || check(" ") } + val target = readUntil { check(stop) || isWhitespaceOrNewLine(char) } val title = if (!check(stop)) Some({ - jump(" ") + jumpWhitespaceOrNewLine() inline(check(stop)) }) else None @@ -899,6 +899,8 @@ trait CommentFactoryBase { this: MemberLookupBase => def jumpWhitespace() = jumpUntil(!isWhitespace(char)) + def jumpWhitespaceOrNewLine() = jumpUntil(!isWhitespaceOrNewLine(char)) + /* READERS */ final def readUntil(c: Char): String = { @@ -938,5 +940,7 @@ trait CommentFactoryBase { this: MemberLookupBase => /* CHARS CLASSES */ def isWhitespace(c: Char) = c == ' ' || c == '\t' + + def isWhitespaceOrNewLine(c: Char) = isWhitespace(c) || c == '\n' } } |