Search in sources :

Example 6 with OutlineParser

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

the class XslfoDocumentBuilderIntegrationTest method testforTableSpan_bug336813.

public void testforTableSpan_bug336813() {
    final String markup = "{|\n|-\n" + "| Column 1 || Column 2 || Column 3\n" + "|-\n" + "| rowspan=\"2\"| A\n" + "| colspan=\"2\" | B\n" + "|-\n" + "| C <!-- column 1 occupied by cell A -->\n" + "| D \n" + "|-\n" + "| E\n" + "| rowspan=\"2\" colspan=\"2\" | F\n" + "|- \n" + "| G <!-- column 2+3 occupied by cell F -->\n" + "|- \n" + "| colspan=\"3\" | H\n" + "|}";
    documentBuilder.getConfiguration().setPageNumbering(true);
    documentBuilder.getConfiguration().setTitle("Title");
    OutlineItem op = new OutlineParser(new MediaWikiLanguage()).parse(markup);
    documentBuilder.setOutline(op);
    parser.setMarkupLanguage(new MediaWikiLanguage());
    parser.parse(markup, true);
    final String xslfo = out.toString();
    // Test for rowspan
    assertTrue(Pattern.compile("<table-cell number-rows-spanned=\"2\" padding-left=\"2pt\" padding-right=\"2pt\" padding-top=\"2pt\" padding-bottom=\"2pt\">").matcher(xslfo).find());
    // Test for colspan
    assertTrue(Pattern.compile("<table-cell number-columns-spanned=\"2\" padding-left=\"2pt\" padding-right=\"2pt\" padding-top=\"2pt\" padding-bottom=\"2pt\">").matcher(xslfo).find());
}
Also used : OutlineParser(org.eclipse.mylyn.wikitext.parser.outline.OutlineParser) MediaWikiLanguage(org.eclipse.mylyn.wikitext.mediawiki.MediaWikiLanguage) OutlineItem(org.eclipse.mylyn.wikitext.parser.outline.OutlineItem)

Example 7 with OutlineParser

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

the class XslfoDocumentBuilderIntegrationTest method testForXslFoBookmarks_bug336592.

public void testForXslFoBookmarks_bug336592() {
    final String markup = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n= Bookmark H1 =\n== Bookmark H2 ==\n";
    documentBuilder.getConfiguration().setPageNumbering(true);
    documentBuilder.getConfiguration().setTitle("Title");
    OutlineItem op = new OutlineParser(new MediaWikiLanguage()).parse(markup);
    documentBuilder.setOutline(op);
    parser.setMarkupLanguage(new MediaWikiLanguage());
    parser.parse(markup, true);
    final String xslfo = out.toString();
    assertTrue(Pattern.compile("<bookmark-tree>\\s*<bookmark internal-destination=\"Bookmark_H1\">\\s*<bookmark-title>Bookmark H1</bookmark-title>\\s*<bookmark internal-destination=\"Bookmark_H2\">\\s*<bookmark-title>Bookmark H2</bookmark-title>\\s*</bookmark>\\s*</bookmark>\\s*</bookmark-tree>").matcher(xslfo).find());
}
Also used : OutlineParser(org.eclipse.mylyn.wikitext.parser.outline.OutlineParser) MediaWikiLanguage(org.eclipse.mylyn.wikitext.mediawiki.MediaWikiLanguage) OutlineItem(org.eclipse.mylyn.wikitext.parser.outline.OutlineItem)

Example 8 with OutlineParser

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

the class XslfoDocumentBuilderIntegrationTest method testforTableRowAlign_bug336813.

public void testforTableRowAlign_bug336813() {
    final String markup = "{|\n" + "|- valign=\"top\"\n |'''Row heading'''\n" + "| A longer piece of text. Lorem ipsum...\n |A shorter piece of text.\n" + "|- style=\"vertical-align: bottom;\"\n |'''Row heading'''\n" + "|A longer piece of text. Lorem ipsum... \n |A shorter piece of text.\n" + "|}";
    documentBuilder.getConfiguration().setPageNumbering(true);
    documentBuilder.getConfiguration().setTitle("Title");
    OutlineItem op = new OutlineParser(new MediaWikiLanguage()).parse(markup);
    documentBuilder.setOutline(op);
    parser.setMarkupLanguage(new MediaWikiLanguage());
    parser.parse(markup, true);
    final String xslfo = out.toString();
    // From "valign" attribute
    assertTrue(Pattern.compile("<table-row display-align=\"before\">").matcher(xslfo).find());
    // From css styling
    assertTrue(Pattern.compile("<table-row display-align=\"after\">").matcher(xslfo).find());
}
Also used : OutlineParser(org.eclipse.mylyn.wikitext.parser.outline.OutlineParser) MediaWikiLanguage(org.eclipse.mylyn.wikitext.mediawiki.MediaWikiLanguage) OutlineItem(org.eclipse.mylyn.wikitext.parser.outline.OutlineItem)

Example 9 with OutlineParser

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

the class MarkupToEclipseToc method parse.

public String parse(String markupContent) {
    if (markupLanguage == null) {
        // $NON-NLS-1$
        throw new IllegalStateException("Must set markupLanguage");
    }
    OutlineParser parser = new OutlineParser(markupLanguage);
    OutlineItem root = parser.parse(markupContent);
    return createToc(root);
}
Also used : OutlineParser(org.eclipse.mylyn.wikitext.parser.outline.OutlineParser) OutlineItem(org.eclipse.mylyn.wikitext.parser.outline.OutlineItem)

Example 10 with OutlineParser

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

the class WikiTextSourceEditor method initializeOutlineParser.

private void initializeOutlineParser() {
    synchronized (WikiTextSourceEditor.this) {
        if (outlineParser == null) {
            outlineParser = new OutlineParser();
            outlineParser.setLabelMaxLength(48);
            outlineModel = outlineParser.createRootItem();
        }
    }
}
Also used : OutlineParser(org.eclipse.mylyn.wikitext.parser.outline.OutlineParser)

Aggregations

OutlineParser (org.eclipse.mylyn.wikitext.parser.outline.OutlineParser)19 OutlineItem (org.eclipse.mylyn.wikitext.parser.outline.OutlineItem)18 MediaWikiLanguage (org.eclipse.mylyn.wikitext.mediawiki.MediaWikiLanguage)9 TextileLanguage (org.eclipse.mylyn.wikitext.textile.TextileLanguage)3 BufferedOutputStream (java.io.BufferedOutputStream)2 File (java.io.File)2 FileOutputStream (java.io.FileOutputStream)2 OutputStreamWriter (java.io.OutputStreamWriter)2 Writer (java.io.Writer)2 BuildException (org.apache.tools.ant.BuildException)2 MarkupParser (org.eclipse.mylyn.wikitext.parser.MarkupParser)2 IOException (java.io.IOException)1 LinkedHashSet (java.util.LinkedHashSet)1 CoreException (org.eclipse.core.runtime.CoreException)1 ConfluenceLanguage (org.eclipse.mylyn.wikitext.confluence.ConfluenceLanguage)1 DitaBookMapDocumentBuilder (org.eclipse.mylyn.wikitext.parser.builder.DitaBookMapDocumentBuilder)1 DitaTopicDocumentBuilder (org.eclipse.mylyn.wikitext.parser.builder.DitaTopicDocumentBuilder)1 XslfoDocumentBuilder (org.eclipse.mylyn.wikitext.parser.builder.XslfoDocumentBuilder)1 MarkupLanguage (org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage)1 AbstractMarkupGenerationTest (org.eclipse.mylyn.wikitext.toolkit.AbstractMarkupGenerationTest)1