aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2018-05-07 16:37:12 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2018-07-14 23:57:12 +0300
commit44ad68386658dde985207ea0aedb19c96d9b3f93 (patch)
treeae0abbef28a0a305ec2c05dae93274f0c9021e26
parente38d83905ff706b2d656f12896a6905f5a0729d7 (diff)
downloaddokka-44ad68386658dde985207ea0aedb19c96d9b3f93.tar.gz
dokka-44ad68386658dde985207ea0aedb19c96d9b3f93.tar.bz2
dokka-44ad68386658dde985207ea0aedb19c96d9b3f93.zip
[backport] KT-24277: Persist inpage anchors (aka bookmarks) from Javadoc
Original: 4fddba5
-rw-r--r--core/src/main/kotlin/Java/JavadocParser.kt22
-rw-r--r--core/src/main/kotlin/Model/Content.kt2
2 files changed, 15 insertions, 9 deletions
diff --git a/core/src/main/kotlin/Java/JavadocParser.kt b/core/src/main/kotlin/Java/JavadocParser.kt
index e1b15cb2..8cd274e7 100644
--- a/core/src/main/kotlin/Java/JavadocParser.kt
+++ b/core/src/main/kotlin/Java/JavadocParser.kt
@@ -183,15 +183,19 @@ class JavadocParser(
}
private fun createLink(element: Element): ContentBlock {
- if (element.hasAttr("docref")) {
- val docref = element.attr("docref")
- return ContentNodeLazyLink(docref, { -> refGraph.lookupOrWarn(docref, logger) })
- }
- return if (element.hasAttr("href")) {
- val href = element.attr("href")
- ContentExternalLink(href)
- } else {
- ContentBlock()
+ return when {
+ element.hasAttr("docref") -> {
+ val docref = element.attr("docref")
+ ContentNodeLazyLink(docref, { -> refGraph.lookupOrWarn(docref, logger) })
+ }
+ element.hasAttr("href") -> {
+ val href = element.attr("href")
+ ContentExternalLink(href)
+ }
+ element.hasAttr("name") -> {
+ ContentBookmark(element.attr("name"))
+ }
+ else -> ContentBlock()
}
}
diff --git a/core/src/main/kotlin/Model/Content.kt b/core/src/main/kotlin/Model/Content.kt
index 010ee7ca..4f142ca4 100644
--- a/core/src/main/kotlin/Model/Content.kt
+++ b/core/src/main/kotlin/Model/Content.kt
@@ -148,6 +148,8 @@ class ContentExternalLink(val href : String) : ContentBlock() {
children.hashCode() * 31 + href.hashCode()
}
+data class ContentBookmark(val name: String): ContentBlock()
+
class ContentUnorderedList() : ContentBlock()
class ContentOrderedList() : ContentBlock()
class ContentListItem() : ContentBlock()