Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.mylyn.wikitext.markdown.core/src/org/eclipse/mylyn/internal/wikitext/markdown/core/block/LinkDefinitionBlock.java')
-rw-r--r--org.eclipse.mylyn.wikitext.markdown.core/src/org/eclipse/mylyn/internal/wikitext/markdown/core/block/LinkDefinitionBlock.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.wikitext.markdown.core/src/org/eclipse/mylyn/internal/wikitext/markdown/core/block/LinkDefinitionBlock.java b/org.eclipse.mylyn.wikitext.markdown.core/src/org/eclipse/mylyn/internal/wikitext/markdown/core/block/LinkDefinitionBlock.java
new file mode 100644
index 000000000..61e5dffc3
--- /dev/null
+++ b/org.eclipse.mylyn.wikitext.markdown.core/src/org/eclipse/mylyn/internal/wikitext/markdown/core/block/LinkDefinitionBlock.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.markdown.core.block;
+
+import org.eclipse.mylyn.internal.wikitext.markdown.core.LinkDefinitionParser;
+
+/**
+ * Markdown link/image definitions. Does not emit anything.
+ *
+ * @author Stefan Seelmann
+ */
+public class LinkDefinitionBlock extends NestableBlock {
+
+ @Override
+ public boolean canStart(String line, int lineOffset) {
+ return LinkDefinitionParser.LINK_DEFINITION_PATTERN.matcher(line.substring(lineOffset)).matches();
+ }
+
+ @Override
+ protected int processLineContent(String line, int offset) {
+ if (markupLanguage.isEmptyLine(line.substring(offset))) {
+ setClosed(true);
+ return offset;
+ }
+
+ return -1;
+ }
+
+}

Back to the top