diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2015-01-30 19:01:40 +0100 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-01-30 19:01:40 +0100 |
commit | 0fac1d925b74f24002a4e1538088ce66c4b02cb9 (patch) | |
tree | 5cf3800e961b9da84b2db03707603865496f5ed0 /src/Formats | |
parent | bfd9ffd13ed6b6916790f5f0de5f9523db71b22e (diff) | |
download | dokka-0fac1d925b74f24002a4e1538088ce66c4b02cb9.tar.gz dokka-0fac1d925b74f24002a4e1538088ce66c4b02cb9.tar.bz2 dokka-0fac1d925b74f24002a4e1538088ce66c4b02cb9.zip |
code review
Diffstat (limited to 'src/Formats')
-rw-r--r-- | src/Formats/StructuredFormatService.kt | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/Formats/StructuredFormatService.kt b/src/Formats/StructuredFormatService.kt index fe127732..6ec75379 100644 --- a/src/Formats/StructuredFormatService.kt +++ b/src/Formats/StructuredFormatService.kt @@ -98,23 +98,24 @@ public abstract class StructuredFormatService(val locationService: LocationServi appendSectionWithSubject(it.getKey(), location, it.getValue(), to) } - for (section in node.content.sections) { - if (section.subjectName != null) continue - appendLine(to, formatStrong(formatText(section.label))) + for (section in node.content.sections.filter { it.subjectName == null }) { + appendLine(to, formatStrong(formatText(section.tag))) appendLine(to, formatText(location, section)) } } } } - fun appendSectionWithSubject(title: String, location: Location, parameterSections: List<ContentSection>, to: StringBuilder) { + fun Content.getSectionsWithSubjects(): Map<String, List<ContentSection>> = + sections.filter { it.subjectName != null }.groupBy { it.tag } + + fun appendSectionWithSubject(title: String, location: Location, subjectSections: List<ContentSection>, to: StringBuilder) { appendHeader(to, title, 3) - parameterSections.forEach { - val parameterName = it.subjectName - if (parameterName != null) { - to.append(formatCode(parameterName)).append(" - ") - val formatted = formatText(location, it) - to.append(formatted) + subjectSections.forEach { + val subjectName = it.subjectName + if (subjectName != null) { + to.append(formatCode(subjectName)).append(" - ") + to.append(formatText(location, it)) appendLine(to) } } |