Search in sources :

Example 11 with MarkupParser

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

the class TextileLanguageTest method testBug50NoXHTMLCompliance.

@Test
public void testBug50NoXHTMLCompliance() throws Exception {
    StringWriter writer = new StringWriter();
    MarkupParser parser = new MarkupParser(new TextileLanguage());
    final HtmlDocumentBuilder builder = new HtmlDocumentBuilder(writer);
    builder.setXhtmlStrict(false);
    builder.setEmitDtd(false);
    parser.setBuilder(builder);
    parser.parse("!<image.png!:http://foo.bar");
    String html = writer.toString();
    assertTrue(html.contains("<a href=\"http://foo.bar\"><img align=\"left\" border=\"0\" src=\"image.png\"/></a>"));
}
Also used : StringWriter(java.io.StringWriter) HtmlDocumentBuilder(org.eclipse.mylyn.wikitext.parser.builder.HtmlDocumentBuilder) MarkupParser(org.eclipse.mylyn.wikitext.parser.MarkupParser) Test(org.junit.Test) AbstractMarkupGenerationTest(org.eclipse.mylyn.wikitext.toolkit.AbstractMarkupGenerationTest)

Example 12 with MarkupParser

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

the class ServiceLocatorTest method getAllMarkupLanguagesFiltersDuplicates.

@Test
public void getAllMarkupLanguagesFiltersDuplicates() {
    final MarkupLanguage language1 = new TestMarkupLanguage("Language 1");
    final MarkupLanguage language1b = new MarkupLanguage() {

        {
            setName("Language 1");
        }

        @Override
        public void processContent(MarkupParser parser, String markupContent, boolean asDocument) {
            throw new IllegalStateException();
        }
    };
    final MarkupLanguage language2 = new TestMarkupLanguage("Language 3");
    final MarkupLanguage language2b = new TestMarkupLanguage("Language 3");
    ServiceLocator locator = new ServiceLocator(ServiceLocatorTest.class.getClassLoader()) {

        @Override
        void loadMarkupLanguages(MarkupLanguageVisitor visitor) {
            visitor.accept(language1);
            visitor.accept(language1b);
            visitor.accept(language2);
            visitor.accept(language2b);
        }
    };
    Set<MarkupLanguage> markupLanguages = locator.getAllMarkupLanguages();
    assertEquals(3, markupLanguages.size());
    assertTrue(markupLanguages.containsAll(ImmutableSet.of(language1, language1b)));
    assertTrue(markupLanguages.contains(language2) || markupLanguages.contains(language2b));
}
Also used : ServiceLocator(org.eclipse.mylyn.wikitext.util.ServiceLocator) MockMarkupLanguage(org.eclipse.mylyn.internal.wikitext.MockMarkupLanguage) MarkupLanguage(org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage) MarkupParser(org.eclipse.mylyn.wikitext.parser.MarkupParser) Test(org.junit.Test)

Example 13 with MarkupParser

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

the class TextileLanguageTasksTest method initParser.

private void initParser() throws IOException {
    parser = new MarkupParser();
    markupLanguage = new TextileLanguage();
    MarkupLanguageConfiguration configuration = Util.create("bugzilla");
    markupLanguage.configure(configuration);
    parser.setMarkupLanguage(markupLanguage);
}
Also used : MarkupLanguageConfiguration(org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguageConfiguration) MarkupParser(org.eclipse.mylyn.wikitext.parser.MarkupParser)

Example 14 with MarkupParser

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

the class TracWikiLanguageTest method setUp.

@Override
public void setUp() {
    markupLanguage = new TracWikiLanguage();
    parser = new MarkupParser(markupLanguage);
}
Also used : TracWikiLanguage(org.eclipse.mylyn.wikitext.tracwiki.TracWikiLanguage) MarkupParser(org.eclipse.mylyn.wikitext.parser.MarkupParser)

Example 15 with MarkupParser

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

the class AbstractMarkupGenerationTest method initParser.

@Before
public void initParser() {
    parser = new MarkupParser();
    markupLanguage = createMarkupLanguage();
    parser.setMarkupLanguage(markupLanguage);
}
Also used : MarkupParser(org.eclipse.mylyn.wikitext.parser.MarkupParser) Before(org.junit.Before)

Aggregations

MarkupParser (org.eclipse.mylyn.wikitext.parser.MarkupParser)55 StringWriter (java.io.StringWriter)24 HtmlDocumentBuilder (org.eclipse.mylyn.wikitext.parser.builder.HtmlDocumentBuilder)17 Writer (java.io.Writer)13 Test (org.junit.Test)10 File (java.io.File)8 MarkupLanguage (org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage)8 TextileLanguage (org.eclipse.mylyn.wikitext.textile.TextileLanguage)8 OutputStreamWriter (java.io.OutputStreamWriter)7 FileOutputStream (java.io.FileOutputStream)6 BufferedOutputStream (java.io.BufferedOutputStream)5 IOException (java.io.IOException)5 BuildException (org.apache.tools.ant.BuildException)5 IFile (org.eclipse.core.resources.IFile)4 EventDocumentBuilder (org.eclipse.mylyn.wikitext.parser.builder.EventDocumentBuilder)4 PrintWriter (java.io.PrintWriter)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 HtmlLanguage (org.eclipse.mylyn.wikitext.html.HtmlLanguage)3 Attributes (org.eclipse.mylyn.wikitext.parser.Attributes)3