summaryrefslogtreecommitdiffstats
path: root/sonar-markdown/src
diff options
context:
space:
mode:
authorFreddy Mallet <freddy.mallet@gmail.com>2011-04-23 23:34:08 +0200
committerFreddy Mallet <freddy.mallet@gmail.com>2011-04-23 23:34:08 +0200
commite9c89df95a32fae52406c4400a76a68121a1f3d9 (patch)
tree5b85ad3ff1dc567a6aeb588757db2c8a1fa6bbf7 /sonar-markdown/src
parent785ab17deff3ffec6d2698fffe56a72913b8fb93 (diff)
downloadsonarqube-e9c89df95a32fae52406c4400a76a68121a1f3d9.tar.gz
sonarqube-e9c89df95a32fae52406c4400a76a68121a1f3d9.zip
Add some javadoc to the Sonar Markdown module
Diffstat (limited to 'sonar-markdown/src')
-rw-r--r--sonar-markdown/src/main/java/org/sonar/markdown/HtmlCodeChannel.java5
-rw-r--r--sonar-markdown/src/main/java/org/sonar/markdown/HtmlEmphasisChannel.java5
-rw-r--r--sonar-markdown/src/main/java/org/sonar/markdown/HtmlEndOfLineChannel.java5
-rw-r--r--sonar-markdown/src/main/java/org/sonar/markdown/HtmlUrlChannel.java6
-rw-r--r--sonar-markdown/src/main/java/org/sonar/markdown/IdentifierAndNumberChannel.java3
-rw-r--r--sonar-markdown/src/main/java/org/sonar/markdown/MarkdownEngine.java3
-rw-r--r--sonar-markdown/src/main/java/org/sonar/markdown/package-info.java25
7 files changed, 51 insertions, 1 deletions
diff --git a/sonar-markdown/src/main/java/org/sonar/markdown/HtmlCodeChannel.java b/sonar-markdown/src/main/java/org/sonar/markdown/HtmlCodeChannel.java
index 4fd5d3fd11c..b2601557b34 100644
--- a/sonar-markdown/src/main/java/org/sonar/markdown/HtmlCodeChannel.java
+++ b/sonar-markdown/src/main/java/org/sonar/markdown/HtmlCodeChannel.java
@@ -21,6 +21,11 @@ package org.sonar.markdown;
import org.sonar.channel.RegexChannel;
+/**
+ * Markdown treats double simple quotes ('') as indicators of code. Text wrapped with two '' will be wrapped with an HTML <code> tag.
+ *
+ * E.g., the input ''printf()'' will produce <code>printf()</code>
+ */
class HtmlCodeChannel extends RegexChannel<MarkdownOutput> {
public HtmlCodeChannel() {
diff --git a/sonar-markdown/src/main/java/org/sonar/markdown/HtmlEmphasisChannel.java b/sonar-markdown/src/main/java/org/sonar/markdown/HtmlEmphasisChannel.java
index ffaf0ac60e7..bb53dd8a43e 100644
--- a/sonar-markdown/src/main/java/org/sonar/markdown/HtmlEmphasisChannel.java
+++ b/sonar-markdown/src/main/java/org/sonar/markdown/HtmlEmphasisChannel.java
@@ -21,6 +21,11 @@ package org.sonar.markdown;
import org.sonar.channel.RegexChannel;
+/**
+ * Markdown treats asterisks (*) as indicators of emphasis. Text wrapped with one * will be wrapped with an HTML <em> tag.
+ *
+ * E.g., the input *word* will produce <em>work</word>
+ */
class HtmlEmphasisChannel extends RegexChannel<MarkdownOutput> {
public HtmlEmphasisChannel() {
diff --git a/sonar-markdown/src/main/java/org/sonar/markdown/HtmlEndOfLineChannel.java b/sonar-markdown/src/main/java/org/sonar/markdown/HtmlEndOfLineChannel.java
index d7ed7afcdbd..e990b0a9584 100644
--- a/sonar-markdown/src/main/java/org/sonar/markdown/HtmlEndOfLineChannel.java
+++ b/sonar-markdown/src/main/java/org/sonar/markdown/HtmlEndOfLineChannel.java
@@ -21,6 +21,11 @@ package org.sonar.markdown;
import org.sonar.channel.RegexChannel;
+/**
+ * Markdown replace any line return by an HTML <br/>
+ * tag.
+ *
+ */
class HtmlEndOfLineChannel extends RegexChannel<MarkdownOutput> {
public HtmlEndOfLineChannel() {
diff --git a/sonar-markdown/src/main/java/org/sonar/markdown/HtmlUrlChannel.java b/sonar-markdown/src/main/java/org/sonar/markdown/HtmlUrlChannel.java
index 14933ca029a..7080a6abe3f 100644
--- a/sonar-markdown/src/main/java/org/sonar/markdown/HtmlUrlChannel.java
+++ b/sonar-markdown/src/main/java/org/sonar/markdown/HtmlUrlChannel.java
@@ -21,6 +21,10 @@ package org.sonar.markdown;
import org.sonar.channel.RegexChannel;
+/**
+ * Markdown will wrap any URL with an HTML <a href="URL"> tag.
+ *
+ */
class HtmlUrlChannel extends RegexChannel<MarkdownOutput> {
public HtmlUrlChannel() {
@@ -29,6 +33,6 @@ class HtmlUrlChannel extends RegexChannel<MarkdownOutput> {
@Override
protected void consume(CharSequence token, MarkdownOutput output) {
- output.append("<a href=\"" +token + "\">" + token + "</a>");
+ output.append("<a href=\"" + token + "\">" + token + "</a>");
}
}
diff --git a/sonar-markdown/src/main/java/org/sonar/markdown/IdentifierAndNumberChannel.java b/sonar-markdown/src/main/java/org/sonar/markdown/IdentifierAndNumberChannel.java
index 74b8dffb3b3..126f99d6013 100644
--- a/sonar-markdown/src/main/java/org/sonar/markdown/IdentifierAndNumberChannel.java
+++ b/sonar-markdown/src/main/java/org/sonar/markdown/IdentifierAndNumberChannel.java
@@ -21,6 +21,9 @@ package org.sonar.markdown;
import org.sonar.channel.RegexChannel;
+/**
+ * Channel used only to improve performances of the Markdown engine by consuming any sequence of letter or digit.
+ */
class IdentifierAndNumberChannel extends RegexChannel<MarkdownOutput> {
public IdentifierAndNumberChannel() {
diff --git a/sonar-markdown/src/main/java/org/sonar/markdown/MarkdownEngine.java b/sonar-markdown/src/main/java/org/sonar/markdown/MarkdownEngine.java
index 6a7f84dd7d4..773126ac166 100644
--- a/sonar-markdown/src/main/java/org/sonar/markdown/MarkdownEngine.java
+++ b/sonar-markdown/src/main/java/org/sonar/markdown/MarkdownEngine.java
@@ -26,6 +26,9 @@ import org.sonar.channel.Channel;
import org.sonar.channel.ChannelDispatcher;
import org.sonar.channel.CodeReader;
+/**
+ * Entry point of the Markdown library
+ */
public class MarkdownEngine {
private MarkdownOutput output;
diff --git a/sonar-markdown/src/main/java/org/sonar/markdown/package-info.java b/sonar-markdown/src/main/java/org/sonar/markdown/package-info.java
new file mode 100644
index 00000000000..b31bf274082
--- /dev/null
+++ b/sonar-markdown/src/main/java/org/sonar/markdown/package-info.java
@@ -0,0 +1,25 @@
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2011 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Sonar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+/**
+ * Basic implementation of the Markdown markup language (see http://en.wikipedia.org/wiki/Markdown)
+ *
+ */
+package org.sonar.markdown;
+