418563: Add basic functionallity for AsciiDoc
Adds support for atx and stx style headers
Basic formatting (bold, italic, etc.)
Renamed Asciidoc to AsciiDoc in classes and messages.
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=418563
Change-Id: Iaf9c3691eb32e58eecfdac1ea0b31eb7e92734da
Signed-off-by: Max Rydahl Andersen <manderse@redhat.com>
diff --git a/org.eclipse.mylyn.wikitext.asciidoc.core/META-INF/services/org.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguage b/org.eclipse.mylyn.wikitext.asciidoc.core/META-INF/services/org.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguage
index 3e07cb6..b2a82c1 100644
--- a/org.eclipse.mylyn.wikitext.asciidoc.core/META-INF/services/org.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguage
+++ b/org.eclipse.mylyn.wikitext.asciidoc.core/META-INF/services/org.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguage
@@ -1 +1 @@
-org.eclipse.mylyn.wikitext.asciidoc.core.AsciidocLanguage
+org.eclipse.mylyn.wikitext.asciidoc.core.AsciiDocLanguage
diff --git a/org.eclipse.mylyn.wikitext.asciidoc.core/plugin.properties b/org.eclipse.mylyn.wikitext.asciidoc.core/plugin.properties
index f5a283a..a180c3d 100644
--- a/org.eclipse.mylyn.wikitext.asciidoc.core/plugin.properties
+++ b/org.eclipse.mylyn.wikitext.asciidoc.core/plugin.properties
@@ -10,6 +10,6 @@
###############################################################################
Bundle-Vendor.0 = Eclipse Mylyn
-Bundle-Name.0 = Mylyn WikiText Asciidoc
+Bundle-Name.0 = Mylyn WikiText AsciiDoc
-content-type.name = Asciidoc WikiText Markup
+content-type.name = AsciiDoc WikiText Markup
diff --git a/org.eclipse.mylyn.wikitext.asciidoc.core/plugin.xml b/org.eclipse.mylyn.wikitext.asciidoc.core/plugin.xml
index 8e47078..9047b2b 100644
--- a/org.eclipse.mylyn.wikitext.asciidoc.core/plugin.xml
+++ b/org.eclipse.mylyn.wikitext.asciidoc.core/plugin.xml
@@ -12,8 +12,8 @@
-->
<plugin>
<extension point="org.eclipse.mylyn.wikitext.core.markupLanguage">
- <language class="org.eclipse.mylyn.wikitext.asciidoc.core.AsciidocLanguage"
- name="Asciidoc" fileExtensions="asciidoc,ad,adoc">
+ <language class="org.eclipse.mylyn.wikitext.asciidoc.core.AsciiDocLanguage"
+ name="AsciiDoc" fileExtensions="asciidoc,ad,adoc">
</language>
</extension>
diff --git a/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/block/HeadingBlock.java b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/block/HeadingBlock.java
new file mode 100644
index 0000000..ff3852c
--- /dev/null
+++ b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/block/HeadingBlock.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Stefan Seelmann and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Stefan Seelmann - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.wikitext.asciidoc.core.block;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.mylyn.wikitext.core.parser.Attributes;
+import org.eclipse.mylyn.wikitext.core.parser.markup.Block;
+
+/**
+ * AsciiDoc atx style headings.
+ *
+ * @author Stefan Seelmann
+ * @author Max Rydahl Andersen
+ */
+public class HeadingBlock extends Block {
+
+ private static final Pattern pattern = Pattern.compile("(={1,})\\s*(.+?)(\\s*)((?:=*\\s*))?"); //$NON-NLS-1$
+
+ private Matcher matcher;
+
+ @Override
+ public boolean canStart(String line, int lineOffset) {
+ if (lineOffset == 0) {
+ Matcher m = pattern.matcher(line);
+ if (m.matches() && m.group(1).length() < 6) {
+ matcher = m;
+ return true;
+ }
+ }
+ matcher = null;
+ return false;
+ }
+
+ @Override
+ public int processLineContent(String line, int offset) {
+ int level = matcher.group(1).length();
+ String text = matcher.group(2);
+ String closingGroup = matcher.group(4);
+
+ builder.beginHeading(level, new Attributes());
+ builder.characters(text);
+ if (closingGroup.length() > 0 && closingGroup.length() != level) {
+ builder.characters(matcher.group(3));
+ builder.characters(closingGroup);
+ }
+ builder.endHeading();
+
+ setClosed(true);
+ return -1;
+ }
+
+}
diff --git a/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/block/InlineHtmlBlock.java b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/block/InlineHtmlBlock.java
new file mode 100644
index 0000000..fb59166
--- /dev/null
+++ b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/block/InlineHtmlBlock.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Stefan Seelmann and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Stefan Seelmann - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.wikitext.asciidoc.core.block;
+
+import org.eclipse.mylyn.wikitext.core.parser.markup.Block;
+
+/**
+ * Asciidoc inline HTML.
+ *
+ * @author Stefan Seelmann @author Max Rydahl Andersen
+ */
+public class InlineHtmlBlock extends Block {
+
+ @Override
+ public boolean canStart(String line, int lineOffset) {
+ return line.startsWith("<"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected int processLineContent(String line, int offset) {
+ // empty line: start new block
+ if (markupLanguage.isEmptyLine(line)) {
+ setClosed(true);
+ return 0;
+ }
+
+ builder.charactersUnescaped(line);
+ builder.characters("\n"); //$NON-NLS-1$
+
+ return -1;
+ }
+
+}
diff --git a/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/block/ParagraphBlock.java b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/block/ParagraphBlock.java
index 1d96a8d..2d3ee84 100644
--- a/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/block/ParagraphBlock.java
+++ b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/block/ParagraphBlock.java
@@ -6,8 +6,10 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
+ * Stefan Seelmann - initial API and implementation
* Max Rydahl Andersen - copied from markdown to get base for asciidoc
*******************************************************************************/
+
package org.eclipse.mylyn.internal.wikitext.asciidoc.core.block;
import org.eclipse.mylyn.wikitext.core.parser.Attributes;
@@ -15,9 +17,9 @@
import org.eclipse.mylyn.wikitext.core.parser.markup.Block;
/**
- * Asciidoc default paragraph.
+ * AsciiDoc default paragraph.
*
- * @author Stefan Seelman
+ * @author Stefan Seelmann
* @author Max Rydahl Andersen - based/copied from markdown to adopt for asciidoc
*/
public class ParagraphBlock extends Block {
diff --git a/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/block/PreformattedBlock.java b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/block/PreformattedBlock.java
new file mode 100644
index 0000000..f3908b3
--- /dev/null
+++ b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/block/PreformattedBlock.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Max Rydahl and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Stefan Seelmann - initial API and implementation
+ * Max Rydahl Andersen - copied from markdown to get base for asciidoc
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.wikitext.asciidoc.core.block;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.mylyn.wikitext.core.parser.Attributes;
+import org.eclipse.mylyn.wikitext.core.parser.DocumentBuilder.BlockType;
+import org.eclipse.mylyn.wikitext.core.parser.markup.Block;
+
+/**
+ * AsciiDoc preformatted block.
+ *
+ * @author Stefan Seelmann
+ * @author Max Rydahl Andersen
+ */
+public class PreformattedBlock extends Block {
+
+ private static final Pattern startPattern = Pattern.compile("(?: {4}|\\t)((?: {4}|\\t)*)(.*)"); //$NON-NLS-1$
+
+ private int blockLineCount = 0;
+
+ @Override
+ public boolean canStart(String line, int lineOffset) {
+ if (lineOffset == 0) {
+ return startPattern.matcher(line).matches();
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ protected int processLineContent(String line, int offset) {
+
+ // start of block
+ if (blockLineCount == 0) {
+ builder.beginBlock(BlockType.PREFORMATTED, new Attributes());
+ }
+
+ // extract the content
+ Matcher matcher = startPattern.matcher(line);
+ if (!matcher.matches()) {
+ setClosed(true);
+ return 0;
+ }
+ String intent = matcher.group(1);
+ String content = matcher.group(2);
+
+ //If there is no content, close the block:
+ if (content.length() == 0) {
+ setClosed(true);
+ return 0;
+ }
+
+ // next line, does not convert to line break
+ if (blockLineCount > 0) {
+ builder.characters("\n"); //$NON-NLS-1$
+ }
+
+ // emit, handle intention, encode ampersands (&) and angle brackets (< and >)
+ if (intent != null) {
+ builder.characters(intent);
+ }
+ builder.characters(content);
+
+ blockLineCount++;
+ return -1;
+ }
+
+ @Override
+ public void setClosed(boolean closed) {
+ if (closed && !isClosed()) {
+ builder.endBlock();
+ }
+ super.setClosed(closed);
+ }
+}
diff --git a/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/block/UnderlinedHeadingBlock.java b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/block/UnderlinedHeadingBlock.java
new file mode 100644
index 0000000..135d20f
--- /dev/null
+++ b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/block/UnderlinedHeadingBlock.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Max Rydahl and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Stefan Seelmann - initial API and implementation
+ * Max Rydahl Andersen - copied from markdown to get base for asciidoc
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.wikitext.asciidoc.core.block;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.mylyn.internal.wikitext.asciidoc.core.util.LookAheadReader;
+import org.eclipse.mylyn.internal.wikitext.asciidoc.core.util.ReadAheadBlock;
+import org.eclipse.mylyn.wikitext.core.parser.Attributes;
+import org.eclipse.mylyn.wikitext.core.parser.markup.Block;
+
+/**
+ * AsciiDoc setext underlined headings.
+ *
+ * @author Stefan Seelmann
+ * @author Max Rydahl Andersen
+ */
+public class UnderlinedHeadingBlock extends Block implements ReadAheadBlock {
+
+ private static final Pattern h1pattern = Pattern.compile("(=+)\\s*"); //$NON-NLS-1$
+ private static final Pattern h2pattern = Pattern.compile("(-+)\\s*"); //$NON-NLS-1$
+ private static final Pattern h3pattern = Pattern.compile("(~+)\\s*"); //$NON-NLS-1$
+ private static final Pattern h4pattern = Pattern.compile("(\\^+)\\s*"); //$NON-NLS-1$
+ private static final Pattern h5pattern = Pattern.compile("(\\++)\\s*"); //$NON-NLS-1$
+
+ private int blockLineCount;
+
+ private int level;
+
+ public boolean canStart(String line, int lineOffset, LookAheadReader lookAheadReader) {
+ blockLineCount = 0;
+ level = 0;
+ String nextLine = lookAheadReader.lookAhead();
+ if (nextLine == null) {
+ return false;
+ } else {
+ int expectedLength = line.trim().length() - lineOffset;
+ if (checkNextLine(expectedLength, nextLine, h1pattern, 1)) {
+ return true;
+ } else if (checkNextLine(expectedLength, nextLine, h2pattern, 2)) {
+ return true;
+ } else if (checkNextLine(expectedLength, nextLine, h3pattern, 3)) {
+ return true;
+ } else if (checkNextLine(expectedLength, nextLine, h4pattern, 4)) {
+ return true;
+ } else if (checkNextLine(expectedLength, nextLine, h5pattern, 5)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+
+ /**
+ * The next line should be a sequence of same chars. The nextLine length (nextineLength) should:
+ * nextlineLength - 1 <= titleLength <= nextlineLength + 1
+ * @param length length of the current line (title)
+ * @param nextLine next line in the document
+ * @param pattern regular expression in a Pattern to match a line of chars in the next line
+ * @param l level that is set if the next line matches
+ * @return
+ */
+ private boolean checkNextLine(int length, String nextLine, Pattern pattern, int l) {
+ Matcher matcher = pattern.matcher(nextLine);
+ if(matcher.matches()) {
+ int lineLength = matcher.group(1).length();
+ if((lineLength > length - 2) && (lineLength < length + 2)) {
+ level = l;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean canStart(String line, int lineOffset) {
+ String message = "Read-ahead required, call canStart(String, int, LookAheadReader) instead."; //$NON-NLS-1$
+ throw new UnsupportedOperationException(message);
+ }
+
+ @Override
+ public int processLineContent(String line, int offset) {
+ if (blockLineCount == 0) {
+ builder.beginHeading(level, new Attributes());
+ builder.characters(line.trim());
+ } else {
+ builder.endHeading();
+ setClosed(true);
+ }
+
+ blockLineCount++;
+ return -1;
+ }
+}
diff --git a/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/phrase/BackslashEscapePhraseModifier.java b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/phrase/BackslashEscapePhraseModifier.java
new file mode 100644
index 0000000..ae1c29f
--- /dev/null
+++ b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/phrase/BackslashEscapePhraseModifier.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Max Rydahl Andersen and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Stefan Seelmann - initial API and implementation
+ * Max Rydahl Andersen - copied from markdown to get base for asciidoc
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.wikitext.asciidoc.core.phrase;
+
+import java.util.regex.Pattern;
+
+import org.eclipse.mylyn.wikitext.core.parser.markup.token.PatternLiteralReplacementToken;
+
+/**
+ *
+ *
+ * @author Stefan Seelmann
+ */
+public class BackslashEscapePhraseModifier extends PatternLiteralReplacementToken {
+
+ public BackslashEscapePhraseModifier(String token) {
+ super("(" + Pattern.quote("\\" + token) + ")", token); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+}
diff --git a/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/phrase/SimplePhraseModifier.java b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/phrase/SimplePhraseModifier.java
new file mode 100644
index 0000000..e320af4
--- /dev/null
+++ b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/phrase/SimplePhraseModifier.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Max Rydahl Andersen and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Stefan Seelmann - initial API and implementation
+ * Max Rydahl Andersen - copied from markdown to get base for asciidoc
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.wikitext.asciidoc.core.phrase;
+
+import java.util.regex.Pattern;
+
+import org.eclipse.mylyn.wikitext.core.parser.Attributes;
+import org.eclipse.mylyn.wikitext.core.parser.DocumentBuilder.SpanType;
+import org.eclipse.mylyn.wikitext.core.parser.markup.PatternBasedElement;
+import org.eclipse.mylyn.wikitext.core.parser.markup.PatternBasedElementProcessor;
+
+/**
+ *
+ * @author Stefan Seelmann
+ *
+ */
+public class SimplePhraseModifier extends PatternBasedElement {
+
+ private final String delimiter;
+
+ private final SpanType spanType;
+
+ public SimplePhraseModifier(String delimiter, SpanType spanType) {
+ this.delimiter = delimiter;
+ this.spanType = spanType;
+ }
+
+ @Override
+ protected String getPattern(int groupOffset) {
+ String quotedDelimiter = Pattern.quote(delimiter);
+ return quotedDelimiter + " *" + "(.+?)" + " *" + quotedDelimiter; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ @Override
+ protected int getPatternGroupCount() {
+ return 1;
+ }
+
+ @Override
+ protected PatternBasedElementProcessor newProcessor() {
+ return new CodePhraseModifierProcessor();
+ }
+
+ private class CodePhraseModifierProcessor extends PatternBasedElementProcessor {
+
+ @Override
+ public void emit() {
+ String content = group(1);
+ getBuilder().beginSpan(spanType, new Attributes());
+ getMarkupLanguage().emitMarkupText(parser, state, content);
+ getBuilder().endSpan();
+ }
+ }
+}
diff --git a/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/token/PreserverHtmlEntityToken.java b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/token/PreserverHtmlEntityToken.java
new file mode 100644
index 0000000..be0d1d2
--- /dev/null
+++ b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/token/PreserverHtmlEntityToken.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Stefan Seelmann and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Stefan Seelmann - initial API and implementation
+ * Max Rydahl Andersen - copied from markdown to get base for asciidoc
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.wikitext.asciidoc.core.token;
+
+import org.eclipse.mylyn.wikitext.core.parser.markup.PatternBasedElement;
+import org.eclipse.mylyn.wikitext.core.parser.markup.PatternBasedElementProcessor;
+import org.eclipse.mylyn.wikitext.core.parser.markup.phrase.LiteralPhraseModifierProcessor;
+
+/**
+ * A phrase modifier that detects HTML and XML entities in the source.
+ *
+ * @author Stefan Seelmann
+ * @author Max Rydahl Andersen
+ */
+public class PreserverHtmlEntityToken extends PatternBasedElement {
+
+ @Override
+ protected String getPattern(int groupOffset) {
+ return "(&[A-Za-z]{1,32}+;)"; //$NON-NLS-1$
+ }
+
+ @Override
+ protected PatternBasedElementProcessor newProcessor() {
+ return new LiteralPhraseModifierProcessor(false);
+ }
+
+ @Override
+ protected int getPatternGroupCount() {
+ return 1;
+ }
+
+}
diff --git a/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/util/LookAheadReader.java b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/util/LookAheadReader.java
new file mode 100644
index 0000000..f78ddda
--- /dev/null
+++ b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/util/LookAheadReader.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Max Rydahl Andersen and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Stefan Seelmann - initial API and implementation
+ * Max Rydahl Andersen - copied from markdown to get base for asciidoc
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.wikitext.asciidoc.core.util;
+
+import java.io.IOException;
+import java.io.StringReader;
+
+import org.eclipse.mylyn.wikitext.core.parser.markup.ContentState;
+import org.eclipse.mylyn.wikitext.core.util.LocationTrackingReader;
+
+public class LookAheadReader {
+
+ private ContentState state;
+
+ private LocationTrackingReader reader;
+
+ public void setContentState(ContentState state) {
+ if (mustInitReader(state)) {
+ this.state = state;
+ this.reader = new LocationTrackingReader(new StringReader(state.getMarkupContent()));
+ }
+ }
+
+ private boolean mustInitReader(ContentState newState) {
+ if (state != newState) {
+ return true;
+ }
+ if (reader == null) {
+ return true;
+ }
+ if (reader.getLineNumber() >= state.getLineNumber()) {
+ return true;
+ }
+ return false;
+ }
+
+ public String lookAhead() {
+ int lineNumber = state.getLineNumber();
+ String nextLine = null;
+ while (reader.getLineNumber() < lineNumber) {
+ try {
+ nextLine = reader.readLine();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ return nextLine;
+ }
+
+}
diff --git a/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/util/ReadAheadBlock.java b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/util/ReadAheadBlock.java
new file mode 100644
index 0000000..b999fe7
--- /dev/null
+++ b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/util/ReadAheadBlock.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Max Rydahl Andersen and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Stefan Seelmann - initial API and implementation
+ * Max Rydahl Andersen - copied from markdown to get base for asciidoc
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.wikitext.asciidoc.core.util;
+
+import org.eclipse.mylyn.wikitext.core.parser.markup.Block;
+
+/**
+ * Markup blocks that require additional context in order to decide if they can start with a markup line.
+ *
+ * @author Stefan Seelmann
+ * @author Max Rydahl Andersen
+ */
+public interface ReadAheadBlock extends Cloneable {
+
+ /**
+ * Indicate if the block can start with the given markup line at the provided offset. The
+ * <code>lookAheadReader</code> can be used to ask for more context.
+ *
+ * @param line
+ * the line of markup to test
+ * @param lineOffset
+ * the offset at which the block should start processing
+ * @param lookAheadReader
+ * the look ahead reader to ask for more context
+ * @return true if the provided markup consists of a valid starting point for the block
+ * @see Block#canStart(String, int)
+ */
+ boolean canStart(String line, int lineOffset, LookAheadReader lookAheadReader);
+
+}
diff --git a/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/util/ReadAheadDispatcher.java b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/util/ReadAheadDispatcher.java
new file mode 100644
index 0000000..191081e
--- /dev/null
+++ b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/internal/wikitext/asciidoc/core/util/ReadAheadDispatcher.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Stefan Seelmann and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Stefan Seelmann - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.wikitext.asciidoc.core.util;
+
+import org.eclipse.mylyn.wikitext.core.parser.MarkupParser;
+import org.eclipse.mylyn.wikitext.core.parser.markup.Block;
+import org.eclipse.mylyn.wikitext.core.parser.markup.ContentState;
+
+/**
+ * Adapter {@link Block} for {@link ReadAheadBlock}s.
+ *
+ * @author Stefan Seelmann
+ * @author Max Rydahl Andersen
+ */
+public class ReadAheadDispatcher extends Block {
+
+ private final LookAheadReader lookAheadReader;
+
+ private Block[] blocks;
+
+ private Block dispatchedBlock;
+
+ public ReadAheadDispatcher(Block... blocks) {
+ this.blocks = blocks;
+ this.lookAheadReader = new LookAheadReader();
+ }
+
+ @Override
+ public boolean canStart(String line, int lineOffset) {
+ dispatchedBlock = null;
+ return true;
+ }
+
+ @Override
+ protected int processLineContent(String line, int offset) {
+ if (dispatchedBlock == null) {
+ lookAheadReader.setContentState(getState());
+ for (Block block : blocks) {
+ if (block instanceof ReadAheadBlock) {
+ ReadAheadBlock raBlock = ReadAheadBlock.class.cast(block);
+ if (raBlock.canStart(line, offset, lookAheadReader)) {
+ dispatchedBlock = block;
+ break;
+ }
+ } else {
+ if (block.canStart(line, offset)) {
+ dispatchedBlock = block;
+ break;
+ }
+ }
+ }
+ }
+
+ int result = dispatchedBlock.processLine(line, offset);
+ if (dispatchedBlock.isClosed()) {
+ setClosed(true);
+ }
+ return result;
+ }
+
+ @Override
+ public void setClosed(boolean closed) {
+ dispatchedBlock.setClosed(closed);
+ super.setClosed(closed);
+ }
+
+ @Override
+ public void setState(ContentState state) {
+ for (Block block : blocks) {
+ block.setState(state);
+ }
+ super.setState(state);
+ }
+
+ @Override
+ public void setParser(MarkupParser parser) {
+ for (Block block : blocks) {
+ block.setParser(parser);
+ }
+ super.setParser(parser);
+ }
+
+ @Override
+ public Block clone() {
+ ReadAheadDispatcher clone = (ReadAheadDispatcher) super.clone();
+ Block[] clonedBlocks = new Block[blocks.length];
+ int i = 0;
+ for (Block block : blocks) {
+ clonedBlocks[i++] = block.clone();
+ }
+ clone.blocks = clonedBlocks;
+ return clone;
+ }
+
+}
diff --git a/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/wikitext/asciidoc/core/AsciiDocLanguage.java b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/wikitext/asciidoc/core/AsciiDocLanguage.java
new file mode 100644
index 0000000..4b455c5
--- /dev/null
+++ b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/wikitext/asciidoc/core/AsciiDocLanguage.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Stefan Seelmann and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Stefan Seelmann - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.wikitext.asciidoc.core;
+
+import java.util.List;
+
+import org.eclipse.mylyn.internal.wikitext.asciidoc.core.block.HeadingBlock;
+import org.eclipse.mylyn.internal.wikitext.asciidoc.core.block.ParagraphBlock;
+import org.eclipse.mylyn.internal.wikitext.asciidoc.core.block.PreformattedBlock;
+import org.eclipse.mylyn.internal.wikitext.asciidoc.core.block.UnderlinedHeadingBlock;
+import org.eclipse.mylyn.internal.wikitext.asciidoc.core.phrase.BackslashEscapePhraseModifier;
+import org.eclipse.mylyn.internal.wikitext.asciidoc.core.phrase.SimplePhraseModifier;
+import org.eclipse.mylyn.internal.wikitext.asciidoc.core.token.PreserverHtmlEntityToken;
+import org.eclipse.mylyn.internal.wikitext.asciidoc.core.util.ReadAheadDispatcher;
+import org.eclipse.mylyn.wikitext.core.parser.DocumentBuilder.SpanType;
+import org.eclipse.mylyn.wikitext.core.parser.markup.AbstractMarkupLanguage;
+import org.eclipse.mylyn.wikitext.core.parser.markup.Block;
+import org.eclipse.mylyn.wikitext.core.parser.markup.token.PatternLineBreakReplacementToken;
+
+/**
+ * A markup language implementing Asciidoc syntax.
+ *
+ * @author Stefan Seelmann
+ * @author Max Rydahl Andersen
+ * @since 1.0
+ */
+public class AsciiDocLanguage extends AbstractMarkupLanguage {
+
+ public AsciiDocLanguage() {
+ setName("AsciiDoc"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected void addStandardTokens(PatternBasedSyntax tokenSyntax) {
+ // HTML entities are preserved
+ tokenSyntax.add(new PreserverHtmlEntityToken());
+ // line ending with a + will cause a line Break
+ tokenSyntax.add(new PatternLineBreakReplacementToken("(\\s\\+)\\s*")); //$NON-NLS-1$
+ }
+
+ @Override
+ protected void addStandardPhraseModifiers(PatternBasedSyntax phraseModifierSyntax) {
+ // backslash escaped span elements
+ phraseModifierSyntax.add(new BackslashEscapePhraseModifier("+")); //$NON-NLS-1$
+ phraseModifierSyntax.add(new BackslashEscapePhraseModifier("*")); //$NON-NLS-1$
+ phraseModifierSyntax.add(new BackslashEscapePhraseModifier("_")); //$NON-NLS-1$
+ // emphasis span elements
+ phraseModifierSyntax.add(new SimplePhraseModifier("`", SpanType.CODE)); //$NON-NLS-1$
+ phraseModifierSyntax.add(new SimplePhraseModifier("+", SpanType.CODE)); //$NON-NLS-1$
+ phraseModifierSyntax.add(new SimplePhraseModifier("*", SpanType.STRONG)); //$NON-NLS-1$
+ phraseModifierSyntax.add(new SimplePhraseModifier("_", SpanType.EMPHASIS)); //$NON-NLS-1$
+
+
+ }
+
+ @Override
+ protected void addStandardBlocks(List<Block> blocks, List<Block> paragraphBreakingBlocks) {
+ blocks.add(new PreformattedBlock());
+ blocks.add(new HeadingBlock());
+ }
+
+ @Override
+ protected Block createParagraphBlock() {
+ ParagraphBlock paragraphBlock = new ParagraphBlock();
+ UnderlinedHeadingBlock headingBlock = new UnderlinedHeadingBlock();
+ ReadAheadDispatcher readAheadBlock = new ReadAheadDispatcher(headingBlock, paragraphBlock);
+ return readAheadBlock;
+ }
+
+}
diff --git a/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/wikitext/asciidoc/core/AsciidocLanguage.java b/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/wikitext/asciidoc/core/AsciidocLanguage.java
deleted file mode 100644
index 991ae0c..0000000
--- a/org.eclipse.mylyn.wikitext.asciidoc.core/src/org/eclipse/mylyn/wikitext/asciidoc/core/AsciidocLanguage.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 Max Rydahl Andersen and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Max Rydahl Andersen - copied from markdown to get base for asciidoc
- *******************************************************************************/
-
-package org.eclipse.mylyn.wikitext.asciidoc.core;
-
-import java.util.List;
-
-import org.eclipse.mylyn.internal.wikitext.asciidoc.core.block.ParagraphBlock;
-import org.eclipse.mylyn.wikitext.core.parser.markup.AbstractMarkupLanguage;
-import org.eclipse.mylyn.wikitext.core.parser.markup.Block;
-
-/**
- * A markup language implementing Asciidoc syntax.
- *
- * @author Stefan Seelmann
- * @author Max Rydahl Andersen
- */
-public class AsciidocLanguage extends AbstractMarkupLanguage {
-
- public AsciidocLanguage() {
- setName("Asciidoc"); //$NON-NLS-1$
- }
-
- @Override
- protected void addStandardTokens(PatternBasedSyntax tokenSyntax) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- protected void addStandardPhraseModifiers(PatternBasedSyntax phraseModifierSyntax) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- protected void addStandardBlocks(List<Block> blocks, List<Block> paragraphBreakingBlocks) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- protected Block createParagraphBlock() {
- return new ParagraphBlock();
- }
-
-}
diff --git a/org.eclipse.mylyn.wikitext.asciidoc.tests/plugin.properties b/org.eclipse.mylyn.wikitext.asciidoc.tests/plugin.properties
index 344fe53..ba37b59 100644
--- a/org.eclipse.mylyn.wikitext.asciidoc.tests/plugin.properties
+++ b/org.eclipse.mylyn.wikitext.asciidoc.tests/plugin.properties
@@ -11,4 +11,4 @@
#Properties file for org.eclipse.mylyn.wikitext.tests
Bundle-Vendor.0 = Eclipse Mylyn
-Bundle-Name.0 = Mylyn WikiText Asciidoc Tests Plug-in
\ No newline at end of file
+Bundle-Name.0 = Mylyn WikiText AsciiDoc Tests Plug-in
\ No newline at end of file
diff --git a/org.eclipse.mylyn.wikitext.asciidoc.tests/src/org/eclipse/mylyn/internal/wikitext/asciidoc/tests/AsciiDocLanguageBlockElementsTest.java b/org.eclipse.mylyn.wikitext.asciidoc.tests/src/org/eclipse/mylyn/internal/wikitext/asciidoc/tests/AsciiDocLanguageBlockElementsTest.java
new file mode 100644
index 0000000..f745708
--- /dev/null
+++ b/org.eclipse.mylyn.wikitext.asciidoc.tests/src/org/eclipse/mylyn/internal/wikitext/asciidoc/tests/AsciiDocLanguageBlockElementsTest.java
@@ -0,0 +1,535 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Stefan Seelmann and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Stefan Seelmann - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.wikitext.asciidoc.tests;
+
+import java.util.regex.Pattern;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Tests for asciidoc block elements.
+ *
+ * @author Max Rydahl Andersen
+ */
+public class AsciiDocLanguageBlockElementsTest extends AsciiDocLanguageTestBase {
+
+ @Test
+ public void paragraphWithOneLine() {
+ String html = parseToHtml("a paragraph");
+ assertEquals(html,"<p>a paragraph</p>\n");
+ }
+
+ public void testParagraphWithMulitpleLines() {
+ String html = parseToHtml("a paragraph\nwith multiple\nlines");
+
+ assertEquals(html,"<p>a paragraph\nwith multiple\nlines</p>");
+ }
+
+ public void testParagraphsSeparatedBySingleBlankLine() {
+ String html = parseToHtml("a paragraph\n\nanother paragraph\n\n");
+
+ assertEquals(html,"<p>a paragraph</p>");
+ assertEquals(html,"<p>another paragraph</p>");
+ }
+
+ public void testParagraphsSeparatedByMulitpleBlankLines() {
+ String html = parseToHtml("a paragraph\n\n\nanother paragraph\n\n\n");
+
+ assertEquals(html,"<p>a paragraph</p>");
+ assertEquals(html,"<p>another paragraph</p>");
+ }
+
+ public void testParagraphsSeparatedByMulitpleBlankLinesWithSpacesAndTabs() {
+ String html = parseToHtml("a paragraph\n \n\t\nanother paragraph");
+
+ assertEquals(html,"<p>a paragraph</p>");
+ assertEquals(html,"<p>another paragraph</p>");
+ }
+
+ public void testLineBreakInParagraph() {
+ String html = parseToHtml("line 1 +\nline 2 +\nline 3");
+
+ assertTrue(Pattern.compile(
+ "<p>line 1<br/?>\nline 2<br/?>\nline 3</p>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testLineBreakInParagraphWithTabAndMultipleSpaces() {
+ String html = parseToHtml("line 1 +\nline 2\t+\nline 3");
+
+ assertTrue(Pattern.compile(
+ "<p>line 1 <br/?>\nline 2<br/?>\nline 3</p>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testLineBreakInParagraphTrailingSpaces() {
+ String html = parseToHtml("line 1 + \nline 2 +\t\nline 3");
+
+ assertTrue(Pattern.compile(
+ "<p>line 1<br/?>\nline 2<br/?>\nline 3</p>")
+ .matcher(html)
+ .find());
+ }
+
+
+ /*
+ * Headers.
+ */
+ public void testEqStyleHeaderLevel1() {
+ String html = parseToHtml("== This is an H2");
+
+ assertTrue(Pattern.compile(
+ "<h2[^>]*>This is an H2</h2>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testEqStyleHeaderLevel2() {
+ String html = parseToHtml("=== This is an H3");
+
+ assertTrue(Pattern.compile(
+ "<h3[^>]*>This is an H3</h3>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testEqStyleHeaderLevel3() {
+ String html = parseToHtml("==== This is an H4");
+
+ assertTrue(Pattern.compile(
+ "<h4[^>]*>This is an H4</h4>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testEqStyleHeaderLevel4() {
+ String html = parseToHtml("===== This is an H5");
+
+ assertTrue(Pattern.compile(
+ "<h5[^>]*>This is an H5</h5>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testEqStyleHeaderNotH6() {
+ String html = parseToHtml("====== This is not h6");
+
+ assertEquals(html,"<p>====== This is not h6</p>");
+ }
+
+ public void testEqStyleHeaderNoTitleWith7eq() {
+ String html = parseToHtml("======== This is not a title (7)");
+
+ assertEquals(html,"<p>======== This is not a title (7)</p>");
+ }
+
+ public void testEqStyleHeaderNoTitleWith10eq() {
+ String html = parseToHtml("=========== This is not a title (10)");
+
+ assertEquals(html,"<p>=========== This is not a title (10)</p>");
+ }
+
+ /*
+ * Optionally, you may "close" equals-style headers.
+ */
+ public void testClosedEqStyleHeaderLevel1() {
+ String html = parseToHtml("== This is also H2 ==");
+
+ assertTrue(Pattern.compile(
+ "<h2[^>]*>This is also H2</h2>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testClosedEqStyleHeaderLevel2() {
+ String html = parseToHtml("=== This is also H3 ===");
+
+ assertTrue(Pattern.compile(
+ "<h3[^>]*>This is also H3</h3>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testClosedEqStyleHeaderLevel3() {
+ String html = parseToHtml("==== This is also H4 ====");
+
+ assertTrue(Pattern.compile(
+ "<h4[^>]*>This is also H4</h4>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testClosedEqStyleHeaderLevel4() {
+ String html = parseToHtml("===== This is also H5 =====");
+
+ assertTrue(Pattern.compile(
+ "<h5[^>]*>This is also H5</h5>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testClosedEqStyleHeaderLevel4WithSpaces() {
+ String html = parseToHtml("===== This is H5 with spaces =====");
+
+ assertTrue(Pattern.compile(
+ "<h5[^>]*>This is H5 with spaces</h5>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testClosedEqStyleHeaderNotH6() {
+ String html = parseToHtml("====== This is also not h6 ======");
+
+ assertEquals(html,"<p>====== This is also not h6 ======</p>");
+ }
+
+ public void testClosedEqStyleHeaderNoTitleWith7eq() {
+ String html = parseToHtml("======= This is also not a title (7) =======");
+
+ assertEquals(html,"<p>======= This is also not a title (7) =======</p>");
+ }
+
+ public void testClosedEqStyleHeaderNoTitleWith12eq() {
+ String html = parseToHtml("============ This is also not a title (12) ============");
+
+ assertEquals(html,"<p>============ This is also not a title (12) ============</p>");
+ }
+
+ public void testClosedEqStyleHeaderWithMoreClosingEq() {
+ String html = parseToHtml("== This is an H2 again ==================");
+
+ assertTrue(Pattern.compile(
+ "<h2[^>]*>This is an H2 again ==================</h2>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testClosedEqStyleHeaderWithMoreClosingEqAndSpaces() {
+ String html = parseToHtml("== This is an H2 with spaces ====");
+
+ assertTrue(Pattern.compile(
+ "<h2[^>]*>This is an H2 with spaces ====</h2>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testClosedAtxStyleHeaderWithLessCosingEq() {
+ String html = parseToHtml("===== This is an H5 again ==");
+
+ assertTrue(Pattern.compile(
+ "<h5[^>]*>This is an H5 again ==</h5>")
+ .matcher(html)
+ .find());
+ }
+
+ /*
+ * "underlined" headers
+ */
+ public void testUnderlinedLevel1() {
+ String html = parseToHtml("This is an underlined H2\n------------------------");
+
+ assertTrue(Pattern.compile(
+ "<h2[^>]*>This is an underlined H2</h2>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testUnderlinedLevel2() {
+ String html = parseToHtml("This is an underlined H3\n~~~~~~~~~~~~~~~~~~~~~~~~");
+
+ assertTrue(Pattern.compile(
+ "<h3[^>]*>This is an underlined H3</h3>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testUnderlinedLevel3() {
+ String html = parseToHtml("This is an underlined H4\n^^^^^^^^^^^^^^^^^^^^^^^^");
+
+ assertTrue(Pattern.compile(
+ "<h4[^>]*>This is an underlined H4</h4>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testUnderlinedLevel4() {
+ String html = parseToHtml("This is an underlined H5\n++++++++++++++++++++++++");
+
+ assertTrue(Pattern.compile(
+ "<h5[^>]*>This is an underlined H5</h5>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testUnderlinedLevel1LineMinusOneChar() {
+ String html = parseToHtml("Lorem Ipsum\n----------"); //title 11 chars, line 10 chars
+
+ assertTrue(Pattern.compile(
+ "<h2[^>]*>Lorem Ipsum</h2>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testUnderlinedLevel2LineMinusOneChar() {
+ String html = parseToHtml("Lorem Ipsum Dolor\n~~~~~~~~~~~~~~~~"); //title 17 chars, line 16 chars
+
+ assertTrue(Pattern.compile(
+ "<h3[^>]*>Lorem Ipsum Dolor</h3>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testUnderlinedLevel3LineMinusOneChar() {
+ String html = parseToHtml("LoremIpsumDolor\n^^^^^^^^^^^^^^"); //title 15 chars, line 14 chars
+
+ assertTrue(Pattern.compile(
+ "<h4[^>]*>LoremIpsumDolor</h4>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testUnderlinedLevel4LineMinusOneChar() {
+ String html = parseToHtml("Lorem-Ipsum\n++++++++++"); //title 11 chars, line 10 chars
+
+ assertTrue(Pattern.compile(
+ "<h5[^>]*>Lorem-Ipsum</h5>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testUnderlinedLevel1LinePlusOneChar() {
+ String html = parseToHtml("Lorem Ipsum\n------------"); //title 11 chars, line 12 chars
+
+ assertTrue(Pattern.compile(
+ "<h2[^>]*>Lorem Ipsum</h2>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testNotUnderlinedLevel1LineMinusTwoChars() {
+ String html = parseToHtml("Lorem Ipsum\n---------"); //title 11 chars, line 9 chars
+
+ assertFalse(Pattern.compile(
+ "<h2[^>]*>Lorem Ipsum</h2>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testNotUnderlinedLevel2LineMinusTwoChars() {
+ String html = parseToHtml("Lorem Ipsum Dolor\n~~~~~~~~~~~~~~~"); //title 17 chars, line 15 chars
+
+ assertFalse(Pattern.compile(
+ "<h3[^>]*>Lorem Ipsum Dolor</h3>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testNotUnderlinedLevel3LineMinusTwoChars() {
+ String html = parseToHtml("LoremIpsumDolor\n^^^^^^^^^^^^^"); //title 15 chars, line 13 chars
+
+ assertFalse(Pattern.compile(
+ "<h4[^>]*>LoremIpsumDolor</h4>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testNotUnderlinedLevel4LineMinusTwoChars() {
+ String html = parseToHtml("Lorem-Ipsum\n+++++++++"); //title 11 chars, line 9 chars
+
+ assertFalse(Pattern.compile(
+ "<h5[^>]*>Lorem-Ipsum</h5>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testNotUnderlinedLevel1LinePlusTwoChars() {
+ String html = parseToHtml("Lorem Ipsum\n-------------"); //title 11 chars, line 13 chars
+
+ assertFalse(Pattern.compile(
+ "<h2[^>]*>Lorem Ipsum</h2>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testNotUnderlinedLevel2LinePlusTwoChars() {
+ String html = parseToHtml("Lorem Ipsum Dolor\n~~~~~~~~~~~~~~~~~~~"); //title 17 chars, line 18 chars
+
+ assertFalse(Pattern.compile(
+ "<h3[^>]*>Lorem Ipsum Dolor</h3>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testNotUnderlinedLevel3LinePlusTwoChars() {
+ String html = parseToHtml("LoremIpsumDolor\n^^^^^^^^^^^^^^^^^"); //title 15 chars, line 16 chars
+
+ assertFalse(Pattern.compile(
+ "<h4[^>]*>LoremIpsumDolor</h4>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testNotUnderlinedLevel4LinePlusTwoChars() {
+ String html = parseToHtml("Lorem-Ipsum\n+++++++++++++"); //title 11 chars, line 12 chars
+
+ assertFalse(Pattern.compile(
+ "<h5[^>]*>Lorem-Ipsum</h5>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testUnderlinedLevel1TitleTrailingSpaces() {
+ String html = parseToHtml("Title test underlined H2 \n------------------------");
+
+ assertTrue(Pattern.compile(
+ "<h2[^>]*>Title test underlined H2</h2>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testUnderlinedLevel2TitleTrailingSpaces() {
+ String html = parseToHtml("Title test underlined H3\t\n~~~~~~~~~~~~~~~~~~~~~~~~");
+
+ assertTrue(Pattern.compile(
+ "<h3[^>]*>Title test underlined H3</h3>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testUnderlinedLevel3TitleTrailingSpaces() {
+ String html = parseToHtml("Title test underlined H4 \t\n^^^^^^^^^^^^^^^^^^^^^^^^");
+
+ assertTrue(Pattern.compile(
+ "<h4[^>]*>Title test underlined H4</h4>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testUnderlinedLevel4TitleTrailingSpaces() {
+ String html = parseToHtml("Title test underlined H5\t \n++++++++++++++++++++++++");
+
+ assertTrue(Pattern.compile(
+ "<h5[^>]*>Title test underlined H5</h5>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testUnderlinedLevel1LineWithTrailingSpaces() {
+ String html = parseToHtml("Title test underlined H2\n------------------------ ");
+
+ assertTrue(Pattern.compile(
+ "<h2[^>]*>Title test underlined H2</h2>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testUnderlinedLevel2LineWithTrailingSpaces() {
+ String html = parseToHtml("Title test underlined H3\n~~~~~~~~~~~~~~~~~~~~~~~~\t");
+
+ assertTrue(Pattern.compile(
+ "<h3[^>]*>Title test underlined H3</h3>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testUnderlinedLevel3LineWithTrailingSpaces() {
+ String html = parseToHtml("Title test underlined H4\n^^^^^^^^^^^^^^^^^^^^^^^^\t\t");
+
+ assertTrue(Pattern.compile(
+ "<h4[^>]*>Title test underlined H4</h4>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testUnderlinedLevel4LineWithTrailingSpaces() {
+ String html = parseToHtml("Title test underlined H5\n++++++++++++++++++++++++\t ");
+
+ assertTrue(Pattern.compile(
+ "<h5[^>]*>Title test underlined H5</h5>")
+ .matcher(html)
+ .find());
+ }
+
+ public void testPreBlockIndentedByFourSpaces() {
+ String html = parseToHtml(" This is a pre block.");
+
+ assertEquals(html,"<pre>This is a pre block.</pre>");
+ }
+
+ public void testPreBlockIndentedByOneTab() {
+ String html = parseToHtml("\tThis is a pre block.");
+
+ assertEquals(html,"<pre>This is a pre block.</pre>");
+ }
+
+ /*
+ * One level of indentation - 4 spaces or 1 tab - is removed from each line of the pre block.
+ */
+ public void testPreBlockMultiLineIndentedByFourSpaces() {
+ String html = parseToHtml(" aaa\n bbb\n ccc");
+
+ String expectedHtml = "<pre>aaa\n bbb\n ccc</pre>";
+ assertEquals(html,expectedHtml);
+ }
+
+ public void testPreBlockMultiLineIndentedByOneTab() {
+ String html = parseToHtml("\taaa\n\t\tbbb\n\t\t\tccc");
+
+ String expectedHtml = "<pre>aaa\n\tbbb\n\t\tccc</pre>";
+ assertEquals(html,expectedHtml);
+ }
+
+ public void testPreBlockMultiLineIndentedByFourSpacesNoContinueAfterEmptyLine() {
+ String html = parseToHtml(" aaa\n bbb\n ccc\n \n after empty line");
+
+ assertEquals(html,"<pre>aaa\nbbb\nccc</pre>");
+ assertEquals(html,"<pre>after empty line</pre>");
+ }
+
+ public void testPreBlockMultiLineIndentedByFourSpacesNoContinueAfterTabLine() {
+ String html = parseToHtml(" aaa\n bbb\n ccc\n \t\t\n after empty line");
+
+ assertEquals(html,"<pre>aaa\nbbb\nccc</pre>");
+ assertEquals(html,"<pre>after empty line</pre>");
+ }
+
+ public void testPreBlockMultiLineIndentedByOneTabNoContinueAfterEmptyLine() {
+ String html = parseToHtml("\taaa\n\tbbb\n\tccc\n\t\n\tafter empty line");
+
+ assertEquals(html,"<pre>aaa\nbbb\nccc</pre>");
+ assertEquals(html,"<pre>after empty line</pre>");
+ }
+
+ /**
+ * Within a pre block, ampersands (&) and angle brackets (< and >) are automatically converted into HTML entities.
+ */
+ public void testSpecialCharactersAreConvertedInCodeBlock() {
+ String html = parseToHtml(" <div class=\"footer\">\n © 2004 Foo Bar\n </div>");
+
+ String expectedHtml = "<pre><div class=\"footer\">\n&copy; 2004 Foo Bar\n</div></pre>";
+ assertEquals(html,expectedHtml);
+ }
+
+ /**
+ * Regular asciidoc syntax is not processed within code blocks.
+ */
+ public void testNoProcessingInCodeBlock() {
+ String html = parseToHtml(" === Header 3\n Lorem *ipsum*");
+
+ String expectedHtml = "<pre>=== Header 3\nLorem *ipsum*</pre>";
+ assertEquals(html,expectedHtml);
+ }
+}
diff --git a/org.eclipse.mylyn.wikitext.asciidoc.tests/src/org/eclipse/mylyn/internal/wikitext/asciidoc/tests/AsciiDocLanguageMiscellaneousTest.java b/org.eclipse.mylyn.wikitext.asciidoc.tests/src/org/eclipse/mylyn/internal/wikitext/asciidoc/tests/AsciiDocLanguageMiscellaneousTest.java
new file mode 100644
index 0000000..7cc7fc5
--- /dev/null
+++ b/org.eclipse.mylyn.wikitext.asciidoc.tests/src/org/eclipse/mylyn/internal/wikitext/asciidoc/tests/AsciiDocLanguageMiscellaneousTest.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Max Rydahl Andersen and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Max Rydahl Andersen - copied from markdown to get base for asciidoc
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.wikitext.asciidoc.tests;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+/**
+ * Tests for asciidoc overview and miscellaneous.
+ *
+ * @author Max Rydahl Andersen
+ */
+public class AsciiDocLanguageMiscellaneousTest extends AsciiDocLanguageTestBase {
+
+ @Test
+ public void emptyLine() {
+ String html = parseToHtml(" ");
+ assertEquals("", html);
+ }
+
+ @Test
+ public void preserveHtmlEntities() {
+ String html = parseToHtml("© &");
+ assertEquals("<p>© &</p>\n", html);
+ }
+
+ @Test
+ public void ampersandIsEscaped() {
+ String html = parseToHtml("AT&T, a & b");
+ assertEquals("<p>AT&T, a & b</p>\n", html);
+ }
+
+ @Test
+ public void angleBracketsAreEscaped() {
+ // lower than:
+ String html = parseToHtml("4 < 5");
+ assertEquals("<p>4 < 5</p>\n", html);
+
+ // greater than:
+ html = parseToHtml("6 > 5");
+ assertEquals("<p>6 > 5</p>\n", html);
+ }
+
+ @Test
+ public void backslashBackslash() {
+ // this is not an escaped backslash
+ String html = parseToHtml("\\\\");
+ assertEquals("<p>\\\\</p>\n", html);
+ }
+
+ @Test
+ public void backslashBacktick() {
+ // this is not an escaped backtick
+ String html = parseToHtml("\\`");
+ assertEquals("<p>\\`</p>\n", html);
+ }
+
+ @Test
+ public void backslashOpeningCurlyBrace() {
+ // this is not an escaped opening curly brace
+ String html = parseToHtml("\\{");
+ assertEquals("<p>\\{</p>\n", html);
+ }
+
+ @Test
+ public void backslashClosingCurlyBrace() {
+ // this is not an escaped closing curly brace
+ String html = parseToHtml("\\}");
+ assertEquals("<p>\\}</p>\n", html);
+ }
+
+ @Test
+ public void backslashOpeningSquareBracket() {
+ // this is not an escaped opening square bracket
+ String html = parseToHtml("\\[");
+ assertEquals("<p>\\[</p>\n", html);
+ }
+
+ @Test
+ public void backslashClosingSquareBracket() {
+ // this is not an escaped closing square bracket
+ String html = parseToHtml("\\]");
+ assertEquals("<p>\\]</p>\n", html);
+ }
+
+ @Test
+ public void backslashOpeningParenthesis() {
+ // this is not an escaped opening parenthesis
+ String html = parseToHtml("\\(");
+ assertEquals("<p>\\(</p>\n", html);
+ }
+
+ @Test
+ public void backslashClosingParenthesis() {
+ // this is not an escaped closing parenthesis
+ String html = parseToHtml("\\)");
+ assertEquals("<p>\\)</p>\n", html);
+ }
+
+ @Test
+ public void backslashHashMark() {
+ // this is not an escaped hash mark
+ String html = parseToHtml("\\#");
+ assertEquals("<p>\\#</p>\n", html);
+ }
+
+ @Test
+ public void backslashMinusSign() {
+ // this is not an escaped minus sign
+ String html = parseToHtml("\\-");
+ assertEquals("<p>\\-</p>\n", html);
+ }
+
+ @Test
+ public void backslashDot() {
+ // this is not an escaped dot
+ String html = parseToHtml("\\.");
+ assertEquals("<p>\\.</p>\n", html);
+ }
+
+ @Test
+ public void backslashExclamationMark() {
+ // this is not an escaped exclamation mark
+ String html = parseToHtml("\\!");
+ assertEquals("<p>\\!</p>\n", html);
+ }
+}
\ No newline at end of file
diff --git a/org.eclipse.mylyn.wikitext.asciidoc.tests/src/org/eclipse/mylyn/internal/wikitext/asciidoc/tests/AsciiDocLanguageSpanElementsTest.java b/org.eclipse.mylyn.wikitext.asciidoc.tests/src/org/eclipse/mylyn/internal/wikitext/asciidoc/tests/AsciiDocLanguageSpanElementsTest.java
new file mode 100644
index 0000000..19e5e19
--- /dev/null
+++ b/org.eclipse.mylyn.wikitext.asciidoc.tests/src/org/eclipse/mylyn/internal/wikitext/asciidoc/tests/AsciiDocLanguageSpanElementsTest.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Max Rydahl Andersen and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Max Rydahl Andersen - copied from markdown to get base for asciidoc
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.wikitext.asciidoc.tests;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+/**
+ * Tests for asciidoc span elements.
+ *
+ * @author Max Rydahl Andersen
+ */
+public class AsciiDocLanguageSpanElementsTest extends AsciiDocLanguageTestBase {
+
+ @Test
+ public void strong() {
+ String html = parseToHtml("*foo bar*");
+ assertEquals("<p><strong>foo bar</strong></p>\n", html);
+ }
+
+ @Test
+ public void strongSourrounded() {
+ String html = parseToHtml("before *foo bar* after");
+ assertEquals("<p>before <strong>foo bar</strong> after</p>\n", html);
+ }
+
+ @Test
+ public void strongNoSpaceSourrounded() {
+ String html = parseToHtml("before*foo bar*after");
+ assertEquals("<p>before<strong>foo bar</strong>after</p>\n", html);
+ }
+
+ @Test
+ public void escapedStrong() {
+ String html = parseToHtml("\\*foo bar*");
+ assertEquals("<p>*foo bar*</p>\n", html);
+ }
+
+ @Test
+ public void emphasis() {
+ String html = parseToHtml("_foo bar_");
+ assertEquals("<p><em>foo bar</em></p>\n", html);
+ }
+
+ @Test
+ public void escapedEmphasis() {
+ String html = parseToHtml("\\_foo bar_");
+ assertEquals("<p>_foo bar_</p>\n", html);
+ }
+
+ @Test
+ public void code() {
+ String html = parseToHtml("+foo bar+");
+ assertEquals("<p><code>foo bar</code></p>\n", html);
+ }
+
+ @Test
+ public void escapedCode() {
+ String html = parseToHtml("\\+foo bar+");
+ assertEquals("<p>+foo bar+</p>\n", html);
+ }
+
+ @Test
+ public void mixed() {
+ String html = parseToHtml("Here *we* _go_ *again*");
+ assertEquals("<p>Here <strong>we</strong> <em>go</em> <strong>again</strong></p>\n", html);
+ }
+
+}
diff --git a/org.eclipse.mylyn.wikitext.asciidoc.tests/src/org/eclipse/mylyn/internal/wikitext/asciidoc/tests/AsciiDocLanguageTest.java b/org.eclipse.mylyn.wikitext.asciidoc.tests/src/org/eclipse/mylyn/internal/wikitext/asciidoc/tests/AsciiDocLanguageTest.java
new file mode 100644
index 0000000..6f76500
--- /dev/null
+++ b/org.eclipse.mylyn.wikitext.asciidoc.tests/src/org/eclipse/mylyn/internal/wikitext/asciidoc/tests/AsciiDocLanguageTest.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Stefan Seelmann and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Stefan Seelmann - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.wikitext.asciidoc.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+/**
+ * @author Stefan Seelmann @author Max Rydahl Andersen
+ */
+public class AsciiDocLanguageTest extends AsciiDocLanguageTestBase {
+
+ @Test
+ public void fullExample() {
+
+ StringBuilder text = new StringBuilder();
+ text.append("Header 2\n");
+ text.append("-------\n");
+ text.append("\n");
+ text.append("Lorem ipsum *dolor* sit amet, \n");
+ text.append("\n");
+ text.append("=== Header 3\n");
+ text.append("\n");
+ text.append("consetetur _adipisici_ elit.\n");
+
+ String html = parseToHtml(text.toString());
+
+ assertEquals(
+ "<h2>Header 2</h2><p>Lorem ipsum <strong>dolor</strong> sit amet, </p>\n" +
+ "<h3>Header 3</h3><p>consetetur <em>adipisici</em> elit.</p>\n"
+ , html); }
+}
diff --git a/org.eclipse.mylyn.wikitext.asciidoc.tests/src/org/eclipse/mylyn/internal/wikitext/asciidoc/tests/AsciidocLanguageTestBase.java b/org.eclipse.mylyn.wikitext.asciidoc.tests/src/org/eclipse/mylyn/internal/wikitext/asciidoc/tests/AsciiDocLanguageTestBase.java
similarity index 86%
rename from org.eclipse.mylyn.wikitext.asciidoc.tests/src/org/eclipse/mylyn/internal/wikitext/asciidoc/tests/AsciidocLanguageTestBase.java
rename to org.eclipse.mylyn.wikitext.asciidoc.tests/src/org/eclipse/mylyn/internal/wikitext/asciidoc/tests/AsciiDocLanguageTestBase.java
index 46da57a..60d2355 100644
--- a/org.eclipse.mylyn.wikitext.asciidoc.tests/src/org/eclipse/mylyn/internal/wikitext/asciidoc/tests/AsciidocLanguageTestBase.java
+++ b/org.eclipse.mylyn.wikitext.asciidoc.tests/src/org/eclipse/mylyn/internal/wikitext/asciidoc/tests/AsciiDocLanguageTestBase.java
@@ -13,9 +13,7 @@
import java.io.StringWriter;
-import junit.framework.TestCase;
-
-import org.eclipse.mylyn.wikitext.asciidoc.core.AsciidocLanguage;
+import org.eclipse.mylyn.wikitext.asciidoc.core.AsciiDocLanguage;
import org.eclipse.mylyn.wikitext.core.parser.MarkupParser;
import org.eclipse.mylyn.wikitext.core.parser.builder.HtmlDocumentBuilder;
import org.junit.Before;
@@ -25,14 +23,14 @@
*
* @author Max Rydahl Andersen
*/
-public abstract class AsciidocLanguageTestBase {
+public abstract class AsciiDocLanguageTestBase {
private MarkupParser parser;
@Before
public void setUp() throws Exception {
- parser = new MarkupParser(new AsciidocLanguage());
+ parser = new MarkupParser(new AsciiDocLanguage());
}
public String parseToHtml(String markup) {
diff --git a/org.eclipse.mylyn.wikitext.asciidoc.tests/src/org/eclipse/mylyn/internal/wikitext/asciidoc/tests/AsciidocLanguageTest.java b/org.eclipse.mylyn.wikitext.asciidoc.tests/src/org/eclipse/mylyn/internal/wikitext/asciidoc/tests/AsciidocLanguageTest.java
deleted file mode 100644
index b4767f0..0000000
--- a/org.eclipse.mylyn.wikitext.asciidoc.tests/src/org/eclipse/mylyn/internal/wikitext/asciidoc/tests/AsciidocLanguageTest.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.eclipse.mylyn.internal.wikitext.asciidoc.tests;
-
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.Test;
-
-public class AsciidocLanguageTest extends AsciidocLanguageTestBase {
-
- @Test
- public void placeholder() {
- assertNotNull("This test method is here since if I don't have it surefire complains there are no tests");
- }
-}
diff --git a/org.eclipse.mylyn.wikitext.asciidoc.ui/plugin.properties b/org.eclipse.mylyn.wikitext.asciidoc.ui/plugin.properties
index 182bfd9..2708875 100644
--- a/org.eclipse.mylyn.wikitext.asciidoc.ui/plugin.properties
+++ b/org.eclipse.mylyn.wikitext.asciidoc.ui/plugin.properties
@@ -10,5 +10,4 @@
###############################################################################
Bundle-Vendor.0 = Eclipse Mylyn
-Bundle-Name.0 = Mylyn WikiText Asciidoc UI
-
+Bundle-Name.0 = Mylyn WikiText AsciiDoc UI
diff --git a/org.eclipse.mylyn.wikitext.markdown.core/src/org/eclipse/mylyn/internal/wikitext/markdown/core/phrase/SimplePhraseModifier.java b/org.eclipse.mylyn.wikitext.markdown.core/src/org/eclipse/mylyn/internal/wikitext/markdown/core/phrase/SimplePhraseModifier.java
index f6da321..8b89cd5 100644
--- a/org.eclipse.mylyn.wikitext.markdown.core/src/org/eclipse/mylyn/internal/wikitext/markdown/core/phrase/SimplePhraseModifier.java
+++ b/org.eclipse.mylyn.wikitext.markdown.core/src/org/eclipse/mylyn/internal/wikitext/markdown/core/phrase/SimplePhraseModifier.java
@@ -26,7 +26,6 @@
public SimplePhraseModifier(String delimiter, SpanType spanType) {
this.delimiter = delimiter;
- // ignore
this.spanType = spanType;
}
diff --git a/org.eclipse.mylyn.wikitext.markdown.tests/src/org/eclipse/mylyn/internal/wikitext/markdown/tests/MarkdownLanguageSpanElementsTest.java b/org.eclipse.mylyn.wikitext.markdown.tests/src/org/eclipse/mylyn/internal/wikitext/markdown/tests/MarkdownLanguageSpanElementsTest.java
index ab5e816..4e579e4 100644
--- a/org.eclipse.mylyn.wikitext.markdown.tests/src/org/eclipse/mylyn/internal/wikitext/markdown/tests/MarkdownLanguageSpanElementsTest.java
+++ b/org.eclipse.mylyn.wikitext.markdown.tests/src/org/eclipse/mylyn/internal/wikitext/markdown/tests/MarkdownLanguageSpanElementsTest.java
@@ -14,14 +14,14 @@
/**
* Tests for Markdown span elements. Follows specification at
* <a>http://daringfireball.net/projects/markdown/syntax#span</a>.
- *
+ *
* @author Stefan Seelmann
*/
public class MarkdownLanguageSpanElementsTest extends MarkdownLanguageTestBase {
/*
- * Links. To create an inline link, use a set of regular parentheses immediately after the link text's
- * closing square bracket. Inside the parentheses, put the URL where you want the link to point, along
+ * Links. To create an inline link, use a set of regular parentheses immediately after the link text's
+ * closing square bracket. Inside the parentheses, put the URL where you want the link to point, along
* with an optional title for the link, surrounded in quotes.
*/
public void testInlineLinkWithTitle() {
@@ -60,7 +60,7 @@
/*
* Reference-style links use a second set of square brackets, inside which you place a label of your choosing to
* identify the link. Then, anywhere in the document, you define your link label like this, on a line by itself.
- * Link definitions are only used for creating links during Markdown processing, and are stripped from your
+ * Link definitions are only used for creating links during Markdown processing, and are stripped from your
* document in the HTML output.
* Note: Reference parsing is tested in LinkReferencesTest.
*/
@@ -104,7 +104,7 @@
}
/*
- * The implicit link name shortcut allows you to omit the name of the link, in which case the link text itself
+ * The implicit link name shortcut allows you to omit the name of the link, in which case the link text itself
* is used as the name. Just use an empty set of square brackets.
*/
public void testReferenceStyleLinkWithoutName() {