Class WikiText.IndentedItem

java.lang.Object
org.getalp.dbnary.wiki.WikiText.Token
org.getalp.dbnary.wiki.WikiText.IndentedItem
All Implemented Interfaces:
Visitable
Direct Known Subclasses:
WikiText.Indentation, WikiText.Item, WikiText.ListItem, WikiText.NumberedListItem
Enclosing class:
WikiText

public abstract class WikiText.IndentedItem extends WikiText.Token
Represents an abstract base for list items or elements that are indented, such as numbered or bulleted list items in a MediaWiki content structure. Each indented item is associated with a content body and a prefix that determines the level of indentation.
  • Field Details

  • Constructor Details

    • IndentedItem

      protected IndentedItem(int position, String listPrefix)
  • Method Details

    • setEndOffset

      protected void setEndOffset(int position)
      Overrides:
      setEndOffset in class WikiText.Token
    • fillText

      public void fillText(StringBuilder r)
      Specified by:
      fillText in class WikiText.Token
    • addToken

      protected void addToken(WikiText.Token t)
      Specified by:
      addToken in class WikiText.Token
    • getContent

      public WikiText.WikiContent getContent()
    • getLevel

      public int getLevel()
      returns the level of indentation of the item. The level corresponds to the level of the main list kind. e.g.: a list starting with '**#::' is a ListItem with level 2.
      Returns:
      the level of indentation
    • getListPrefix

      public String getListPrefix()
      returns the prefix of the list item.
      Returns:
      the prefix of the list item
    • asIndentedItem

      public WikiText.IndentedItem asIndentedItem()
      Overrides:
      asIndentedItem in class WikiText.Token
    • normalizePrefix

      protected void normalizePrefix()
      As prefixes may be stacked (e.g. '#::*'), we extend the prefix to encompass all different kind of indentation and separate it from the content.