Преглед на файлове

YSCT 2145: Generating documentation with YAKINDU Docs now (#2146)

Rainer Klute преди 7 години
родител
ревизия
7439995f24

+ 14 - 21
plugins/org.yakindu.sct.doc.user/build.xml

@@ -49,9 +49,6 @@
     <!-- MyLyn Wikitext version: -->
     <property name="wikitext.version" value="3.0.20" />
 
-    <!-- Compiled Java classes go here: -->
-    <property name="bin.dir" value="bin" />
-
 
 
     <!-- Remove generated stuff. The "lib" directory will not be deleted. Remove it manually, if you have to. -->
@@ -64,7 +61,6 @@
                 <include name="${epub.dir}/**" />
             </fileset>
             <fileset dir="${src-merged.dir}" />
-            <fileset dir="${bin.dir}" />
         </delete>
     </target>
 
@@ -170,6 +166,17 @@
             <path refid="wikitext.ant.classpath" />
         </path>
 
+        <!-- Classpath for YAKINDU Docs: -->
+        <artifact:resolve>
+            <artifact:dependencies>
+                <dependency groupId="org.yakindu.docs"
+                            artifactId="yakindu-docs-maven-plugin"
+                            version="0.0.1-SNAPSHOT"
+                            scope="compile" />
+            </artifact:dependencies>
+            <path refid="org.yakindu.docs.classpath" />
+        </artifact:resolve>
+
     </target>
 
 
@@ -352,23 +359,9 @@
              images/…
     -->
 
-    <target name="compile.wikitext.converter"
-            description="Compiles the Wikitext converter that turns Textile into our Hubspot HTML"
-            depends="init.wikitext">
-        <mkdir dir="${bin.dir}" />
-        <javac srcdir="${src.dir}/main/java"
-               destdir="${bin.dir}"
-               classpathref="wikitext.all.classpath"
-               debug="true"
-               fork="true"
-               optimize="false"
-               includeantruntime="false">
-        </javac>
-    </target>
-
     <target name="generate.website"
             description="Generates the documentation as various HTML files for the website, each being composed of selected sections. Use -Dwebsite.local.files=true to generate the website as local files for preview."
-            depends="init.wikitext, compile.wikitext.converter">
+            depends="init.wikitext">
 
         <sequential>
             <taskdef classpathref="wikitext.all.classpath" resource="org/eclipse/mylyn/wikitext/ant/tasks.properties" />
@@ -457,10 +450,10 @@
 
             <!-- Convert textile source files to Hubspot HTML: -->
             <path id="converter.classpath">
-                <pathelement location="${bin.dir}" />
+                <path refid="org.yakindu.docs.classpath" />
                 <path refid="wikitext.all.classpath" />
             </path>
-            <java classname="org.yakindu.sct.doc.user.wikitext.TextileToHubspotConverter"
+            <java classname="org.yakindu.docs.wikitext.TextileToHubspotConverter"
                   classpathref="converter.classpath"
                   fork="true"
                   dir="${basedir}"

+ 22 - 2
plugins/org.yakindu.sct.doc.user/pom.xml

@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
 	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 	<modelVersion>4.0.0</modelVersion>
 	<parent>
@@ -50,7 +49,28 @@
 						</goals>
 					</execution>
 				</executions>
+				<dependencies>
+					<dependency>
+						<groupId>org.yakindu.docs</groupId>
+						<artifactId>yakindu-docs-maven-plugin</artifactId>
+						<version>0.0.1-SNAPSHOT</version>
+					</dependency>
+				</dependencies>
 			</plugin>
 		</plugins>
 	</build>
+
+	<pluginRepositories>
+		<pluginRepository>
+			<id>releases</id>
+			<name>Nexus projects.itemis.de</name>
+			<url>https://projects.itemis.de/nexus/content/repositories/OSR/</url>
+		</pluginRepository>
+		<pluginRepository>
+			<id>snapshots</id>
+			<name>Nexus projects.itemis.de</name>
+			<url>https://projects.itemis.de/nexus/content/repositories/OSS/</url>
+		</pluginRepository>
+	</pluginRepositories>
+
 </project>

+ 0 - 108
plugins/org.yakindu.sct.doc.user/src/main/java/org/yakindu/sct/doc/user/wikitext/Heading.java

@@ -1,108 +0,0 @@
-package org.yakindu.sct.doc.user.wikitext;
-
-/**
- * <p>
- * Represents a heading in a Wikitext document. Its attributes are as follows:
- * </p>
- * 
- * <dl>
- * <dt><em>resource</em></dt>
- * <dd>
- * <p>
- * The resource the heading is in, typically a filename
- * </p>
- * </dd>
- * <dt><em>level</em></dt>
- * <dd>
- * <p>
- * The heading's level, typically in the range 1 – 6
- * </p>
- * </dd>
- * <dt><em>id</em></dt>
- * <dd>
- * <p>
- * The heading's ID, if it has one
- * </p>
- * </dd>
- * <dt><em>title</em></dt>
- * <dd>
- * <p>
- * The heading's title text
- * </p>
- * </dd>
- * </dl>
- * 
- * @author Rainer Klute,
- *         <a href="mailto:rainer.klute@itemis.de">rainer.klute@itemise.de</a>,
- *         2017-08-28
- */
-public class Heading {
-
-    private String resource;
-    private int level;
-    private String id;
-    private StringBuilder title;
-
-    public Heading(final String resource, final int level, final String id) {
-        this.resource = resource;
-        this.level = level;
-        this.id = id;
-    }
-
-    public Heading(final String resource, final int level, final String id, final String title) {
-        this(resource, level, id);
-        this.title = new StringBuilder(title);
-    }
-
-    public String getResource() {
-        return resource;
-    }
-
-    public void setResource(final String resource) {
-        this.resource = resource;
-    }
-
-    public int getLevel() {
-        return level;
-    }
-
-    public void setLevel(final int level) {
-        this.level = level;
-    }
-
-    public String getId() {
-        return id;
-    }
-
-    public void setId(final String id) {
-        this.id = id;
-    }
-
-    public String getTitle() {
-        return title != null ? title.toString() : null;
-    }
-
-    public void setTitle(final String title) {
-        this.title = new StringBuilder(title);
-    }
-
-    public void appendToTitle(final String text) {
-        this.title.append(text);
-    }
-
-    @Override
-    public String toString() {
-        final StringBuilder b = new StringBuilder();
-        b.append("Heading[level=");
-        b.append(level);
-        b.append(", id=");
-        b.append(id);
-        b.append(", text=");
-        b.append(title);
-        b.append(", resource=");
-        b.append(resource);
-        b.append("]");
-        return b.toString();
-    }
-
-}

+ 0 - 681
plugins/org.yakindu.sct.doc.user/src/main/java/org/yakindu/sct/doc/user/wikitext/HubspotDocumentBuilder.java

@@ -1,681 +0,0 @@
-package org.yakindu.sct.doc.user.wikitext;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.Reader;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
-import org.eclipse.mylyn.wikitext.parser.Attributes;
-import org.eclipse.mylyn.wikitext.parser.LinkAttributes;
-import org.eclipse.mylyn.wikitext.parser.builder.HtmlDocumentBuilder;
-import org.eclipse.mylyn.wikitext.util.XmlStreamWriter;
-
-/**
- * <p>
- * This document builder creates a Hubspot document with a table of contents. It
- * extends MyLyn Wikitext's {@link HtmlDocumentBuilder} class. The resulting
- * document consists of the following compartments:
- * </p>
- * 
- * <ol>
- * <li>
- * <p>
- * The <em>p1</em> compartment is a piece of text that is read from the
- * <em>p1</em> reader and copied unmodified to the output document.
- * </p>
- * </li>
- * <li>
- * <p>
- * The <em>table of contents</em> compartment contains the document's table of
- * contents. Each H1 entry and its subordinated H2 entries will be rendered
- * using a "template". That template is a piece of text – usually consting of
- * Hubspot instructions – that is read from the <em>tocTemplate</em> reader.
- * Placeholders like <code>${h1.id}</code> or <code>${h1.title}</code> will be
- * replaced by the current H1 heading's ID and title, respectively.
- * <code>${h2.toc}</code> will be replaced by the subordinated headings,
- * currently H2 entries only. These entries are generated purely
- * programmatically.
- * </p>
- * </li>
- * <li>
- * <p>
- * The <em>p2</em> compartment is a piece of text that is read from the
- * <em>p2</em> reader and copied unmodified to the output document.
- * </p>
- * </li>
- * <li>
- * <p>
- * The <em>contents</em> compartment contains the actual document contents. Each
- * H1 chapter will be rendered using a "template". That template is a piece of
- * text – usually consisting of Hubspot instructions – that is read from the
- * <em>contentsTemplate</em> reader. Placeholders like <code>${h1.id}</code>,
- * <code>${h1.title}</code>, or <code>${h1.contents}</code> will be replaced by
- * the current H1 heading's ID, title, and the contents of that section,
- * respectively.
- * </p>
- * </li>
- * <li>
- * <p>
- * The <em>p3</em> compartment is a piece of text that is read from the
- * <em>p3</em> reader and and copied unmodified to the output document.
- * </p>
- * </li>
- * </ol>
- * 
- * <p>
- * H1 headlines are used to separate sections. However, sometimes certain text
- * elements preceed the H1 that must go into the same section, for instance if
- * the H1 and subsequent elements are encapsulated in a DIV element. In this
- * case, you can place an "early separator" before the DIV's start tag. The
- * early separator is a pseudo H1 headline with a very special CSS class. It
- * looks like this:
- * </p>
- * 
- * <pre>
- * h1{%EARLY_SEPARATOR%}. Some text
- * </pre>
- * 
- * @author Rainer Klute,
- *         <a href="mailto:rainer.klute@itemis.de">rainer.klute@itemise.de</a>,
- *         2017-08-28
- */
-public class HubspotDocumentBuilder extends HtmlDocumentBuilder {
-
-	final String p1;
-	final String p2;
-	final String p3;
-	final String[] contentsTemplate;
-	final String[] tocTemplate;
-	boolean isFirstH1 = true;
-	final List<Heading> headings = new ArrayList<Heading>();
-
-	private PrintWriter w;
-	private String resource = "";
-	private boolean isProcessingHeading = false;
-	private boolean isEarlySeparator = false;
-	private boolean isFollowingEarlySeparator = false;
-	private Heading currentHeading;
-
-	/*
-	 * Used to collect stuff between an early separator and the next H1 heading:
-	 */
-	private HtmlDocumentBuilder h2 = null;
-	private StringWriter s2 = null;
-	private PrintWriter w2 = null;
-	private List<Heading> pass1Headings;
-
-	/**
-	 * <p>
-	 * Sets the currently processed resource, e.g. a filename.
-	 * </p>
-	 * 
-	 * @param resource
-	 *            the resource
-	 */
-	public void setResource(final String resource) {
-		this.resource = resource;
-	}
-
-	/**
-	 * <p>
-	 * Constructor. Reads all the required static files and template files.
-	 * </p>
-	 * 
-	 * @param properties
-	 * 
-	 * @param pass1Headings
-	 */
-	public HubspotDocumentBuilder(final Reader p1Reader, final Reader contentsTemplateReader, final Reader p2Reader,
-			final Reader tocTemplateReader, final Reader p3Reader, final Map<String, String> properties,
-			final List<Heading> pass1Headings, final Writer writer) {
-		super(writer, true);
-		this.pass1Headings = pass1Headings;
-		try {
-			this.p1 = resolveProperties(readContents(p1Reader, false), properties);
-			this.p2 = resolveProperties(readContents(p2Reader, false), properties);
-			this.p3 = resolveProperties(readContents(p3Reader, false), properties);
-		} catch (IOException e) {
-			throw new RuntimeException("Reading one the p files failed.", e);
-		}
-		try {
-			this.contentsTemplate = splitContentsTemplate(contentsTemplateReader);
-		} catch (IOException e) {
-			throw new RuntimeException("Reading the contents template failed.", e);
-		}
-		try {
-			this.tocTemplate = splitTocTemplate(tocTemplateReader);
-		} catch (IOException e) {
-			throw new RuntimeException("Reading the TOC template failed.", e);
-		}
-		if (writer instanceof PrintWriter)
-			w = (PrintWriter) writer;
-		else
-			w = new PrintWriter(writer);
-	}
-
-	/**
-	 * <p>
-	 * Replaces all occurrences of the <var>properties</var> map's "key" entries
-	 * in a string by the corresponding "value" entries. Replacement starts at
-	 * the beginning of the string and proceeds to the end. However, the
-	 * processing order of the properties is undefined.
-	 * </p>
-	 * 
-	 * @param s
-	 *            the string to do the replacements in
-	 * @param properties
-	 *            the properties map
-	 * @return the resulting string with all replacements done
-	 */
-	private String resolveProperties(final String s, final Map<String, String> properties) {
-		String result = s;
-		for (final String key : properties.keySet()) {
-			result = result.replace(key, properties.get(key));
-		}
-		return result;
-	}
-
-	/**
-	 * <p>
-	 * When the beginning of the document is encountered the P1 part is written
-	 * to the output.
-	 * </p>
-	 */
-	@Override
-	public void beginDocument() {
-		/* Copy the P1 string to the output: */
-		w.print(p1);
-
-		/*
-		 * Create the table of contents. Each H1 heading and its subordinate
-		 * headings are encapsulated in the TOC template.
-		 */
-
-		Heading h1Heading = null;
-		for (final Heading h : pass1Headings) {
-			if (h.getLevel() == 1) {
-				if (h1Heading != null)
-					/*
-					 * Close the previously opened H1 encapsulation, unless we
-					 * are processing the very first H1:
-					 */
-					w.println(resolveHeadingIdAndTitle(tocTemplate[1], 1, h1Heading.getId(), h1Heading.getTitle()));
-				/* Open the H1 encapsulation for the current H1 heading: */
-				w.println(resolveHeadingIdAndTitle(tocTemplate[0], 1, h.getId(), h.getTitle()));
-				h1Heading = h;
-			} else if (h.getLevel() == 2)
-				/* H2 headings are rendered within an H1 encapsulation: */
-				w.println(resolveHeadingIdAndTitle("<li><a href=\"#${h2.id}\">${h2.title}</a></li>", 2, h.getId(),
-						h.getTitle()));
-		}
-		/*
-		 * Close the last H1 encapsulation:
-		 */
-		w.println(resolveHeadingIdAndTitle(tocTemplate[1], 1, h1Heading.getId(), h1Heading.getTitle()));
-
-		/* Copy the P2 string to the output: */
-		w.print(p2);
-
-		/*
-		 * We don't call the superclass' beginDocument() method here, because
-		 * the beginning part of the resulting document should be provided by
-		 * the P1 part.
-		 */
-	}
-
-	/**
-	 * <p>
-	 * At the end of the document, any open H1 Hubspot encapsulation is closed.
-	 * Then the P2 part is written to the output, followed by the table of
-	 * contents, followed by the P3 part.
-	 * </p>
-	 */
-	@Override
-	public void endDocument() {
-
-		/* Close the current H1 encapsulation, if any: */
-		Heading h1Heading = lookupLastH1Heading(pass1Headings);
-		w.print(resolveHeadingIdAndTitle(contentsTemplate[1], 1, h1Heading.getId(), h1Heading.getTitle()));
-
-		/* Copy the P3 string to the output: */
-		w.print(p3);
-
-		/*
-		 * We don't call the superclass' endDocument() method here, because the
-		 * finnishing part of the resulting document should have been provided
-		 * by the P3 part.
-		 */
-
-		w.close();
-	}
-
-	@Override
-	public void beginBlock(final BlockType type, final Attributes attributes) {
-		if (isEarlySeparator)
-			h2.beginBlock(type, attributes);
-		else
-			super.beginBlock(type, attributes);
-	}
-
-	@Override
-	public void endBlock() {
-		if (isEarlySeparator)
-			h2.endBlock();
-		else
-			super.endBlock();
-	}
-
-	@Override
-	public void beginSpan(final SpanType type, final Attributes attributes) {
-		if (isEarlySeparator) {
-			if (!isProcessingHeading)
-				h2.beginSpan(type, attributes);
-		} else {
-			if (SpanType.LINK == type && attributes instanceof LinkAttributes) {
-				final LinkAttributes linkAttributes = (LinkAttributes) attributes;
-				final String hrefOrHashName = linkAttributes.getHref();
-
-				if (hrefOrHashName.startsWith("http")) {
-					/*
-					 * An external link should be opened in a new tab or window
-					 * and thus gets the target="_blank" attribute attached.
-					 */
-					linkAttributes.setTarget("_blank");
-				} else if (hrefOrHashName.startsWith("../")) {
-					/*
-					 * Links pointing into the parent directory are referring
-					 * another section of our documentation are require some
-					 * special handling in order to comply with the Hubspot
-					 * template.
-					 */
-					boolean hasHash = false;
-					boolean hasFragment = false;
-					boolean hasFilename = false;
-					final String fragmentID;
-
-					// Get the fragment ID:
-					int fragmentPosition = hrefOrHashName.lastIndexOf('#');
-					if (fragmentPosition >= 0) {
-						hasHash = true;
-						if (fragmentPosition + 1 < hrefOrHashName.length())
-							hasFragment = true;
-						fragmentPosition++;
-					} else
-						fragmentPosition = hrefOrHashName.length();
-					fragmentID = hrefOrHashName.substring(fragmentPosition);
-
-					// Strip the last component (filename) from the URL, if any:
-					final StringBuilder b = new StringBuilder();
-					int filenamePosition = hrefOrHashName.lastIndexOf('/', fragmentPosition - 1);
-					hasFilename = filenamePosition >= 2 && filenamePosition + 2 <= fragmentPosition;
-					if (hasFilename)
-						b.append(hrefOrHashName.substring(0, filenamePosition));
-					else
-						b.append(hrefOrHashName.substring(0, fragmentPosition - (hasHash ? 1 : 0)));
-
-					if (hasFilename)
-						b.append('/');
-					if (hasFragment) {
-						// Find the fragment's H1 heading:
-						final Heading h1Heading = lookupH1HeadingOf(pass1Headings, fragmentID);
-
-						// Append H1 heading's ID to the URL:
-						if (h1Heading != null)
-							b.append(h1Heading.getId());
-						else
-							System.err.println("WARNING: H1 heading for fragment #" + fragmentID + " not found.");
-
-						// Append fragment ID.
-						b.append('#');
-						b.append(fragmentID);
-					} else if (hasHash)
-						b.append('#');
-
-					linkAttributes.setHref(b.toString());
-				}
-			}
-			super.beginSpan(type, attributes);
-		}
-	}
-
-	@Override
-	public void endSpan() {
-		if (isEarlySeparator) {
-			if (!isProcessingHeading)
-				h2.endSpan();
-		} else
-			super.endSpan();
-	}
-
-	/**
-	 * <p>
-	 * The begin of a heading has been encountered. If it is an H1 heading, we
-	 * have to write the first part of the contents template into the stream.
-	 * Placeholders <em>${h1.id}</em> and <em>${h1.title}</em> have to be
-	 * replaced by actual values.
-	 * </p>
-	 * <p>
-	 * <strong>Please note:</strong> At this point the title text is not yet
-	 * known! This is only the case at {@link #endHeading()}.
-	 * </p>
-	 */
-	@Override
-	public void beginHeading(final int level, final Attributes attributes) {
-		isProcessingHeading = true;
-		final String id = attributes.getId();
-		if (!isEarlySeparator) {
-			isFollowingEarlySeparator = isEarlySeparator;
-			isEarlySeparator = level == 1 && "%EARLY_SEPARATOR%".equals(attributes.getCssStyle());
-		} else {
-			isFollowingEarlySeparator = isEarlySeparator;
-			isEarlySeparator = false;
-		}
-		if (isEarlySeparator) {
-			/*
-			 * Collect everything between the early separator and the next H1 in
-			 * another writer.
-			 */
-			s2 = new StringWriter();
-			w2 = new PrintWriter(s2);
-			h2 = new HtmlDocumentBuilder(w2);
-		} else
-			currentHeading = new Heading(resource, level, id);
-
-		if (level == 1) {
-			if (!isFirstH1 && !isFollowingEarlySeparator)
-				w.print(resolveHeadingIdAndTitle(contentsTemplate[1], 1, id, null));
-			else
-				isFirstH1 = false;
-
-			if (!isEarlySeparator) {
-				w.println(resolveHeadingIdAndTitle(contentsTemplate[0], 1, id, null));
-				if (isFollowingEarlySeparator) {
-					w2.close();
-					w.println(s2.toString());
-					h2 = null;
-					w2 = null;
-				}
-				super.beginHeading(level, attributes);
-			}
-		} else
-			super.beginHeading(level, attributes);
-	}
-
-	@Override
-	public void endHeading() {
-		if (!isEarlySeparator) {
-			headings.add(currentHeading);
-			isProcessingHeading = false;
-
-			/* Write the permalink: */
-			final XmlStreamWriter w = super.getWriter();
-			w.writeStartElement("a");
-			w.writeAttribute("href", '#' + currentHeading.getId());
-			w.writeAttribute("class", "permalink");
-			w.writeAttribute("title", "Permalink to \"" + currentHeading.getTitle() + "\"");
-			w.writeAttribute("onclick", "copyPermalinkToClipboard(event, this);");
-			w.writeStartElement("span");
-			w.writeAttribute("class", "tooltip");
-			w.writeCharacters("Copy link to clipboard");
-			w.writeEndElement(); // span
-			w.writeEndElement(); // a
-
-			super.endHeading();
-		}
-	}
-
-	@Override
-	public void characters(final String text) {
-		if (isEarlySeparator) {
-			if (!isProcessingHeading)
-				h2.characters(text);
-		} else if (isProcessingHeading) {
-			if (currentHeading.getTitle() == null)
-				currentHeading.setTitle(text);
-			else
-				currentHeading.appendToTitle(text);
-			super.characters(text);
-		} else
-			super.characters(text);
-	}
-
-	@Override
-	public void entityReference(final String entity) {
-		if (isEarlySeparator)
-			h2.entityReference(entity);
-		else
-			super.entityReference(entity);
-	}
-
-	@Override
-	public void image(final Attributes attributes, final String url) {
-		if (isEarlySeparator)
-			h2.image(attributes, url);
-		else
-			super.image(attributes, url);
-	}
-
-	@Override
-	public void link(final Attributes attributes, final String hrefOrHashName, final String text) {
-		if (isEarlySeparator)
-			h2.link(attributes, hrefOrHashName, text);
-		else
-			super.link(attributes, hrefOrHashName, text);
-	}
-
-	@Override
-	public void imageLink(final Attributes linkAttributes, final Attributes imageAttributes, final String href,
-			final String imageUrl) {
-		if (isEarlySeparator)
-			h2.imageLink(linkAttributes, imageAttributes, href, imageUrl);
-		else
-			super.imageLink(linkAttributes, imageAttributes, href, imageUrl);
-	}
-
-	@Override
-	public void acronym(final String text, final String definition) {
-		if (isEarlySeparator)
-			h2.acronym(text, definition);
-		else
-			super.acronym(text, definition);
-	}
-
-	@Override
-	public void lineBreak() {
-		if (isEarlySeparator)
-			h2.lineBreak();
-		else
-			super.lineBreak();
-	}
-
-	@Override
-	public void charactersUnescaped(final String literal) {
-		if (isEarlySeparator)
-			h2.charactersUnescaped(literal);
-		else
-			super.charactersUnescaped(literal);
-	}
-
-	/**
-	 * <p>
-	 * Replaces the placeholders like <code>${h1.id}</code> and
-	 * <code>${h1.title}</code> by actual values, if available. If an actual
-	 * value is <code>null</code>, no replacement will be done. The level
-	 * number, i.e. the "1" in <code>${h1.id}</code> and
-	 * <code>${h1.title}</code> must be supplied as a parameter.
-	 * </p>
-	 * 
-	 * @param s
-	 *            The string containing the placeholders
-	 * @param level
-	 *            The level number of the heading
-	 * @param id
-	 *            The ID of the heading
-	 * @param title
-	 *            The title of the heading
-	 * @return The result string
-	 */
-	private String resolveHeadingIdAndTitle(final String s, final int level, final String id, final String title) {
-		String result = s;
-		final String re = "\\$\\{h" + level + "\\.";
-		if (id != null)
-			result = result.replaceAll(re + "id}", id);
-		if (title != null)
-			result = result.replaceAll(re + "title}", title);
-		return result;
-	}
-	/**
-	 * <p>
-	 * Splits the contents template into two parts: everything <em>before</em>
-	 * <code>${h1.contents}</code> and everything <em>after</em> that string.
-	 * 
-	 * @param contentsTemplateReader
-	 *            reader containing the contents template
-	 * @return a string array with two fields representing the two parts.
-	 * @throws IOException
-	 *             if reading from the contents template reader fails
-	 */
-	private String[] splitContentsTemplate(final Reader contentsTemplateReader) throws IOException {
-		return split(contentsTemplateReader, "${h1.contents}");
-	}
-
-	/**
-	 * <p>
-	 * Splits the TOC template into two parts: everything <em>before</em>
-	 * <code>${h2.toc}</code> and everything <em>after</em> that string.
-	 * 
-	 * @param tocTemplateReader
-	 *            reader containing the TOC template
-	 * @return a string array with two fields representing the two parts.
-	 * @throws IOException
-	 *             if reading from the contents template reader fails
-	 */
-	private String[] splitTocTemplate(final Reader tocTemplateReader) throws IOException {
-		return split(tocTemplateReader, "${h2.toc}");
-	}
-
-	/**
-	 * <p>
-	 * Splits the string read from a {@link Reader} into two parts: everything
-	 * <em>before</em> a separator and everything <em>after</em> it.
-	 * 
-	 * @param reader
-	 *            reader to read the string from
-	 * @return a string array with two fields representing the two parts.
-	 * @throws IOException
-	 *             if reading from the reader fails
-	 */
-	private String[] split(final Reader reader, final String separator) throws IOException {
-		final String s = readContents(reader, false);
-		final String[] result = new String[2];
-		final int beginPart1 = 0;
-		final int endPart1 = s.indexOf(separator);
-		final int beginPart2 = endPart1 + separator.length();
-		final int endPart2 = s.length();
-		if (endPart1 < 0) {
-			result[0] = s;
-			result[1] = "";
-		} else if (endPart1 == 0) {
-			result[0] = "";
-			result[1] = s;
-		} else if (endPart1 > 0) {
-			result[0] = s.substring(beginPart1, endPart1);
-			result[1] = s.substring(beginPart2, endPart2);
-		}
-		return result;
-	}
-
-	/**
-	 * <p>
-	 * Looks up the last H1 heading in a list of headings.
-	 * </p>
-	 * 
-	 * @param headings
-	 *            The list of heading to search
-	 * @return The last H1 heading in the list of headings or <code>null</code>.
-	 */
-	private Heading lookupLastH1Heading(final List<Heading> headings) {
-		final ListIterator<Heading> i = headings.listIterator(headings.size());
-		Heading result = null;
-		while (result == null && i.hasPrevious()) {
-			final Heading h = i.previous();
-			if (h.getLevel() == 1)
-				result = h;
-		}
-		return result;
-	}
-
-	/**
-	 * <p>
-	 * Looks up the H1 heading of a specified subheading. The method first looks
-	 * up the subheading in the list of headings and then walks back the list
-	 * until it finds the next H1. If it turns out that the subheading is a H1
-	 * heading itself, that heading will be returned.
-	 * </p>
-	 * 
-	 * @param headings
-	 *            The list of heading to search
-	 * @param subheading
-	 *            The subheading
-	 * @return The subheading's associated H1 heading in the list of headings or
-	 *         <code>null</code> if either one or the other cannot be found.
-	 */
-	private Heading lookupH1HeadingOf(final List<Heading> headings, final String subheadingID) {
-		final ListIterator<Heading> i = headings.listIterator(headings.size());
-
-		// Look up the subheading:
-		Heading subheading = null;
-		while (subheading == null && i.hasPrevious()) {
-			final Heading h = i.previous();
-			if (subheadingID.equals(h.getId()))
-				subheading = h;
-		}
-		if (subheading == null)
-			return null;
-		if (subheading.getLevel() == 1)
-			return subheading;
-
-		// Look up the H1 heading:
-		Heading h1Heading = null;
-		while (h1Heading == null && i.hasPrevious()) {
-			final Heading h = i.previous();
-			if (h.getLevel() == 1)
-				h1Heading = h;
-		}
-		return h1Heading;
-	}
-
-	/**
-	 * <p>
-	 * Reads the complete contents of a {@link Reader} and returns it as a
-	 * string.
-	 * </p>
-	 * 
-	 * @param reader
-	 *            The {@link Reader} to read from
-	 * @param isRobustReading
-	 *            If <code>true</code>, failing to read from the {@link Reader}
-	 *            or a {@link Reader} of <code>null</code> won't result in an
-	 *            error. Instead an empty string will be returned.
-	 * @return see above
-	 * @throws IOException
-	 */
-	private String readContents(final Reader reader, final boolean isRobustReading) throws IOException {
-		final char[] buffer = new char[5000];
-		final StringBuilder result = new StringBuilder();
-		int read = 0;
-		while (read >= 0) {
-			read = reader.read(buffer, 0, buffer.length);
-			if (read > 0)
-				result.append(buffer, 0, read);
-		}
-		reader.close();
-		return result.toString();
-	}
-
-}

+ 0 - 212
plugins/org.yakindu.sct.doc.user/src/main/java/org/yakindu/sct/doc/user/wikitext/SequenceReader.java

@@ -1,212 +0,0 @@
-package org.yakindu.sct.doc.user.wikitext;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.io.SequenceInputStream;
-import java.util.Enumeration;
-import java.util.Vector;
-
-/**
- * <p>
- * This class behaves like the standard {@link SequenceInputStream}, but for
- * {@link Reader}s. In fact its source code has been copied from
- * {@link SequenceInputStream} and then has been modified in order to cope with
- * the differences between {@link InputStream} and {@link Reader}.
- * 
- * @author Rainer Klute,
- *         <a href="mailto:rainer.klute@itemis.de">rainer.klute@itemise.de</a>,
- *         2017-08-28
- */
-public class SequenceReader extends Reader {
-    Enumeration<? extends Reader> e;
-    Reader in;
-
-    /**
-     * Initializes a newly created <code>SequenceReader</code> by remembering
-     * the argument, which must be an <code>Enumeration</code> that produces
-     * objects whose run-time type is <code>Reader</code>. The readers that are
-     * produced by the enumeration will be read, in order, to provide the
-     * characters to be read from this <code>SequenceReader</code>. After each
-     * reader from the enumeration is exhausted, it is closed by calling its
-     * <code>close</code> method.
-     *
-     * @param e
-     *            an enumeration of readers.
-     * @see java.util.Enumeration
-     */
-    public SequenceReader(Enumeration<? extends Reader> e) {
-        this.e = e;
-        try {
-            nextReader();
-        } catch (IOException ex) {
-            // This should never happen
-            throw new Error("panic");
-        }
-    }
-
-    /**
-     * Initializes a newly created <code>SequenceReader</code> by remembering
-     * the two arguments, which will be read in order, first <code>s1</code> and
-     * then <code>s2</code>, to provide the characters to be read from this
-     * <code>SequenceReader</code>.
-     *
-     * @param s1
-     *            the first reader to read.
-     * @param s2
-     *            the second reader to read.
-     */
-    public SequenceReader(Reader s1, Reader s2) {
-        Vector<Reader> v = new Vector<>(2);
-
-        v.addElement(s1);
-        v.addElement(s2);
-        e = v.elements();
-        try {
-            nextReader();
-        } catch (IOException ex) {
-            // This should never happen
-            throw new Error("panic");
-        }
-    }
-
-    /**
-     * Continues reading in the next reader if an EOF is reached.
-     */
-    final void nextReader() throws IOException {
-        if (in != null) {
-            in.close();
-        }
-
-        if (e.hasMoreElements()) {
-            in = (Reader) e.nextElement();
-            if (in == null)
-                throw new NullPointerException();
-        } else
-            in = null;
-
-    }
-
-    /**
-     * Returns an estimate of the number of characters that can be read (or
-     * skipped over) from the current underlying reader without blocking by the
-     * next invocation of a method for the current underlying reader. The next
-     * invocation might be the same thread or another thread. A single read or
-     * skip of this many characters will not block, but may read or skip fewer
-     * characters.
-     * <p>
-     * This method simply calls {@code available} of the current underlying
-     * reader and returns the result.
-     *
-     * @return an estimate of the number of characters that can be read (or
-     *         skipped over) from the current underlying reader without blocking
-     *         or {@code 0} if this reader has been closed by invoking its
-     *         {@link #close()} method
-     * @exception IOException
-     *                if an I/O error occurs.
-     *
-     * @since JDK1.1
-     */
-    // public int available() throws IOException {
-    // if (in == null) {
-    // return 0; // no way to signal EOF from available()
-    // }
-    // return in.available();
-    // }
-
-    /**
-     * Reads the next character of data from this reader. The character is
-     * returned as an <code>int</code> in the range <code>0</code> to
-     * <code>255</code>. If no character is available because the end of the
-     * reader has been reached, the value <code>-1</code> is returned. This
-     * method blocks until input data is available, the end of the reader is
-     * detected, or an exception is thrown.
-     * <p>
-     * This method tries to read one character from the current subreader. If it
-     * reaches the end of the reader, it calls the <code>close</code> method of
-     * the current subreader and begins reading from the next subreader.
-     *
-     * @return the next character of data, or <code>-1</code> if the end of the
-     *         reader is reached.
-     * @exception IOException
-     *                if an I/O error occurs.
-     */
-    public int read() throws IOException {
-        while (in != null) {
-            int c = in.read();
-            if (c != -1) {
-                return c;
-            }
-            nextReader();
-        }
-        return -1;
-    }
-
-    /**
-     * Reads up to <code>len</code> characters of data from this reader into an
-     * array of characters. If <code>len</code> is not zero, the method blocks
-     * until at least 1 character of input is available; otherwise, no
-     * characters are read and <code>0</code> is returned.
-     * <p>
-     * The <code>read</code> method of <code>SequenceReader</code> tries to read
-     * the data from the current subreader. If it fails to read any characters
-     * because the subreader has reached the end of the reader, it calls the
-     * <code>close</code> method of the current subreader and begins reading
-     * from the next subreader.
-     *
-     * @param b
-     *            the buffer into which the data is read.
-     * @param off
-     *            the start offset in array <code>b</code> at which the data is
-     *            written.
-     * @param len
-     *            the maximum number of characters read.
-     * @return int the number of characters read.
-     * @exception NullPointerException
-     *                If <code>b</code> is <code>null</code>.
-     * @exception IndexOutOfBoundsException
-     *                If <code>off</code> is negative, <code>len</code> is
-     *                negative, or <code>len</code> is greater than
-     *                <code>b.length - off</code>
-     * @exception IOException
-     *                if an I/O error occurs.
-     */
-    public int read(char b[], int off, int len) throws IOException {
-        if (in == null) {
-            return -1;
-        } else if (b == null) {
-            throw new NullPointerException();
-        } else if (off < 0 || len < 0 || len > b.length - off) {
-            throw new IndexOutOfBoundsException();
-        } else if (len == 0) {
-            return 0;
-        }
-        do {
-            int n = in.read(b, off, len);
-            if (n > 0) {
-                return n;
-            }
-            nextReader();
-        } while (in != null);
-        return -1;
-    }
-
-    /**
-     * Closes this reader and releases any system resources associated with it.
-     * A closed <code>SequenceReader</code> cannot perform input operations and
-     * cannot be reopened.
-     * <p>
-     * If this reader was created from an enumeration, all remaining elements
-     * are requested from the enumeration and closed before the
-     * <code>close</code> method returns.
-     *
-     * @exception IOException
-     *                if an I/O error occurs.
-     */
-    public void close() throws IOException {
-        do {
-            nextReader();
-        } while (in != null);
-    }
-
-}

+ 0 - 232
plugins/org.yakindu.sct.doc.user/src/main/java/org/yakindu/sct/doc/user/wikitext/TableOfContentsBuilder.java

@@ -1,232 +0,0 @@
-package org.yakindu.sct.doc.user.wikitext;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.mylyn.wikitext.parser.Attributes;
-import org.eclipse.mylyn.wikitext.parser.DocumentBuilder;
-
-/**
- * <p>
- * This document builder collects the headings from a textile stream and creates
- * a table of contents
- * </p>
- * 
- * @author Rainer Klute,
- *         <a href="mailto:rainer.klute@itemis.de">rainer.klute@itemise.de</a>,
- *         2017-09-25
- */
-public class TableOfContentsBuilder extends DocumentBuilder {
-
-	private final List<Heading> headings;
-	private boolean isProcessingHeading = false;
-	private boolean isEarlySeparator = false;
-	private Heading currentHeading;
-	private String resource;
-
-	/**
-	 * <p>
-	 * Returns the headings collected by this {@link TableOfContentsBuilder}.
-	 * </p>
-	 */
-	public List<Heading> getHeadings() {
-		return headings;
-	}
-
-	/**
-	 * <p>
-	 * Sets the currently processed resource, e.g. a filename.
-	 * </p>
-	 * 
-	 * @param resource
-	 *            the resource
-	 */
-	public void setResource(final String resource) {
-		this.resource = resource;
-	}
-
-	/**
-	 * <p>
-	 * Constructor.
-	 * </p>
-	 */
-	public TableOfContentsBuilder() {
-		this.headings = new ArrayList<Heading>();
-	}
-
-	/*
-	 * (non-Javadoc)
-	 *
-	 * @see org.eclipse.mylyn.wikitext.parser.DocumentBuilder#beginDocument()
-	 */
-	@Override
-	public void beginDocument() {
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.mylyn.wikitext.parser.DocumentBuilder#endDocument()
-	 */
-	@Override
-	public void endDocument() {
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * org.eclipse.mylyn.wikitext.parser.DocumentBuilder#beginBlock(org.eclipse.
-	 * mylyn.wikitext.parser.DocumentBuilder.BlockType,
-	 * org.eclipse.mylyn.wikitext.parser.Attributes)
-	 */
-	@Override
-	public void beginBlock(BlockType type, Attributes attributes) {
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.mylyn.wikitext.parser.DocumentBuilder#endBlock()
-	 */
-	@Override
-	public void endBlock() {
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * org.eclipse.mylyn.wikitext.parser.DocumentBuilder#beginSpan(org.eclipse.
-	 * mylyn.wikitext.parser.DocumentBuilder.SpanType,
-	 * org.eclipse.mylyn.wikitext.parser.Attributes)
-	 */
-	@Override
-	public void beginSpan(SpanType type, Attributes attributes) {
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.mylyn.wikitext.parser.DocumentBuilder#endSpan()
-	 */
-	@Override
-	public void endSpan() {
-	}
-
-	/**
-	 * <p>
-	 * The begin of a heading has been encountered. If it is an H1 heading, we
-	 * have to write the first part of the contents template into the stream.
-	 * Placeholders <em>${h1.id}</em> and <em>${h1.title}</em> have to be
-	 * replaced by actual values.
-	 * </p>
-	 * <p>
-	 * <strong>Please note:</strong> At this point the title text is not yet
-	 * known! This is only the case at {@link #endHeading()}.
-	 * </p>
-	 */
-	@Override
-	public void beginHeading(final int level, final Attributes attributes) {
-		isProcessingHeading = true;
-		final String id = attributes.getId();
-		isEarlySeparator = level == 1 && "%EARLY_SEPARATOR%".equals(attributes.getCssStyle());
-		if (!isEarlySeparator)
-			currentHeading = new Heading(resource, level, id);
-	}
-
-	@Override
-	public void endHeading() {
-		if (!isEarlySeparator) {
-			headings.add(currentHeading);
-			isProcessingHeading = false;
-		}
-	}
-
-	@Override
-	public void characters(final String text) {
-		if (isProcessingHeading && !isEarlySeparator) {
-			if (currentHeading.getTitle() == null)
-				currentHeading.setTitle(text);
-			else
-				currentHeading.appendToTitle(text);
-		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * org.eclipse.mylyn.wikitext.parser.DocumentBuilder#entityReference(java.
-	 * lang.String)
-	 */
-	@Override
-	public void entityReference(String entity) {
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * org.eclipse.mylyn.wikitext.parser.DocumentBuilder#image(org.eclipse.mylyn
-	 * .wikitext.parser.Attributes, java.lang.String)
-	 */
-	@Override
-	public void image(Attributes attributes, String url) {
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * org.eclipse.mylyn.wikitext.parser.DocumentBuilder#link(org.eclipse.mylyn.
-	 * wikitext.parser.Attributes, java.lang.String, java.lang.String)
-	 */
-	@Override
-	public void link(Attributes attributes, String hrefOrHashName, String text) {
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * org.eclipse.mylyn.wikitext.parser.DocumentBuilder#imageLink(org.eclipse.
-	 * mylyn.wikitext.parser.Attributes,
-	 * org.eclipse.mylyn.wikitext.parser.Attributes, java.lang.String,
-	 * java.lang.String)
-	 */
-	@Override
-	public void imageLink(Attributes linkAttributes, Attributes imageAttributes, String href, String imageUrl) {
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.mylyn.wikitext.parser.DocumentBuilder#acronym(java.lang.
-	 * String, java.lang.String)
-	 */
-	@Override
-	public void acronym(String text, String definition) {
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.mylyn.wikitext.parser.DocumentBuilder#lineBreak()
-	 */
-	@Override
-	public void lineBreak() {
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * org.eclipse.mylyn.wikitext.parser.DocumentBuilder#charactersUnescaped(
-	 * java.lang.String)
-	 */
-	@Override
-	public void charactersUnescaped(String literal) {
-	}
-
-}

+ 0 - 228
plugins/org.yakindu.sct.doc.user/src/main/java/org/yakindu/sct/doc/user/wikitext/TextileToHubspotConverter.java

@@ -1,228 +0,0 @@
-package org.yakindu.sct.doc.user.wikitext;
-
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-
-import org.eclipse.mylyn.wikitext.parser.MarkupParser;
-import org.eclipse.mylyn.wikitext.util.ServiceLocator;
-
-/**
- * <p>
- * This application reads one or more documents in Textile format and converts
- * it into a Hubspot template document. In it's current state, the application
- * expects the resulting document to consist of several different compartments.
- * They are explained in the {@link HubspotDocumentBuilder} class documentation.
- * </p>
- * 
- * @author Rainer Klute,
- *         <a href="mailto:rainer.klute@itemis.de">rainer.klute@itemise.de</a>,
- *         2017-08-28
- *
- */
-public class TextileToHubspotConverter {
-
-	public static void main(String[] args) throws IOException {
-		final List<String> inFileNames = new ArrayList<String>();
-		String outFilename = null;
-		String p1Filename = null;
-		String contentsTemplateFilename = null;
-		String p2Filename = null;
-		String tocTemplateFilename = null;
-		String p3Filename = null;
-		final Map<String, String> properties = new HashMap<String, String>();
-
-		/*
-		 * Parse command-line parameters:
-		 */
-		for (int i = 0; i < args.length; i++) {
-			final String arg = args[i];
-			if (arg.equals("-p1") || arg.equals("--p1-file")) {
-				p1Filename = args[++i];
-				continue;
-			}
-			if (arg.equals("-c") || arg.equals("--contents-template-file")) {
-				contentsTemplateFilename = args[++i];
-				continue;
-			}
-			if (arg.equals("-p2") || arg.equals("--p2-file")) {
-				p2Filename = args[++i];
-				continue;
-			}
-			if (arg.equals("-t") || arg.equals("--toc-template-file")) {
-				tocTemplateFilename = args[++i];
-				continue;
-			}
-			if (arg.equals("-p3") || arg.equals("--p3-file")) {
-				p3Filename = args[++i];
-				continue;
-			}
-			if (arg.equals("-i") || arg.equals("--input")) {
-				inFileNames.add(args[++i]);
-				continue;
-			}
-			if (arg.equals("-o") || arg.equals("--output")) {
-				outFilename = args[++i];
-				continue;
-			}
-			if (arg.equals("-p") || arg.equals("--property")) {
-				final String nameValue = args[++i];
-				addTo(properties, nameValue);
-				continue;
-			}
-		}
-		assertParameterIsSpecified(p1Filename, "P1 file not specified.");
-		assertParameterIsSpecified(contentsTemplateFilename, "Contents template file not specified.");
-		assertParameterIsSpecified(p2Filename, "P2 file not specified.");
-		assertParameterIsSpecified(tocTemplateFilename, "TOC template file not specified.");
-		assertParameterIsSpecified(p3Filename, "P3 file not specified.");
-		assertParameterIsSpecified(inFileNames, "Input file(s) not specified.");
-		assertParameterIsSpecified(outFilename, "Output file not specified.");
-
-		/*
-		 * Setup the TOC document builder:
-		 */
-		final TableOfContentsBuilder tocBuilder = new TableOfContentsBuilder();
-
-		/*
-		 * Concatenate all input files so that the Textile parser sees
-		 * everything as one large input file:
-		 */
-		final Vector<Reader> readers = new Vector<Reader>(inFileNames.size());
-		for (final String inFileName : inFileNames)
-			readers.addElement(new FileReader(inFileName));
-		Reader in = new SequenceReader(new Vector<Reader>(readers).elements());
-
-		/*
-		 * Create, configure, and run the Textile markup parser. It will call
-		 * back into the table of contents builder, which will create the table
-		 * of contents.
-		 */
-		MarkupParser markupParser = new MarkupParser();
-		markupParser.setMarkupLanguage(ServiceLocator.getInstance().getMarkupLanguage("Textile"));
-		markupParser.setBuilder(tocBuilder);
-		markupParser.parse(in);
-		List<Heading> headings = tocBuilder.getHeadings();
-
-		/*
-		 * Setup everything for the Hubspot document builder and process files:
-		 */
-		final Reader p1 = createFileReader(p1Filename, "P1 file not found");
-		final Reader contentsTemplate = createFileReader(contentsTemplateFilename, "Contents template file not found");
-		final Reader p2 = createFileReader(p2Filename, "P2 file not found");
-		final Reader tocTemplate = createFileReader(tocTemplateFilename, "TOC template file not found");
-		final Reader p3 = createFileReader(p3Filename, "P3 file not found");
-		final Writer out = new FileWriter(outFilename);
-		final HubspotDocumentBuilder docBuilder = new HubspotDocumentBuilder(p1, contentsTemplate, p2, tocTemplate, p3,
-				properties, headings, out);
-
-		/*
-		 * Concatenate all input files so that the Textile parser sees
-		 * everything as one large input file:
-		 */
-		/*
-		 * Concatenate all input files so that the Textile parser sees
-		 * everything as one large input file:
-		 */
-		readers.clear();
-		for (final String inFileName : inFileNames)
-			readers.addElement(new FileReader(inFileName));
-		in = new SequenceReader(new Vector<Reader>(readers).elements());
-
-		/*
-		 * Create, configure, and run the Textile markup parser. It will call
-		 * back into the document builder, which will construct the output
-		 * document.
-		 */
-		markupParser = new MarkupParser();
-		markupParser.setMarkupLanguage(ServiceLocator.getInstance().getMarkupLanguage("Textile"));
-		markupParser.setBuilder(docBuilder);
-		markupParser.parse(in);
-		out.close();
-	}
-
-	/**
-	 * <p>
-	 * Add a name/value pair to a property map. The former is expected in the
-	 * form <code>name=value</code>. Leading or trailing white space around name
-	 * or value is removed. If the <code>=value</code> part or the
-	 * <code>value</code> part is missing, the <code>name</code> property will
-	 * be added with the value being the empty string. If the <code>name</code>
-	 * part is missing, a {@link RuntimeException} will be thrown.
-	 * </p>
-	 * 
-	 * @param properties
-	 *            the map to add the name/value pair to
-	 * @param nameValue
-	 *            the name/value pair
-	 */
-	private static void addTo(final Map<String, String> properties, final String nameValue) {
-		final int p = nameValue.indexOf('=');
-		final String name;
-		final String value;
-		if (p > 1) {
-			name = nameValue.substring(0, p);
-			if (p < nameValue.length() - 1)
-				value = nameValue.substring(p + 1);
-			else
-				value = "";
-		} else if (p == 0) {
-			value = nameValue.substring(1);
-			throw new RuntimeException("Name/value pair does not contain a name. Value: \"" + value + "\"");
-		} else {
-			name = nameValue;
-			value = "";
-		}
-		properties.put(name, value);
-	}
-
-	private static void assertParameterIsSpecified(final String p, final String msg) {
-		if (p == null || p.trim().isEmpty())
-			errorExit(msg);
-	}
-
-	private static void assertParameterIsSpecified(final List<String> p, final String msg) {
-		if (p == null || p.isEmpty())
-			errorExit(msg);
-	}
-
-	private static void errorExit(final String msg) {
-		System.err.println(msg);
-		System.err
-				.println("Parameters: --p1-file part1File.htmlf" + " --contents-template-file contentTemplateFile.htmlf"
-						+ " --p2-file part2File.htmlf" + " --toc-template-file tocTemplateFile.htmlf"
-						+ " --p3-file part3file.htmlf" + " --input file.textile [--input file.textile]…"
-						+ " --output file.html" + " [--property name=value]…");
-		System.exit(1);
-	}
-
-	/**
-	 * <p>
-	 * Creates a {@link Reader} for the specified file. If that fails, the
-	 * application is terminated with a specified error message.
-	 * 
-	 * @param filename
-	 *            Name of the file to create a {@link Reader} for.
-	 * @param msg
-	 *            Error message to print if the file cannot be opened.
-	 * @return see above
-	 */
-	private static Reader createFileReader(final String filename, final String msg) {
-		Reader r = null;
-		try {
-			r = new FileReader(filename);
-		} catch (FileNotFoundException e) {
-			errorExit(msg + ": " + filename);
-		}
-		return r;
-	}
-
-}

+ 0 - 46
plugins/org.yakindu.sct.doc.user/src/test/resources/testdata.textile

@@ -1,46 +0,0 @@
-h1(#h1_1). h1_1
-
-h2(#h2_11). h2_11
-
-h2(#h2_12). h2_12
-
-h2(#h2_13). h2_13
-
-
-h1(#h1_2). h1_2
-
-h2(#h2_21). h2_21
-
-h2(#h2_22). h2_22
-
-h2(#h2_23). h2_23
-
-h2(#fragment). h2_fragment
-
-
-h1(#h1_3). h1_3
-
-h2(#h2_31). h2_31
-
-h2(#h2_32). h2_32
-
-h2(#h2_33). h2_33
-
-h2(#frag/ment). h2_frag/ment
-
-
-Links:
-* "../":../
-* "../#":../#
-* "../h1_2#fragment":../#fragment
-* "../h1_3#fragment":../#frag/ment
-* "../":../dirname
-* "../#":../dirname#
-* "../h1_2#fragment":../#fragment
-* "../h1_3#frag/ment":../dirname#frag/ment
-* "../dirname/":../dirname/filename
-* "../dirname/h1_2#":../dirname/filename#
-* "../dirname/h1_2#fragment":../dirname/filename#fragment
-* "../dirname/h1_3#frag/ment":../dirname/filename#frag/ment
-
-* "link":../dirname/filename#h1_3

+ 29 - 4
releng/org.yakindu.sct.releng/pom.xml

@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
 	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 	<modelVersion>4.0.0</modelVersion>
 	<groupId>org.yakindu.sct</groupId>
@@ -65,8 +64,7 @@
 		</plugins>
 		<pluginManagement>
 			<plugins>
-				<!-- Avoid the generation of maven archive information in the META-INF 
-					folder -->
+				<!-- Avoid the generation of maven archive information in the META-INF folder -->
 				<plugin>
 					<groupId>org.eclipse.tycho</groupId>
 					<artifactId>tycho-packaging-plugin</artifactId>
@@ -197,6 +195,20 @@
 				<ecore-xcore-version>1.3.1</ecore-xcore-version>
 				<ecore-xcore-lib-version>1.1.100</ecore-xcore-lib-version>
 			</properties>
+
+			<pluginRepositories>
+				<pluginRepository>
+					<id>yakindu-commons</id>
+					<url>https://projects.itemis.de/nexus/content/groups/OS/</url>
+					<releases>
+						<enabled>true</enabled>
+					</releases>
+					<snapshots>
+						<enabled>true</enabled>
+					</snapshots>
+				</pluginRepository>
+			</pluginRepositories>
+
 			<build>
 				<plugins>
 					<plugin>
@@ -545,4 +557,17 @@
 
 	</modules>
 
+	<pluginRepositories>
+		<pluginRepository>
+			<id>yakindu-commons</id>
+			<url>https://projects.itemis.de/nexus/content/groups/OS/</url>
+			<releases>
+				<enabled>true</enabled>
+			</releases>
+			<snapshots>
+				<enabled>true</enabled>
+			</snapshots>
+		</pluginRepository>
+	</pluginRepositories>
+
 </project>

+ 10 - 5
releng/org.yakindu.sct.releng/settings.xml

@@ -8,11 +8,16 @@
 	<offline />
 	<pluginGroups />
 	<servers>
-		<server>
-			<id>nexus-projects.itemis.de</id>
-			<username>${P2_SERVER_USER}</username>
-			<password>${P2_SERVER_PASSWORD}</password>
-		</server>
+        <server>
+            <id>nexus-projects.itemis.de</id>
+            <username>${P2_SERVER_USER}</username>
+            <password>${P2_SERVER_PASSWORD}</password>
+        </server>
+        <server>
+            <id>yakindu-commons</id>
+            <username>${P2_SERVER_USER}</username>
+            <password>${P2_SERVER_PASSWORD}</password>
+        </server>
 	</servers>
 	<proxies />
 	<profiles />