public boolean isEmpty() { for (BasedSequence s : segments) { if (!s.isEmpty()) return false; } return true; }
private void mergeList() { if (!remainingChars.isEmpty()) { list.add(new Text(remainingChars)); remainingChars = BasedSequence.NULL; } }
@Override public MacroDefinitionBlock getReferenceNode(final MacroDefinitionRepository repository) { if (myMacroDefinitionBlock != null || text.isEmpty()) return myMacroDefinitionBlock; myMacroDefinitionBlock = getMacroDefinitionBlock(repository); return myMacroDefinitionBlock; }
@Override public FootnoteBlock getReferenceNode(final FootnoteRepository repository) { if (footnoteBlock != null || text.isEmpty()) return footnoteBlock; footnoteBlock = getFootnoteBlock(repository); return footnoteBlock; }
@Override public EnumeratedReferenceBlock getReferenceNode(final EnumeratedReferenceRepository repository) { if (enumeratedReferenceBlock != null || text.isEmpty()) return enumeratedReferenceBlock; enumeratedReferenceBlock = getEnumeratedReferenceBlock(repository); return enumeratedReferenceBlock; }
@Override public void getAstExtra(StringBuilder out) { if (!getChars().isEmpty()) out.append(" \"").append(getChars()).append("\""); }
@Override public MacroDefinitionBlock getReferenceNode(final Document document) { if (myMacroDefinitionBlock != null || text.isEmpty()) return myMacroDefinitionBlock; myMacroDefinitionBlock = getMacroDefinitionBlock(document.get(MacrosExtension.MACRO_DEFINITIONS)); return myMacroDefinitionBlock; }
@Override public Integer compute(BasedSequence option) { try { return option.isEmpty() ? null : Integer.parseInt(option.toString()); } catch (Exception ignored) { parserParams.add(new ParserMessage(option, ParsedOptionStatus.ERROR, finalProvider.message(KEY_OPTION_0_VALUE_1_NOT_INTEGER, OPTION_0_VALUE_1_NOT_INTEGER, myOptionName, option))); parserParams.skip = true; return null; } } };
public void add(BasedSequence nodeChars) { if (!nodeChars.isEmpty()) { add(new Text(nodeChars)); } }
@Override public FootnoteBlock getReferenceNode(final Document document) { if (footnoteBlock != null || text.isEmpty()) return footnoteBlock; footnoteBlock = getFootnoteBlock(document.get(FootnoteExtension.FOOTNOTES)); return footnoteBlock; }
public int getEndOffset() { return !closeMarker.isEmpty() ? closeMarker.getEndOffset() : text.getEndOffset(); }
private void beforePre() throws IOException { while (myPendingEOL > 0) { myAppendable.append('\n'); updateLastEolOffset(); myLineCount++; if (myPendingPreFormattedPrefix && !myPrefix.isEmpty()) { myAppendable.append(myPrefix); } myPendingEOL--; } myPendingPreFormattedPrefix = false; }
private void render(JekyllTag node, NodeRendererContext context, HtmlWriter html) { if (enabledRendering) html.text(node.getChars()); else if (node.getTag().equals("include") && includeContent != null && !node.getParameters().isEmpty()) { String content = includeContent.get(node.getParameters()); if (content != null && !content.isEmpty()) { html.rawPre(content); } } }
public int length() { int total = 0; BasedSequence last = null; for (BasedSequence s : segments) { if (s.isEmpty()) continue; if (last != null && last.getEndOffset() < s.getStartOffset() && (BasedSequence.WHITESPACE_CHARS.indexOf(last.charAt(last.length() - 1)) == -1) && BasedSequence.WHITESPACE_CHARS.indexOf(s.charAt(0)) == -1) { total++; } total++; last = s; } return total; }
@SuppressWarnings("unchecked") @Override public Pair<T, List<ParsedOption<T>>> parseOption(BasedSequence optionText, T options, MessageProvider provider) { if (optionText.isEmpty()) { return new Pair<T, List<ParsedOption<T>>>(setOptions(options), (List<ParsedOption<T>>)Collections.<ParsedOption<T>>singletonList(new ParsedOption(optionText, this, ParsedOptionStatus.VALID))); } else { if (provider == null) provider = MessageProvider.DEFAULT; String message = provider.message(KEY_OPTION_0_PARAMETERS_1_IGNORED, OPTION_0_PARAMETERS_1_IGNORED, myOptionName, optionText); return new Pair<T, List<ParsedOption<T>>>(setOptions(options), (List<ParsedOption<T>>)Collections.<ParsedOption<T>>singletonList(new ParsedOption(optionText, this, ParsedOptionStatus.IGNORED, Collections.singletonList(new ParserMessage(optionText, ParsedOptionStatus.IGNORED, message))))); } }
@Override public BasedSequence spliceAtEnd(BasedSequence other) { if (other.isEmpty()) { return this; } else if (isEmpty()) { return other; } assert isContinuedBy(other) : "sequence[" + getStartOffset() + ", " + getEndOffset() + "] is not continued by other[" + other.getStartOffset() + ", " + other.getEndOffset() + "]"; return baseSubSequence(getStartOffset(), other.getEndOffset()); }
private void visit(final TableCell node) { BasedSequence text = node.getText(); if (options.trimCellWhitespace) { if (text.isBlank() && !text.isEmpty()) { text = text.subSequence(0, 1); } else { text = text.trim(); } } myTable.addCell(new com.vladsch.flexmark.util.format.TableCell(node.getOpeningMarker(), text, node.getClosingMarker(), 1, node.getSpan(), node.getAlignment() == null ? CellAlignment.NONE : node.getAlignment().cellAlignment())); } }