return BlockContinue.atIndex(state.getLineEndIndex());
@Override public BlockStart tryStart(ParserState state, MatchedBlockParser matchedBlockParser) { if (options.nestedBlockQuotes || !haveBlockQuoteParser(state)) { BasedSequence line = state.getLineWithEOL(); final Matcher matcher = GIT_LAB_BLOCK_START.matcher(line); if (matcher.matches()) { return BlockStart.of(new GitLabBlockQuoteParser(state.getProperties(), line.subSequence(0, 3), line.subSequence(matcher.start(1), matcher.end(1)))) .atIndex(state.getLineEndIndex()) //.replaceActiveBlockParser() ; } } return BlockStart.none(); } }
@Override public BlockStart tryStart(ParserState state, MatchedBlockParser matchedBlockParser) { if (state.getIndex() == 0 && !haveBlockQuoteParser(state)) { BasedSequence line = state.getLineWithEOL(); final Matcher matcher = (state.getParsing().intellijDummyIdentifier ? MACRO_BLOCK_START_INTELLIJ : MACRO_BLOCK_START).matcher(line); if (matcher.matches()) { return BlockStart.of(new MacroDefinitionBlockParser(state.getProperties(), line.subSequence(0, 3), line.subSequence(matcher.start(1), matcher.end(1)), line.subSequence(matcher.start(2), matcher.end(1)))) .atIndex(state.getLineEndIndex()) //.replaceActiveBlockParser() ; } } return BlockStart.none(); } }
@Override public BlockStart tryStart(ParserState state, MatchedBlockParser matchedBlockParser) { if (state.getIndent() >= 4) { return BlockStart.none(); } BasedSequence line = state.getLine(); int nextNonSpace = state.getNextNonSpaceIndex(); BasedSequence trySequence = line.subSequence(nextNonSpace, line.length()); Matcher matcher = myParsing.TOC_BLOCK_START.matcher(line); if (matcher.matches()) { BasedSequence tocChars = state.getLineWithEOL(); BasedSequence styleChars = null; BasedSequence titleChars = null; if (matcher.start(1) != -1) { styleChars = trySequence.subSequence(matcher.start(1), matcher.end(1)); } if (matcher.start(2) != -1) { titleChars = trySequence.subSequence(matcher.start(2), matcher.end(2)); } SimTocBlockParser simTocBlockParser = new SimTocBlockParser(state.getProperties(), tocChars, styleChars, titleChars); return BlockStart.of(simTocBlockParser) .atIndex(state.getLineEndIndex() + state.getLineEolLength()) //.replaceActiveBlockParser() ; } return none(); } }
@Override public BlockStart tryStart(ParserState state, MatchedBlockParser matchedBlockParser) { BasedSequence line = state.getLine(); int currentIndent = state.getIndent(); if (currentIndent == 0 && !(matchedBlockParser.getBlockParser().getBlock() instanceof Paragraph)) { final BasedSequence tryLine = line.subSequence(state.getIndex()); Matcher matcher = parsing.MACRO_OPEN.matcher(tryLine); if (matcher.find()) { // see if it closes on the same line, then we create a block and close it BasedSequence tag = tryLine.subSequence(0, matcher.end()); BasedSequence tagName = line.subSequence(matcher.start(1), matcher.end(1)); BasedSequence parameters = tryLine.subSequence(matcher.end(1), matcher.end() - 2).trim(); JekyllTag tagNode = new JekyllTag(tag.subSequence(0, 2), tagName, parameters, tag.endSequence(2)); tagNode.setCharsFromContent(); final JekyllTagBlockParser parser = new JekyllTagBlockParser(state.getProperties()); parser.block.appendChild(tagNode); //noinspection EqualsBetweenInconvertibleTypes if (!listIncludesOnly || tagName.equals(INCLUDE_TAG)) { List<JekyllTag> tagList = JekyllTagExtension.TAG_LIST.getFrom(state.getProperties()); tagList.add(tagNode); } return BlockStart.of(parser) .atIndex(state.getLineEndIndex()) ; } } return BlockStart.none(); } }
@Override public BlockContinue tryContinue(ParserState state) { if (hadClose) { return BlockContinue.none(); } final int index = state.getIndex(); BasedSequence line = state.getLineWithEOL(); final Matcher matcher = MACRO_BLOCK_END.matcher(line); if (!matcher.matches()) { return BlockContinue.atIndex(index); } else { // if have open gitlab block quote last child then let them handle it Node lastChild = block.getLastChild(); if (lastChild instanceof GitLabBlockQuote) { //final BlockParser parser = state.getActiveBlockParser((Block) lastChild); if (((GitLabBlockQuote) lastChild).getClosingMarker().isEmpty()) { // let the child handle it return BlockContinue.atIndex(index); } } hadClose = true; block.setClosingMarker(state.getLine().subSequence(index, index + 3)); block.setClosingTrailing(state.getLineWithEOL().subSequence(matcher.start(1), matcher.end(1))); return BlockContinue.atIndex(state.getLineEndIndex()); } }
.atIndex(state.getLineEndIndex())
@Override public BlockContinue tryContinue(ParserState state) { if (hadClose) { return BlockContinue.none(); } final int index = state.getIndex(); BasedSequence line = state.getLineWithEOL(); final Matcher matcher = GIT_LAB_BLOCK_END.matcher(line.subSequence(index)); if (!matcher.matches()) { return BlockContinue.atIndex(index); } else { // if have open gitlab block quote last child then let them handle it Node lastChild = block.getLastChild(); if (lastChild instanceof GitLabBlockQuote) { final BlockParser parser = state.getActiveBlockParser((Block) lastChild); if (parser instanceof GitLabBlockQuoteParser && !((GitLabBlockQuoteParser) parser).hadClose) { // let the child handle it return BlockContinue.atIndex(index); } } hadClose = true; block.setClosingMarker(state.getLine().subSequence(index, index + 3)); block.setClosingTrailing(state.getLineWithEOL().subSequence(matcher.start(1), matcher.end(1))); return BlockContinue.atIndex(state.getLineEndIndex()); } }
@Override public BlockStart tryStart(ParserState state, MatchedBlockParser matchedBlockParser) { if (state.getIndent() >= 4) { return BlockStart.none(); } BasedSequence line = state.getLine(); int nextNonSpace = state.getNextNonSpaceIndex(); BasedSequence trySequence = line.subSequence(nextNonSpace, line.length()); Matcher matcher = myParsing.TOC_BLOCK_START.matcher(line); if (matcher.matches()) { BasedSequence tocChars = state.getLineWithEOL(); BasedSequence styleChars = null; BasedSequence titleChars = null; if (matcher.start(1) != -1) { styleChars = trySequence.subSequence(matcher.start(1), matcher.end(1)); } if (matcher.start(2) != -1) { titleChars = trySequence.subSequence(matcher.start(2), matcher.end(2)); } SimTocBlockParser simTocBlockParser = new SimTocBlockParser(state.getProperties(), tocChars, styleChars, titleChars); return BlockStart.of(simTocBlockParser) .atIndex(state.getLineEndIndex() + state.getLineEolLength()) //.replaceActiveBlockParser() ; } return none(); } }
@Override public BlockStart tryStart(ParserState state, MatchedBlockParser matchedBlockParser) { BasedSequence line = state.getLine(); int currentIndent = state.getIndent(); if (currentIndent == 0 && !(matchedBlockParser.getBlockParser().getBlock() instanceof Paragraph)) { final BasedSequence tryLine = line.subSequence(state.getIndex()); Matcher matcher = parsing.MACRO_OPEN.matcher(tryLine); if (matcher.find()) { // see if it closes on the same line, then we create a block and close it BasedSequence tag = tryLine.subSequence(0, matcher.end()); BasedSequence tagName = line.subSequence(matcher.start(1), matcher.end(1)); BasedSequence parameters = tryLine.subSequence(matcher.end(1), matcher.end() - 2).trim(); JekyllTag tagNode = new JekyllTag(tag.subSequence(0, 2), tagName, parameters, tag.endSequence(2)); tagNode.setCharsFromContent(); final JekyllTagBlockParser parser = new JekyllTagBlockParser(state.getProperties()); parser.block.appendChild(tagNode); //noinspection EqualsBetweenInconvertibleTypes if (!listIncludesOnly || tagName.equals(INCLUDE_TAG)) { List<JekyllTag> tagList = JekyllTagExtension.TAG_LIST.getFrom(state.getProperties()); tagList.add(tagNode); } return BlockStart.of(parser) .atIndex(state.getLineEndIndex()) ; } } return BlockStart.none(); } }