Skip to content
Snippets Groups Projects
Commit d86560b0 authored by Goik Martin's avatar Goik Martin
Browse files

Highlight and LaTeX support

parent de4cb6cc
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@
<groupId>de.hdm_stuttgart.mi</groupId>
<artifactId>mi-maven-archetype-quickstart</artifactId>
<version>1.6</version>
<version>1.7</version>
<packaging>maven-archetype</packaging>
......
......@@ -15,8 +15,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
......@@ -50,9 +50,19 @@
<version>3.2.0</version>
<configuration>
<linksource>true</linksource>
<detectJavaApiLink>false</detectJavaApiLink>
<additionalOptions>
<additionalOption>-html5</additionalOption>
<additionalOption>-html5 --allow-script-in-comments</additionalOption>
</additionalOptions>
<nohelp>true</nohelp>
<header><![CDATA[
<script type="text/javascript"
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.5.0/build/styles/idea.min.css">
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.5.0/build/highlight.js"></script>
<script type="text/javascript">hljs.initHighlightingOnLoad();</script>]]>
</header>
<javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
</configuration>
</plugin>
......
package $package;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
/**
* <p>The sole purpose of this class is about demonstrating
* <a target="_blank" href="https://highlightjs.org">highlight.js</a> syntax highlighting support in Javadoc.</p>
*
*/
public class HighlightSample {
/**
* <p>Executing {@link #printCurrentDay()} according to its documentation.</p>
*
* @param args Unused
*/
public static void main(String[] args) {
System.out.println("Current date is:");
HighlightSample.printCurrentDay();
}
/**
* <p>Printing current date and time.</p>
*
* <p>Usage sample:</p>
*
* <pre><code class="java"> final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
* LocalDateTime now = LocalDateTime.now();
* System.out.println(dtf.format(now));</code></pre>
*
* <p>Illustrating syntax highlighting of different programming languages using a totally unrelated SQL example:</p>
*
* <pre><code class="sql"> CREATE TABLE CUSTOMERS(
* ID INT NOT NULL,
* NAME VARCHAR (20) NOT NULL,
* AGE INT NOT NULL,
* ADDRESS CHAR (25) ,
* SALARY DECIMAL (18, 2),
* PRIMARY KEY (ID)
* )</code></pre>
*
*/
public static void printCurrentDay() {
final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
LocalDateTime now = LocalDateTime.now();
System.out.println(dtf.format(now));
}
}
package $package;
/**
* <p>The sole purpose of this class is about demonstrating
* <a target="_blank" href="https://www.latex-project.org">LaTeX</a> math formular support in Javadoc.</p>
*
*/
public class Statistics {
/**
* <p>Computing the average of a given array's values</p>
*
* <p>Consider a series of values:</p>
*
* \[ \textbf{v} = \{v_1, v_2, \dots v_n\} \]
*
* <p>Its average is being defined as:</p>
*
* \[ \overline{\textbf{v}} = {1\over n}\sum_{i=1}^n {v_i} \]
*
* @param values A non-empty array of values.
* @return The average of all array values.
*/
public static double average(double[] values) {
double result = 0;
for (final double v: values) {
result += v;
}
return result / values.length;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment