@Override public void beginHeading(int level, Attributes attributes) { for (DocumentBuilder builder : builders) { builder.beginHeading(level, attributes); } }
@Override public int processLineContent(String line, int offset) { offset = matcher.start(3); int level = matcher.group(1).length(); String bangEscape = matcher.group(2); boolean omitFromToc = false; if (bangEscape != null && bangEscape.length() > 0) { omitFromToc = true; } if (offset > 0 && level > 0) { HeadingAttributes attributes = new HeadingAttributes(); attributes.setOmitFromTableOfContents(omitFromToc); attributes.setId(state.getIdGenerator().newId("h" + level, line.substring(offset))); //$NON-NLS-1$ builder.beginHeading(level, attributes); builder.characters(line.substring(offset).trim()); builder.endHeading(); } setClosed(true); return -1; }
@Override public int processLineContent(String line, int offset) { if (blockLineCount > 0) { throw new IllegalStateException(); } ++blockLineCount; int level = matcher.group(1).length(); String text = matcher.group(2); String id = matcher.group(3); Attributes attributes = new Attributes(); attributes.setId(id); if (attributes.getId() == null) { attributes.setId(state.getIdGenerator().newId("h" + level, text)); //$NON-NLS-1$ } builder.beginHeading(level, attributes); builder.characters(text); builder.endHeading(); setClosed(true); return -1; }
@Override public int processLineContent(String line, int offset) { if (blockLineCount > 0) { throw new IllegalStateException(); } ++blockLineCount; int level = matcher.group(1).length(); String text = matcher.group(2); String id = matcher.group(3); Attributes attributes = new Attributes(); attributes.setId(id); if (attributes.getId() == null) { attributes.setId(state.getIdGenerator().newId("h" + level, text)); //$NON-NLS-1$ } builder.beginHeading(level, attributes); builder.characters(text); builder.endHeading(); setClosed(true); return -1; }
@Override public int processLineContent(String line, int offset) { if (blockLineCount == 0) { Attributes attributes = new Attributes(); // 0-offset matches may start with the "hn. " prefix. level = Integer.parseInt(matcher.group(1)); offset = matcher.start(2); if (attributes.getId() == null) { attributes.setId(state.getIdGenerator().newId("h" + level, line.substring(offset))); //$NON-NLS-1$ } builder.beginHeading(level, attributes); } if (blockLineCount != 0 || markupLanguage.isEmptyLine(line)) { setClosed(true); return 0; } ++blockLineCount; getMarkupLanguage().emitMarkupLine(getParser(), state, line, offset); return -1; }
@Override public int processLineContent(String line, int offset) { if (blockLineCount == 0) { Attributes attributes = new Attributes(); // 0-offset matches may start with the "hn. " prefix. level = Integer.parseInt(matcher.group(1)); offset = matcher.start(2); if (attributes.getId() == null) { attributes.setId(state.getIdGenerator().newId("h" + level, line.substring(offset))); //$NON-NLS-1$ } builder.beginHeading(level, attributes); } if (blockLineCount != 0 || markupLanguage.isEmptyLine(line)) { setClosed(true); return 0; } ++blockLineCount; getMarkupLanguage().emitMarkupLine(getParser(), state, line, offset); return -1; }
@Override public int processLineContent(String line, int offset) { if (blockLineCount == 0) { Attributes attributes = new Attributes(); if (offset == 0) { // 0-offset matches may start with the "hn. " prefix. level = Integer.parseInt(matcher.group(1)); Textile.configureAttributes(attributes, matcher, 2, true); offset = matcher.start(LINE_REMAINDER_GROUP_OFFSET); } if (attributes.getId() == null) { attributes.setId(state.getIdGenerator().newId("h" + level, line.substring(offset))); //$NON-NLS-1$ } builder.beginHeading(level, attributes); } if (markupLanguage.isEmptyLine(line)) { setClosed(true); return 0; } if (blockLineCount != 0) { getMarkupLanguage().emitMarkupText(getParser(), state, "\n"); //$NON-NLS-1$ } ++blockLineCount; getMarkupLanguage().emitMarkupLine(getParser(), state, line, offset); return -1; }