app/src/main/java/org/andstatus/app/util/MyHtml.java
/** Following ActivityStreams convention, default mediaType for content is "text/html" */
Following ActivityStreams convention, default mediaType for content is "text/html"
Following ActivityStreams convention default mediaType for content is " text / html "
@NonNull
    public static String toContentStored(String text, TextMediaType inputMediaType, boolean isHtmlContentAllowed) {
        if (StringUtil.isEmpty(text)) return "";
        TextMediaType mediaType = inputMediaType == TextMediaType.UNKNOWN
                ? calcTextMediaType(text)
                : inputMediaType;
        String escaped;
        switch (mediaType) {
            case HTML:
                if (isHtmlContentAllowed) return text;
                escaped = Html.fromHtml(text, Html.FROM_HTML_MODE_COMPACT).toString();
                break;
            case PLAIN:
                escaped = escapeHtmlExceptLineBreaksAndSpace(text);
                break;
            case PLAIN_ESCAPED:
                escaped = (isHtmlContentAllowed || !hasHtmlMarkup(text))
                        ? text
                        : escapeHtmlExceptLineBreaksAndSpace(text);
                break;
            default:
                escaped = escapeHtmlExceptLineBreaksAndSpace(text);
                break;
        }
        String withLineBreaks = LINEBREAK_PATTERN.matcher(stripExcessiveLineBreaks(escaped)).replaceAll(LINEBREAK_HTML);
        return withLineBreaks;
    }
@ NonNull public static String toContentStored ( String text , TextMediaType inputMediaType , boolean isHtmlContentAllowed ) { if ( StringUtil . isEmpty ( text ) ) return "" ; TextMediaType mediaType = inputMediaType == TextMediaType . UNKNOWN ? calcTextMediaType ( text ) : inputMediaType ; String escaped ; switch ( mediaType ) { case HTML : if ( isHtmlContentAllowed ) return text ; escaped = Html . fromHtml ( text , Html . FROM_HTML_MODE_COMPACT ) . toString ( ) ; break ; case PLAIN : escaped = escapeHtmlExceptLineBreaksAndSpace ( text ) ; break ; case PLAIN_ESCAPED : escaped = ( isHtmlContentAllowed || ! hasHtmlMarkup ( text ) ) ? text : escapeHtmlExceptLineBreaksAndSpace ( text ) ; break ; default : escaped = escapeHtmlExceptLineBreaksAndSpace ( text ) ; break ; } String withLineBreaks = LINEBREAK_PATTERN . matcher ( stripExcessiveLineBreaks ( escaped ) ) . replaceAll ( LINEBREAK_HTML ) ; return withLineBreaks ; }
Following ActivityStreams convention, default mediaType for content is "text/html"
Following ActivityStreams convention default mediaType for content is " text / html "
// Maybe htmlify...