Search in sources :

Example 16 with MediaWikiLanguage

use of org.eclipse.mylyn.wikitext.mediawiki.MediaWikiLanguage in project mylyn.docs by eclipse.

the class TableOfContentsBlock method processLineContent.

@Override
public int processLineContent(String line, int offset) {
    if (blockLineNumber++ > 0) {
        setClosed(true);
        return 0;
    }
    if (!getMarkupLanguage().isFilterGenerativeContents()) {
        OutlineParser outlineParser = new OutlineParser(new MediaWikiLanguage());
        OutlineItem rootItem = outlineParser.parse(state.getMarkupContent());
        emitToc(rootItem);
    }
    int start = matcher.start(1);
    if (start > 0) {
        setClosed(true);
    }
    return start;
}
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 17 with MediaWikiLanguage

use of org.eclipse.mylyn.wikitext.mediawiki.MediaWikiLanguage in project mylyn.docs by eclipse.

the class WikiTemplateResolverTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    TestWikiTemplateResolver resolverUnderTest = new TestWikiTemplateResolver();
    resolverUnderTest.setWikiBaseUrl("http://wiki.eclipse.org");
    Map<String, String> serverContent = new HashMap<>();
    serverContent.put("http://wiki.eclipse.org/index.php?title=Template%3Abug&action=raw", BUG_TEMPLATE_CONTENT);
    serverContent.put("http://wiki.eclipse.org/index.php?title=Test&action=raw", TEST_TEMPLATE_CONTENT);
    serverContent.put("http://wiki.eclipse.org/index.php?title=Other%3ATest&action=raw", OTHER_TEMPLATE_CONTENT);
    resolverUnderTest.setServerContent(serverContent);
    MediaWikiLanguage markupLanguage = new MediaWikiLanguage();
    markupLanguage.getTemplateProviders().add(resolverUnderTest);
    this.templateProcessor = new TemplateProcessor(markupLanguage);
    this.resolver = resolverUnderTest;
}
Also used : HashMap(java.util.HashMap) MediaWikiLanguage(org.eclipse.mylyn.wikitext.mediawiki.MediaWikiLanguage) TemplateProcessor(org.eclipse.mylyn.wikitext.mediawiki.internal.TemplateProcessor)

Aggregations

MediaWikiLanguage (org.eclipse.mylyn.wikitext.mediawiki.MediaWikiLanguage)17 OutlineItem (org.eclipse.mylyn.wikitext.parser.outline.OutlineItem)9 OutlineParser (org.eclipse.mylyn.wikitext.parser.outline.OutlineParser)9 AbstractMarkupGenerationTest (org.eclipse.mylyn.wikitext.toolkit.AbstractMarkupGenerationTest)3 Test (org.junit.Test)3 File (java.io.File)2 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 BuildException (org.apache.tools.ant.BuildException)2 MarkupLanguage (org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage)2 SplitOutlineItem (org.eclipse.mylyn.wikitext.splitter.SplitOutlineItem)2 BufferedOutputStream (java.io.BufferedOutputStream)1 FileOutputStream (java.io.FileOutputStream)1 InputStreamReader (java.io.InputStreamReader)1 OutputStreamWriter (java.io.OutputStreamWriter)1 Reader (java.io.Reader)1 StringWriter (java.io.StringWriter)1 Writer (java.io.Writer)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1