Class StrikethroughDelimiterProcessor

java.lang.Object
com.vladsch.flexmark.ext.gfm.strikethrough.internal.StrikethroughDelimiterProcessor
All Implemented Interfaces:
DelimiterProcessor

public class StrikethroughDelimiterProcessor extends Object implements DelimiterProcessor
  • Constructor Details

    • StrikethroughDelimiterProcessor

      public StrikethroughDelimiterProcessor()
  • Method Details

    • getOpeningCharacter

      public char getOpeningCharacter()
      Specified by:
      getOpeningCharacter in interface DelimiterProcessor
      Returns:
      the character that marks the beginning of a delimited node, must not clash with any built-in special characters
    • getClosingCharacter

      public char getClosingCharacter()
      Specified by:
      getClosingCharacter in interface DelimiterProcessor
      Returns:
      the character that marks the the ending of a delimited node, must not clash with any built-in special characters. Note that for a symmetric delimiter such as "*", this is the same as the opening.
    • getMinLength

      public int getMinLength()
      Specified by:
      getMinLength in interface DelimiterProcessor
      Returns:
      Minimum number of delimiter characters that are needed to activate this. Must be at least 1.
    • canBeOpener

      public boolean canBeOpener(String before, String after, boolean leftFlanking, boolean rightFlanking, boolean beforeIsPunctuation, boolean afterIsPunctuation, boolean beforeIsWhitespace, boolean afterIsWhiteSpace)
      Description copied from interface: DelimiterProcessor
      Decide whether this delimiter can be an open delimiter
      Specified by:
      canBeOpener in interface DelimiterProcessor
      Parameters:
      before - string before delimiter or '\n' if none
      after - string after delimiter or '\n' if none
      leftFlanking - is left flanking delimiter
      rightFlanking - is right flanking delimiter
      beforeIsPunctuation - is punctuation before
      afterIsPunctuation - is punctuation after
      beforeIsWhitespace - is whitespace before
      afterIsWhiteSpace - is whitespace after
      Returns:
      true if can be open delimiter
    • canBeCloser

      public boolean canBeCloser(String before, String after, boolean leftFlanking, boolean rightFlanking, boolean beforeIsPunctuation, boolean afterIsPunctuation, boolean beforeIsWhitespace, boolean afterIsWhiteSpace)
      Description copied from interface: DelimiterProcessor
      Decide whether this delimiter can be a close delimiter
      Specified by:
      canBeCloser in interface DelimiterProcessor
      Parameters:
      before - string before delimiter or '\n' if none
      after - string after delimiter or '\n' if none
      leftFlanking - is left flanking delimiter
      rightFlanking - is right flanking delimiter
      beforeIsPunctuation - is punctuation before
      afterIsPunctuation - is punctuation after
      beforeIsWhitespace - is whitespace before
      afterIsWhiteSpace - is whitespace after
      Returns:
      true if can be open delimiter
    • unmatchedDelimiterNode

      public Node unmatchedDelimiterNode(InlineParser inlineParser, DelimiterRun delimiter)
      Description copied from interface: DelimiterProcessor
      Allow delimiter processor to substitute unmatched delimiters by custom nodes
      Specified by:
      unmatchedDelimiterNode in interface DelimiterProcessor
      Parameters:
      inlineParser - inline parser instance
      delimiter - delimiter run that was not matched
      Returns:
      node to replace unmatched delimiter, null or delimiter.getNode() to replace with delimiter text
    • skipNonOpenerCloser

      public boolean skipNonOpenerCloser()
      Description copied from interface: DelimiterProcessor
      Whether to skip delimiters that cannot be openers or closers
      Specified by:
      skipNonOpenerCloser in interface DelimiterProcessor
      Returns:
      true if to skip
    • getDelimiterUse

      public int getDelimiterUse(DelimiterRun opener, DelimiterRun closer)
      Description copied from interface: DelimiterProcessor
      Determine how many (if any) of the delimiter characters should be used.

      This allows implementations to decide how many characters to use based on the properties of the delimiter runs. An implementation can also return 0 when it doesn't want to allow this particular combination of delimiter runs.

      Specified by:
      getDelimiterUse in interface DelimiterProcessor
      Parameters:
      opener - the opening delimiter run
      closer - the closing delimiter run
      Returns:
      how many delimiters should be used; must not be greater than length of either opener or closer
    • process

      public void process(Delimiter opener, Delimiter closer, int delimitersUsed)
      Description copied from interface: DelimiterProcessor
      Process the matched delimiters, e.g. by wrapping the nodes between opener and closer in a new node, or appending a new node after the opener.

      Note that removal of the delimiter from the delimiter nodes and unlinking them is done by the caller.

      Specified by:
      process in interface DelimiterProcessor
      Parameters:
      opener - the delimiter with text node that contained the opening delimiter
      closer - the delimiter with text node that contained the closing delimiter
      delimitersUsed - the number of delimiters that were used