Аннотации KDoc не отображаются в Dokka, сгенерированном HTML

В настоящее время я тестирую документацию Dokka, и некоторые сделанные мной аннотации не отображаются. Вот мои выводы:

  1. Классы не показывают @sampleи HTML-теги <p></p>, <h1></h1>: Увидеть SimpleCalculator документация по классу
  2. Если описание было под тегом html, оно не будет отображаться: см. enum class OPERATOR документация по коду
  3. Методы не показывают @sample а также @property вообще: см. всю документацию по коду метода
  4. Смешанное определение между @property а также @param, В объявлениях классов @param это один внутри <> (например Group<T>). Но в методах это один из параметров.

Пожалуйста, смотрите мой код:

package example

/**
 * <h1> A Simple Calculator for your daily needs! </h1>
 *
 * <p> This class can help you add, subract, multiply and divide Integers </p>
 *
 * @property firstNumber the first Number you want to use
 * @property secondNumber the second Number you want to use.
 * @constructor Creates a Simple Calculator with the two numbers
 * @sample SimpleCalculator(100,10)
 */
class SimpleCalculator(val firstNumber: Int, val secondNumber: Int) {

    /**
     * <h1> An OPERATOR checker to be used by the Simple Calculator </h1>
     *
     * <p> This class has four enums namely: </p>
     * - ADD
     * - SUB
     * - MUL
     * - DIV
     * @see SimpleCalculator
     */
    enum class OPERATOR { ADD, SUB, MUL, DIV }

    /**
     * Computes with the [firstNumber] and [secondNumber] you have created with [SimpleCalculator].
     * @param operator the required OPERATOR needed for the computation
     * @sample compute(OPERATOR.ADD)
     * @see SimpleCalculator
     * @return the required answer
     */
    fun compute(operator: OPERATOR): Int {
        return when (operator) {
            OPERATOR.ADD -> add(firstNumber, secondNumber)
            OPERATOR.SUB -> sub(firstNumber, secondNumber)
            OPERATOR.MUL -> mul(firstNumber, secondNumber)
            OPERATOR.DIV -> div(firstNumber, secondNumber)
        }
    }

    /**
     * Adds the [firstNumber] and [secondNumber] you have created with [SimpleCalculator].
     * @property firstNumber the first number
     * @property secondNumber the first number
     * @sample add(100, 10)
     * @see SimpleCalculator
     * @return the sum
     * @throws Exception
     */
    fun add(firstNumber: Int, secondNumber: Int): Int = firstNumber + secondNumber

    /**
     * Subtracts the [firstNumber] and [secondNumber] you have created with [SimpleCalculator].
     * Returns the differences
     * @param firstNumber the first number
     * @param secondNumber the second number
     * @sample sub(100, 10)
     * @see SimpleCalculator
     * @return the difference
     * @throws Exception
     */
    fun sub(firstNumber: Int, secondNumber: Int): Int = firstNumber - secondNumber

    /**
     * Multiplies the [firstNumber] and [secondNumber] you have created with [SimpleCalculator].
     * Using [add] as a multiplication factor
     * @sample mul(100, 10)
     * @see add
     * @return the product
     * @throws Exception
     */
    fun mul(firstNumber: Int, secondNumber: Int): Int {
        var result = firstNumber
        var i = 2
        while (i < secondNumber && secondNumber != 0) {
            result += add(result, firstNumber)
            i++
        }

        return result
    }

    /**
     * Divides the [firstNumber] and [secondNumber] you have created with [SimpleCalculator].
     * Using [sub] as a division factor
     * @sample div(100, 10)
     * @see sub
     * @return the dividend
     * @throws Exception
     */
    fun div(firstNumber: Int, secondNumber: Int): Int {
        var result = firstNumber
        var i = 2
        while (i < secondNumber && secondNumber != 0) {
            result -= sub(result, firstNumber)
            i++
        }

        return result
    }

}

мой топовый файл сборки:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.2.0'
    ext.dokka_version = '0.9.15'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "org.jetbrains.dokka:dokka-gradle-plugin:${dokka_version}"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Мой файл сборки проекта:

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

apply plugin: 'org.jetbrains.dokka'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.hellodokka"
        minSdkVersion 18
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dokka {
    outputFormat = 'html'
    outputDirectory = "$buildDir/html"
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

ВЫХОДЫ:

Простой калькулятор

Оператор Enum

Добавить метод

Может кто-нибудь помочь?

0 ответов

Другие вопросы по тегам