Search in sources :

Example 21 with TextileLanguage

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

the class XslfoDocumentBuilderIntegrationTest method testCopyrightExtent.

public void testCopyrightExtent() {
    documentBuilder.getConfiguration().setCopyright("Test Copyright");
    parser.setMarkupLanguage(new TextileLanguage());
    parser.parse("test");
    assertEquals(resource("testCopyrightExtent.xml"), out.toString());
}
Also used : TextileLanguage(org.eclipse.mylyn.wikitext.textile.TextileLanguage)

Example 22 with TextileLanguage

use of org.eclipse.mylyn.wikitext.textile.TextileLanguage 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()) {
        String options = matcher.group(1);
        if (options != null) {
            // $NON-NLS-1$
            String[] optionPairs = options.split("\\s*\\|\\s*");
            for (String optionPair : optionPairs) {
                // $NON-NLS-1$
                String[] keyValue = optionPair.split("\\s*=\\s*");
                if (keyValue.length == 2) {
                    String key = keyValue[0].trim();
                    String value = keyValue[1].trim();
                    if (key.equals(OPTION_STYLE)) {
                        setStyle(value);
                    } else if (key.equals(OPTION_MAX_LEVEL)) {
                        try {
                            maxLevel = Integer.parseInt(value);
                        } catch (NumberFormatException e) {
                        }
                    } else if (key.equals(OPTION_CLASS)) {
                        setCssClass(value);
                    }
                }
            }
        }
        OutlineParser outlineParser = new OutlineParser(new TextileLanguage());
        OutlineItem rootItem = outlineParser.parse(state.getMarkupContent());
        emitToc(rootItem);
    }
    return -1;
}
Also used : TextileLanguage(org.eclipse.mylyn.wikitext.textile.TextileLanguage) OutlineParser(org.eclipse.mylyn.wikitext.parser.outline.OutlineParser) OutlineItem(org.eclipse.mylyn.wikitext.parser.outline.OutlineItem)

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