diff options
author | Antonio Cunei <antonio.cunei@epfl.ch> | 2010-07-15 14:37:52 +0000 |
---|---|---|
committer | Antonio Cunei <antonio.cunei@epfl.ch> | 2010-07-15 14:37:52 +0000 |
commit | 05872beac8a47ea2a28194b7cde091a0ce3e0449 (patch) | |
tree | 2132151581254a026253ed4c238a432db60d35a3 /src/compiler | |
parent | 8f6e0b272393fde6f3f54b7185d2d5e9e064e658 (diff) | |
download | scala-05872beac8a47ea2a28194b7cde091a0ce3e0449.tar.gz scala-05872beac8a47ea2a28194b7cde091a0ce3e0449.tar.bz2 scala-05872beac8a47ea2a28194b7cde091a0ce3e0449.zip |
Merged revisions 22573-22574 via svnmerge from
https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk
........
r22573 | dubochet | 2010-07-15 16:13:03 +0200 (Thu, 15 Jul 2010) | 1 line
[scaladoc] Full comments with "by inheritance" ordering are correctly
displayed. No review. ........ r22574 | dubochet | 2010-07-15 16:13:38
+0200 (Thu, 15 Jul 2010) | 1 line
[scaladoc] Scaladoc knows about Javadoc inline tags and transforms
them. The transformation is currently quite basic, particularly for
links. Review by malayeri. ........
Diffstat (limited to 'src/compiler')
3 files changed, 21 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/html/resource/lib/template.css b/src/compiler/scala/tools/nsc/doc/html/resource/lib/template.css index 8399a6abe8..4ef29bf0cc 100644 --- a/src/compiler/scala/tools/nsc/doc/html/resource/lib/template.css +++ b/src/compiler/scala/tools/nsc/doc/html/resource/lib/template.css @@ -317,11 +317,8 @@ div.fullcomment { margin: 10px 0 10px 0; } -#types div.fullcomment, #values div.fullcomment { - display:none -} - #template div.fullcomment { + display:none; margin: 6px 0 6px 8.7em; } diff --git a/src/compiler/scala/tools/nsc/doc/html/resource/lib/template.js b/src/compiler/scala/tools/nsc/doc/html/resource/lib/template.js index 6f01e56ddc..506edd7746 100644 --- a/src/compiler/scala/tools/nsc/doc/html/resource/lib/template.js +++ b/src/compiler/scala/tools/nsc/doc/html/resource/lib/template.js @@ -93,6 +93,7 @@ $(document).ready(function(){ orderInherit(); }; }); + initInherit(); //http://flowplayer.org/tools/tooltip.html $(".extype").tooltip({ tip: "#tooltip", @@ -114,7 +115,7 @@ $(document).ready(function(){ var docShowSigs = docAllSigs.filter(function(){ return $("+ div.fullcomment", $(this)).length > 0; }); - docShowSigs.css("cursor", "pointer"); + docShowSigs.css("cursor", "pointer"); docShowSigs.click(function(){ commentShowFct($("+ div.fullcomment", $(this))); }); @@ -140,7 +141,6 @@ $(document).ready(function(){ $("p.shortcomment").click(function(){ commentToggleFct($(this)); }); - initInherit(); }); function orderAlpha() { 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 c7cf146894..6fe1fe06a4 100644 --- a/src/compiler/scala/tools/nsc/doc/model/comment/CommentFactory.scala +++ b/src/compiler/scala/tools/nsc/doc/model/comment/CommentFactory.scala @@ -75,6 +75,22 @@ trait CommentFactory { thisFactory: ModelFactory with CommentFactory => case _ => "" } + /** Javadoc tags that should be replaced by something useful, such as wiki syntax, or that should be dropped. */ + protected val JavadocTags = + new Regex("""\{\@(code|docRoot|inheritDoc|link|linkplain|literal|value)([^}]*)\}""") + + /** Maps a javadoc tag to a useful wiki replacement, or an empty string if it cannot be salvaged. */ + protected def javadocReplacement(mtch: Regex.Match): String = mtch.group(1) match { + case "code" => "`" + mtch.group(2) + "`" + case "docRoot" => "" + case "inheritDoc" => "" + case "link" => "`" + mtch.group(2) + "`" + case "linkplain" => "`" + mtch.group(2) + "`" + case "literal" => mtch.group(2) + case "value" => "`" + mtch.group(2) + "`" + case _ => "" + } + /** Safe HTML tags that can be kept. */ protected val SafeTags = new Regex("""((<code( [^>]*)?>.*</code>)|(</?(abbr|acronym|address|area|a|bdo|big|blockquote|br|button|b|caption|cite|col|colgroup|dd|del|dfn|em|fieldset|form|hr|img|input|ins|i|kbd|label|legend|link|map|object|optgroup|option|param|pre|q|samp|select|small|span|strong|sub|sup|table|tbody|td|textarea|tfoot|th|thead|tr|tt|var)( [^>]*)?/?>))""") @@ -124,8 +140,9 @@ trait CommentFactory { thisFactory: ModelFactory with CommentFactory => } val strippedComment = comment.trim.stripPrefix("/*").stripSuffix("*/") val safeComment = DangerousTags.replaceAllIn(strippedComment, { htmlReplacement(_) }) + val javadoclessComment = JavadocTags.replaceAllIn(safeComment, { javadocReplacement(_) }) val markedTagComment = - SafeTags.replaceAllIn(safeComment, { mtch => + SafeTags.replaceAllIn(javadoclessComment, { mtch => java.util.regex.Matcher.quoteReplacement(safeTagMarker + mtch.matched + safeTagMarker) }) markedTagComment.lines.toList map (cleanLine(_)) |