summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Dubochet <gilles.dubochet@epfl.ch>2011-02-04 16:43:07 +0000
committerGilles Dubochet <gilles.dubochet@epfl.ch>2011-02-04 16:43:07 +0000
commitd20e2b0e170dc936eacd30984af16abfe54ec15d (patch)
tree431ac2c7ae8d0c48856c0a1149b6fd6629413374
parentabb43ce593acacbfb68126fc892a18eda1148ad3 (diff)
downloadscala-d20e2b0e170dc936eacd30984af16abfe54ec15d.tar.gz
scala-d20e2b0e170dc936eacd30984af16abfe54ec15d.tar.bz2
scala-d20e2b0e170dc936eacd30984af16abfe54ec15d.zip
[scaladoc] Strings looking like documentation a...
[scaladoc] Strings looking like documentation attributes ("@something") inside "<pre>" blocks are not treated as attributes (like "{{{" blocks already did). Fixes #4212. No review.
-rw-r--r--src/compiler/scala/tools/nsc/doc/model/comment/CommentFactory.scala25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/model/comment/CommentFactory.scala b/src/compiler/scala/tools/nsc/doc/model/comment/CommentFactory.scala
index 62ecae7b4f..c1a4fdddc3 100644
--- a/src/compiler/scala/tools/nsc/doc/model/comment/CommentFactory.scala
+++ b/src/compiler/scala/tools/nsc/doc/model/comment/CommentFactory.scala
@@ -187,11 +187,11 @@ trait CommentFactory { thisFactory: ModelFactory with CommentFactory =>
/** The start of a scaladoc code block */
protected val CodeBlockStart =
- new Regex("""(.*)\{\{\{(.*)""")
+ new Regex("""(.*)((?:\{\{\{)|(?:\u000E<pre(?: [^>]*)?>\u000E))(.*)""")
/** The end of a scaladoc code block */
protected val CodeBlockEnd =
- new Regex("""(.*)\}\}\}(.*)""")
+ new Regex("""(.*)((?:\}\}\})|(?:\u000E</pre>\u000E))(.*)""")
/** A key used for a tag map. The key is built from the name of the tag and from the linked symbol if the tag has one.
* Equality on tag keys is structural. */
@@ -246,28 +246,28 @@ trait CommentFactory { thisFactory: ModelFactory with CommentFactory =>
inCodeBlock: Boolean
): Comment = remaining match {
- case CodeBlockStart(before, after) :: ls if (!inCodeBlock) =>
+ case CodeBlockStart(before, marker, after) :: ls if (!inCodeBlock) =>
if (before.trim != "")
- parse0(docBody, tags, lastTagKey, before :: ("{{{" + after) :: ls, false)
+ parse0(docBody, tags, lastTagKey, before :: (marker + after) :: ls, false)
else if (after.trim != "")
- parse0(docBody, tags, lastTagKey, "{{{" :: after :: ls, true)
+ parse0(docBody, tags, lastTagKey, marker :: after :: ls, true)
else lastTagKey match {
case Some(key) =>
val value =
((tags get key): @unchecked) match {
- case Some(b :: bs) => (b + endOfLine + "{{{") :: bs
+ case Some(b :: bs) => (b + endOfLine + marker) :: bs
case None => oops("lastTagKey set when no tag exists for key")
}
parse0(docBody, tags + (key -> value), lastTagKey, ls, true)
case None =>
- parse0(docBody + endOfLine + "{{{", tags, lastTagKey, ls, true)
+ parse0(docBody + endOfLine + marker, tags, lastTagKey, ls, true)
}
- case CodeBlockEnd(before, after) :: ls =>
+ case CodeBlockEnd(before, marker, after) :: ls =>
if (before.trim != "")
- parse0(docBody, tags, lastTagKey, before :: ("}}}" + after) :: ls, true)
+ parse0(docBody, tags, lastTagKey, before :: (marker + after) :: ls, true)
else if (after.trim != "")
- parse0(docBody, tags, lastTagKey, "}}}" :: after :: ls, false)
+ parse0(docBody, tags, lastTagKey, marker :: after :: ls, false)
else lastTagKey match {
case Some(key) =>
val value =
@@ -277,7 +277,7 @@ trait CommentFactory { thisFactory: ModelFactory with CommentFactory =>
}
parse0(docBody, tags + (key -> value), lastTagKey, ls, false)
case None =>
- parse0(docBody + endOfLine + "}}}", tags, lastTagKey, ls, false)
+ parse0(docBody + endOfLine + marker, tags, lastTagKey, ls, false)
}
case SymbolTag(name, sym, body) :: ls if (!inCodeBlock) =>
@@ -372,8 +372,9 @@ trait CommentFactory { thisFactory: ModelFactory with CommentFactory =>
* - Removed start-of-line star and one whitespace afterwards (if present).
* - Removed all end-of-line whitespace.
* - Only `endOfLine` is used to mark line endings. */
- def parseWiki(string: String, pos: Position): Body =
+ def parseWiki(string: String, pos: Position): Body = {
new WikiParser(string.toArray, pos).document()
+ }
/** TODO
*