Search in sources :

Example 6 with TextileLanguage

use of org.eclipse.mylyn.wikitext.textile.TextileLanguage in project mylyn.docs by eclipse.

the class HtmlDocumentBuilderIntegrationTest method setUp.

@Override
public void setUp() {
    parser = new MarkupParser();
    parser.setMarkupLanguage(new TextileLanguage());
    out = new StringWriter();
    builder = new HtmlDocumentBuilder(out);
    parser.setBuilder(builder);
}
Also used : TextileLanguage(org.eclipse.mylyn.wikitext.textile.TextileLanguage) StringWriter(java.io.StringWriter) HtmlDocumentBuilder(org.eclipse.mylyn.wikitext.parser.builder.HtmlDocumentBuilder) MarkupParser(org.eclipse.mylyn.wikitext.parser.MarkupParser)

Example 7 with TextileLanguage

use of org.eclipse.mylyn.wikitext.textile.TextileLanguage in project mylyn.docs by eclipse.

the class FastMarkupPartitionerTest method testTextileLinkWithStyle.

public void testTextileLinkWithStyle() {
    IDocument document = new Document();
    FastMarkupPartitioner partitioner = new FastMarkupPartitioner();
    partitioner.setMarkupLanguage(new TextileLanguage());
    String markup = "\"_text_\":http://example.com";
    document.set(markup);
    partitioner.connect(document);
    document.setDocumentPartitioner(partitioner);
    int[][] expected = new int[][] { // 
    { 0, markup.length() } };
    ITypedRegion[] partitioning = partitioner.computePartitioning(0, document.getLength(), false);
    assertPartitioningAsExpected(expected, partitioning);
}
Also used : TextileLanguage(org.eclipse.mylyn.wikitext.textile.TextileLanguage) ITypedRegion(org.eclipse.jface.text.ITypedRegion) Document(org.eclipse.jface.text.Document) IDocument(org.eclipse.jface.text.IDocument) IDocument(org.eclipse.jface.text.IDocument)

Example 8 with TextileLanguage

use of org.eclipse.mylyn.wikitext.textile.TextileLanguage in project mylyn.docs by eclipse.

the class FastMarkupPartitionerTest method testTextileNestedPhraseModifiersException.

public void testTextileNestedPhraseModifiersException() {
    IDocument document = new Document();
    FastMarkupPartitioner partitioner = new FastMarkupPartitioner();
    partitioner.setMarkupLanguage(new TextileLanguage());
    document.set("a _sample *bold*_");
    partitioner.connect(document);
    document.setDocumentPartitioner(partitioner);
}
Also used : TextileLanguage(org.eclipse.mylyn.wikitext.textile.TextileLanguage) Document(org.eclipse.jface.text.Document) IDocument(org.eclipse.jface.text.IDocument) IDocument(org.eclipse.jface.text.IDocument)

Example 9 with TextileLanguage

use of org.eclipse.mylyn.wikitext.textile.TextileLanguage in project mylyn.docs by eclipse.

the class TextileToDocbookTest method setUp.

@Override
public void setUp() {
    textileToDocbook = new MarkupToDocbook();
    textileToDocbook.setMarkupLanguage(new TextileLanguage());
}
Also used : TextileLanguage(org.eclipse.mylyn.wikitext.textile.TextileLanguage) MarkupToDocbook(org.eclipse.mylyn.wikitext.parser.util.MarkupToDocbook)

Example 10 with TextileLanguage

use of org.eclipse.mylyn.wikitext.textile.TextileLanguage in project mylyn.docs by eclipse.

the class SplittingHtmlDocumentBuilderTest method generateContents.

private void generateContents(String markup, boolean embeddedTableOfContents) throws IOException, FileNotFoundException {
    try (OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(outputFile), StandardCharsets.UTF_8)) {
        rootBuilder = new HtmlDocumentBuilder(out, true);
        SplittingOutlineParser outlineParser = new SplittingOutlineParser();
        outlineParser.setMarkupLanguage(new TextileLanguage());
        outlineParser.setSplittingStrategy(new DefaultSplittingStrategy());
        SplitOutlineItem outline = outlineParser.parse(markup);
        outline.setSplitTarget(outputFile.getName());
        builder.setEmbeddedTableOfContents(embeddedTableOfContents);
        builder.setRootBuilder(rootBuilder);
        builder.setRootFile(outputFile);
        builder.setFormatting(true);
        builder.setOutline(outline);
        MarkupParser parser = new MarkupParser(new TextileLanguage());
        parser.setBuilder(builder);
        parser.parse(markup);
    }
}
Also used : TextileLanguage(org.eclipse.mylyn.wikitext.textile.TextileLanguage) FileOutputStream(java.io.FileOutputStream) SplittingOutlineParser(org.eclipse.mylyn.wikitext.splitter.SplittingOutlineParser) OutputStreamWriter(java.io.OutputStreamWriter) SplitOutlineItem(org.eclipse.mylyn.wikitext.splitter.SplitOutlineItem) HtmlDocumentBuilder(org.eclipse.mylyn.wikitext.parser.builder.HtmlDocumentBuilder) SplittingHtmlDocumentBuilder(org.eclipse.mylyn.wikitext.splitter.SplittingHtmlDocumentBuilder) DefaultSplittingStrategy(org.eclipse.mylyn.wikitext.splitter.DefaultSplittingStrategy) MarkupParser(org.eclipse.mylyn.wikitext.parser.MarkupParser)

Aggregations

TextileLanguage (org.eclipse.mylyn.wikitext.textile.TextileLanguage)22 MarkupParser (org.eclipse.mylyn.wikitext.parser.MarkupParser)8 StringWriter (java.io.StringWriter)6 IDocument (org.eclipse.jface.text.IDocument)6 Document (org.eclipse.jface.text.Document)5 HtmlDocumentBuilder (org.eclipse.mylyn.wikitext.parser.builder.HtmlDocumentBuilder)4 OutlineItem (org.eclipse.mylyn.wikitext.parser.outline.OutlineItem)3 OutlineParser (org.eclipse.mylyn.wikitext.parser.outline.OutlineParser)3 ITypedRegion (org.eclipse.jface.text.ITypedRegion)2 DitaTopicDocumentBuilder (org.eclipse.mylyn.wikitext.parser.builder.DitaTopicDocumentBuilder)2 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 OutputStreamWriter (java.io.OutputStreamWriter)1 Reader (java.io.Reader)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 Matcher (java.util.regex.Matcher)1