diff options
author | Owen Gray <owengray@google.com> | 2020-03-24 18:21:42 -0400 |
---|---|---|
committer | Owen Gray <owengray@google.com> | 2020-04-02 09:39:59 -0400 |
commit | 1ebb630f9b0db7e30c113fa19b26503d66219794 (patch) | |
tree | 0f5931b518568a6bbfbae0dc505c3a26a9c0727e | |
parent | ac5ec5dde25e5c9558b3fed5741cc9f097f6461a (diff) | |
download | dokka-1ebb630f9b0db7e30c113fa19b26503d66219794.tar.gz |
Fix @see tags
Thanks to Jeff for initial solution
Fixes: b/142676098
Test: gw test
Change-Id: If92fa2df0ea40061f2f0a6b6f16a45897001b62f
7 files changed, 26 insertions, 11 deletions
diff --git a/core/src/main/kotlin/Formats/DacHtmlFormat.kt b/core/src/main/kotlin/Formats/DacHtmlFormat.kt index 6b42dad19..b767c7d6f 100644 --- a/core/src/main/kotlin/Formats/DacHtmlFormat.kt +++ b/core/src/main/kotlin/Formats/DacHtmlFormat.kt @@ -176,11 +176,25 @@ class DevsiteLayoutHtmlFormatOutputBuilder( } } ul(classes = "nolist") { - sections.forEach { - li { - code { - metaMarkup(it.children) + sections.filter {it.tag == "See Also"}.forEach { + it.children.forEach { child -> + if (child is ContentNodeLazyLink || child is ContentExternalLink) { + li { + code { + contentNodeToMarkup(child) // Wrap bare links in listItems. + } // bare links come from the java-to-kotlin parser. + } } + else if (child is ContentUnorderedList) { + metaMarkup(child.children) // Already wrapped in listItems. + } // this is how we want things to look. No parser currently does this (yet). + else if (child is ContentParagraph) { + li{ + code { + metaMarkup (child.children) // Replace paragraphs with listItems. + } // paragraph-wrapped links come from the kotlin parser + } + } // NOTE: currently the java-to-java parser does not add See Also links! } } } diff --git a/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt b/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt index 7fbdb1819..ccea82eae 100644 --- a/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt +++ b/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt @@ -51,7 +51,7 @@ open class JavaLayoutHtmlFormatOutputBuilder( protected fun FlowContent.contentNodesToMarkup(content: List<ContentNode>, contextUri: URI = uri): Unit = content.forEach { contentNodeToMarkup(it, contextUri) } - private fun FlowContent.contentNodeToMarkup(content: ContentNode, contextUri: URI) { + protected fun FlowContent.contentNodeToMarkup(content: ContentNode, contextUri: URI = uri) { when (content) { is ContentText -> +content.text is ContentSymbol -> span("symbol") { +content.text } diff --git a/core/testdata/format/dac/javaSeeTag/Bar.kt b/core/testdata/format/dac/javaSeeTag/Bar.kt index 9df671194..21170d363 100644 --- a/core/testdata/format/dac/javaSeeTag/Bar.kt +++ b/core/testdata/format/dac/javaSeeTag/Bar.kt @@ -1,4 +1,5 @@ /** * @see Foo + * @see java.lang.String */ class Bar
\ No newline at end of file diff --git a/core/testdata/format/dac/javaSeeTag/Foo.java b/core/testdata/format/dac/javaSeeTag/Foo.java index 94a24606d..b784ae225 100644 --- a/core/testdata/format/dac/javaSeeTag/Foo.java +++ b/core/testdata/format/dac/javaSeeTag/Foo.java @@ -1,5 +1,6 @@ /** * @see #bar + * @see java.lang.String */ public class Foo { public void bar() {} diff --git a/core/testdata/format/dac/javaSeeTag/dac-as-java/Bar.html b/core/testdata/format/dac/javaSeeTag/dac-as-java/Bar.html index 3dbc813fa..663d14727 100644 --- a/core/testdata/format/dac/javaSeeTag/dac-as-java/Bar.html +++ b/core/testdata/format/dac/javaSeeTag/dac-as-java/Bar.html @@ -39,9 +39,8 @@ <div> <p><b>See Also</b></p> <ul class="nolist"> - <li><code> - <p><a href="Foo.html#">Foo</a></p> - </code></li> + <li><code><a href="Foo.html#">Foo</a></code></li> + <li><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html">java.lang.String</a></code></li> </ul> </div> </div> diff --git a/core/testdata/format/dac/javaSeeTag/dac/Bar.html b/core/testdata/format/dac/javaSeeTag/dac/Bar.html index b7d8304d3..c49e6d808 100644 --- a/core/testdata/format/dac/javaSeeTag/dac/Bar.html +++ b/core/testdata/format/dac/javaSeeTag/dac/Bar.html @@ -39,9 +39,8 @@ <div> <p><b>See Also</b></p> <ul class="nolist"> - <li><code> - <p><a href="Foo.html#">Foo</a></p> - </code></li> + <li><code><a href="Foo.html#">Foo</a></code></li> + <li><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html">java.lang.String</a></code></li> </ul> </div> </div> diff --git a/core/testdata/format/dac/javaSeeTag/dac/Foo.html b/core/testdata/format/dac/javaSeeTag/dac/Foo.html index 473fd2cc2..14a913c99 100644 --- a/core/testdata/format/dac/javaSeeTag/dac/Foo.html +++ b/core/testdata/format/dac/javaSeeTag/dac/Foo.html @@ -58,6 +58,7 @@ <p><b>See Also</b></p> <ul class="nolist"> <li><code><a href="#bar()">#bar</a></code></li> + <li><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html">java.lang.String</a></code></li> </ul> </div> </div> |