Search in sources :

Example 1 with MarkupLanguage

use of org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage in project mylyn.docs by eclipse.

the class MarkupToXslfoTask method execute.

@Override
public void execute() throws BuildException {
    if (file == null && filesets.isEmpty()) {
        // $NON-NLS-1$
        throw new BuildException(Messages.getString("MarkupToXslfoTask.0"));
    }
    if (file != null && !filesets.isEmpty()) {
        // $NON-NLS-1$
        throw new BuildException(Messages.getString("MarkupToXslfoTask.1"));
    }
    if (file != null) {
        if (!file.exists()) {
            // $NON-NLS-1$
            throw new BuildException(MessageFormat.format(Messages.getString("MarkupToXslfoTask.2"), file));
        } else if (!file.isFile()) {
            // $NON-NLS-1$
            throw new BuildException(MessageFormat.format(Messages.getString("MarkupToXslfoTask.3"), file));
        } else if (!file.canRead()) {
            // $NON-NLS-1$
            throw new BuildException(MessageFormat.format(Messages.getString("MarkupToXslfoTask.4"), file));
        }
    }
    MarkupLanguage markupLanguage = createMarkupLanguage();
    for (FileSet fileset : filesets) {
        File filesetBaseDir = fileset.getDir(getProject());
        DirectoryScanner ds = fileset.getDirectoryScanner(getProject());
        String[] files = ds.getIncludedFiles();
        if (files != null) {
            File baseDir = ds.getBasedir();
            for (String file : files) {
                File inputFile = new File(baseDir, file);
                try {
                    processFile(markupLanguage, filesetBaseDir, inputFile);
                } catch (BuildException e) {
                    throw e;
                } catch (Exception e) {
                    throw new BuildException(MessageFormat.format(// $NON-NLS-1$
                    Messages.getString("MarkupToXslfoTask.5"), // $NON-NLS-1$
                    inputFile, e.getMessage()), e);
                }
            }
        }
    }
    if (file != null) {
        try {
            processFile(markupLanguage, file.getParentFile(), file);
        } catch (BuildException e) {
            throw e;
        } catch (Exception e) {
            throw new BuildException(MessageFormat.format(Messages.getString("MarkupToXslfoTask.6"), file, e.getMessage()), // $NON-NLS-1$
            e);
        }
    }
}
Also used : FileSet(org.apache.tools.ant.types.FileSet) DirectoryScanner(org.apache.tools.ant.DirectoryScanner) BuildException(org.apache.tools.ant.BuildException) MarkupLanguage(org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage) File(java.io.File) BuildException(org.apache.tools.ant.BuildException)

Example 2 with MarkupLanguage

use of org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage in project mylyn.docs by eclipse.

the class HtmlToMarkupTask method execute.

@Override
public void execute() throws BuildException {
    if (file == null && filesets.isEmpty()) {
        // $NON-NLS-1$
        throw new BuildException(Messages.getString("MarkupToHtmlTask.1"));
    }
    if (file != null && !filesets.isEmpty()) {
        // $NON-NLS-1$
        throw new BuildException(Messages.getString("MarkupToHtmlTask.2"));
    }
    if (file != null) {
        if (!file.exists()) {
            // $NON-NLS-1$
            throw new BuildException(MessageFormat.format(Messages.getString("MarkupToHtmlTask.3"), file));
        } else if (!file.isFile()) {
            // $NON-NLS-1$
            throw new BuildException(MessageFormat.format(Messages.getString("MarkupToHtmlTask.4"), file));
        } else if (!file.canRead()) {
            // $NON-NLS-1$
            throw new BuildException(MessageFormat.format(Messages.getString("MarkupToHtmlTask.5"), file));
        }
    }
    MarkupLanguage markupLanguage = createMarkupLanguage();
    for (FileSet fileset : filesets) {
        File filesetBaseDir = fileset.getDir(getProject());
        DirectoryScanner ds = fileset.getDirectoryScanner(getProject());
        String[] files = ds.getIncludedFiles();
        if (files != null) {
            File baseDir = ds.getBasedir();
            for (String file : files) {
                File inputFile = new File(baseDir, file);
                try {
                    processFile(markupLanguage, filesetBaseDir, inputFile);
                } catch (BuildException e) {
                    throw e;
                } catch (Exception e) {
                    throw new BuildException(MessageFormat.format(// $NON-NLS-1$
                    Messages.getString("MarkupToHtmlTask.11"), // $NON-NLS-1$
                    inputFile, e.getMessage()), e);
                }
            }
        }
    }
    if (file != null) {
        try {
            processFile(markupLanguage, file.getParentFile(), file);
        } catch (BuildException e) {
            throw e;
        } catch (Exception e) {
            throw new BuildException(MessageFormat.format(Messages.getString("MarkupToHtmlTask.12"), file, e.getMessage()), // $NON-NLS-1$
            e);
        }
    }
}
Also used : FileSet(org.apache.tools.ant.types.FileSet) DirectoryScanner(org.apache.tools.ant.DirectoryScanner) BuildException(org.apache.tools.ant.BuildException) MarkupLanguage(org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage) File(java.io.File) BuildException(org.apache.tools.ant.BuildException)

Example 3 with MarkupLanguage

use of org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage in project mylyn.docs by eclipse.

the class MarkupToDocbookTask method execute.

@Override
public void execute() throws BuildException {
    if (file == null && filesets.isEmpty()) {
        // $NON-NLS-1$
        throw new BuildException(Messages.getString("MarkupToDocbookTask.1"));
    }
    if (file != null && !filesets.isEmpty()) {
        // $NON-NLS-1$
        throw new BuildException(Messages.getString("MarkupToDocbookTask.2"));
    }
    if (file != null) {
        if (!file.exists()) {
            // $NON-NLS-1$
            throw new BuildException(MessageFormat.format(Messages.getString("MarkupToDocbookTask.3"), file));
        } else if (!file.isFile()) {
            // $NON-NLS-1$
            throw new BuildException(MessageFormat.format(Messages.getString("MarkupToDocbookTask.4"), file));
        } else if (!file.canRead()) {
            // $NON-NLS-1$
            throw new BuildException(MessageFormat.format(Messages.getString("MarkupToDocbookTask.5"), file));
        }
    }
    MarkupLanguage markupLanguage = createMarkupLanguage();
    for (FileSet fileset : filesets) {
        File filesetBaseDir = fileset.getDir(getProject());
        DirectoryScanner ds = fileset.getDirectoryScanner(getProject());
        String[] files = ds.getIncludedFiles();
        if (files != null) {
            File baseDir = ds.getBasedir();
            for (String file : files) {
                File inputFile = new File(baseDir, file);
                try {
                    processFile(markupLanguage, filesetBaseDir, inputFile);
                } catch (BuildException e) {
                    throw e;
                } catch (Exception e) {
                    throw new BuildException(MessageFormat.format(// $NON-NLS-1$
                    Messages.getString("MarkupToDocbookTask.6"), // $NON-NLS-1$
                    inputFile, e.getMessage()), e);
                }
            }
        }
    }
    if (file != null) {
        try {
            processFile(markupLanguage, file.getParentFile(), file);
        } catch (BuildException e) {
            throw e;
        } catch (Exception e) {
            throw new BuildException(MessageFormat.format(Messages.getString("MarkupToDocbookTask.7"), file, e.getMessage()), // $NON-NLS-1$
            e);
        }
    }
}
Also used : FileSet(org.apache.tools.ant.types.FileSet) DirectoryScanner(org.apache.tools.ant.DirectoryScanner) BuildException(org.apache.tools.ant.BuildException) MarkupLanguage(org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage) File(java.io.File) BuildException(org.apache.tools.ant.BuildException)

Example 4 with MarkupLanguage

use of org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage in project mylyn.docs by eclipse.

the class WikiTextTest method getMarkupLanguageCopied.

@Test
public void getMarkupLanguageCopied() {
    MarkupLanguage markupLanguage = WikiText.getMarkupLanguage("Textile");
    assertNotSame(markupLanguage, WikiText.getMarkupLanguage("Textile"));
}
Also used : MarkupLanguage(org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage) Test(org.junit.Test)

Example 5 with MarkupLanguage

use of org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage in project mylyn.docs by eclipse.

the class WikiTextTest method getMarkupLanguage.

@Test
public void getMarkupLanguage() {
    MarkupLanguage markupLanguage = WikiText.getMarkupLanguage("Textile");
    assertNotNull(markupLanguage);
    assertEquals("Textile", markupLanguage.getName());
}
Also used : MarkupLanguage(org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage) Test(org.junit.Test)

Aggregations

MarkupLanguage (org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage)60 Test (org.junit.Test)18 AbstractMarkupLanguage (org.eclipse.mylyn.wikitext.parser.markup.AbstractMarkupLanguage)15 MarkupParser (org.eclipse.mylyn.wikitext.parser.MarkupParser)8 File (java.io.File)7 BuildException (org.apache.tools.ant.BuildException)7 CoreException (org.eclipse.core.runtime.CoreException)7 MockMarkupLanguage (org.eclipse.mylyn.internal.wikitext.MockMarkupLanguage)7 StringWriter (java.io.StringWriter)6 HashMap (java.util.HashMap)5 DirectoryScanner (org.apache.tools.ant.DirectoryScanner)5 FileSet (org.apache.tools.ant.types.FileSet)5 OutlineItem (org.eclipse.mylyn.wikitext.parser.outline.OutlineItem)5 Point (org.eclipse.swt.graphics.Point)5 IOException (java.io.IOException)4 IFile (org.eclipse.core.resources.IFile)4 IExtensionPoint (org.eclipse.core.runtime.IExtensionPoint)4 TreeMap (java.util.TreeMap)3 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)3 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)3