use of org.eclipse.mylyn.wikitext.parser.outline.OutlineItem in project mylyn.docs by eclipse.
the class XslfoDocumentBuilderIntegrationTest method testforTableCellAlign_bug336813.
public void testforTableCellAlign_bug336813() {
final String markup = "{|\n" + "|- \n |'''Row heading'''\n" + "| valign=\"top\" | A longer piece of text. Lorem ipsum...\n |A shorter piece of text.\n" + "|- \n |'''Row heading'''\n" + "| style=\"vertical-align: bottom;\" | 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-cell display-align=\"before\"").matcher(xslfo).find());
// From css styling
assertTrue(Pattern.compile("<block font-size=\"10.0pt\" display-align=\"after\">").matcher(xslfo).find());
}
use of org.eclipse.mylyn.wikitext.parser.outline.OutlineItem 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;
}
use of org.eclipse.mylyn.wikitext.parser.outline.OutlineItem 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;
}
Aggregations