Class TaskDescriptionText
java.lang.Object
io.meeds.task.mcp.util.TaskDescriptionText
The description of a task as the plain text a compact list item carries:
the stored HTML read as text, one line per block, without resolving its
links or mentions, and cut to a bounded length.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe most characters a compact list item carries of a task's description; a longer one is cut at the last word or line boundary before it. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringCuts a text toMAX_LENGTHcharacters at most: at the last whitespace (a line break or a space) at or before that length, so that no word is cut, or, for a text without any, at that length, never between the two halves of a surrogate pair.static StringtoPlainText(String html) Reads an HTML description as plain text: the entities decoded, the tags removed, the text of a link or a mention kept as written, a line break after each block element (paragraph, list item, heading, table row…) and each<br>, the spaces of each line collapsed, and the blank lines dropped.
-
Field Details
-
MAX_LENGTH
public static final int MAX_LENGTHThe most characters a compact list item carries of a task's description; a longer one is cut at the last word or line boundary before it.- See Also:
-
-
Method Details
-
toPlainText
Reads an HTML description as plain text: the entities decoded, the tags removed, the text of a link or a mention kept as written, a line break after each block element (paragraph, list item, heading, table row…) and each<br>, the spaces of each line collapsed, and the blank lines dropped.- Parameters:
html- a description, possibly null or blank- Returns:
- its plain text, null when it holds no text
-
cut
Cuts a text toMAX_LENGTHcharacters at most: at the last whitespace (a line break or a space) at or before that length, so that no word is cut, or, for a text without any, at that length, never between the two halves of a surrogate pair. A text that fits is returned as is.- Parameters:
text- a text, possibly null- Returns:
- the text, cut when longer than
MAX_LENGTH
-