commandbox.system.util

Class Formatter

lucee.Component
    extended by commandbox.system.util.Formatter

Copyright Since 2014 CommandBox by Ortus Solutions, Corp www.coldbox.org | www.ortussolutions.com Utilities for dealing with formmating HTML and ANSI output

Class Attributes:
  • singleton
  •  
  • synchronized : false
  •  
  • accessors : false
  •  
  • persistent : false
  •  
  • author : Brad Wood, Luis Majano, Denny Valliant
  •  
    Property Summary
    type property default serializable required
    any JSONPrettyPrint


    • access = public
    • returntype = any
    • inject = provider:JSONPrettyPrint
    true false
    any configService


    • access = public
    • returntype = any
    • inject = ConfigService
    true false
    any print


    • access = public
    • returntype = any
    • inject = print
    true false
    any shell


    • access = public
    • returntype = any
    • inject = shell
    true false
    Constructor Summary
    init()
          Constructor.
    Method Summary
    any HTML2ANSI(any html, [any additionalFormatting=''])
         Converts HTML into ANSI text.
    any MD2ANSI(any markdown, [any additionalFormatting=''])
         Converts markdown into ANSI text.
    any ansifyHTML([any text], [any tag], [any ansiCode], [any additionalFormatting])
         Converts HTML matches into ANSI text.
    any formatJson([any json], [string indent], [string lineEnding], [boolean spaceAfterColon], [string sortKeys], [struct ansiColors])
         Pretty JSON.
    any slugify(any str, [numeric maxLength='0'], [any allow=''])
         Create a URL safe slug from a string.
    any unescapeHTML(any html)
         Converts HTML into plain text.
     
    Methods inherited from class lucee.Component
    None

    Constructor Detail

    init

    public init()

    Constructor


    Property Detail

    JSONPrettyPrint

    property any JSONPrettyPrint

    Attributes:
    access - public
    required - false
    returntype - any
    inject - provider:JSONPrettyPrint
    serializable - true

    configService

    property any configService

    Attributes:
    access - public
    required - false
    returntype - any
    inject - ConfigService
    serializable - true

    print

    property any print

    Attributes:
    access - public
    required - false
    returntype - any
    inject - print
    serializable - true

    shell

    property any shell

    Attributes:
    access - public
    required - false
    returntype - any
    inject - shell
    serializable - true

    Method Detail

    HTML2ANSI

    public any HTML2ANSI(any html, [any additionalFormatting=''])

    Converts HTML into ANSI text

    Parameters:
    html - HTML to convert
    additionalFormatting

    MD2ANSI

    public any MD2ANSI(any markdown, [any additionalFormatting=''])

    Converts markdown into ANSI text

    Parameters:
    markdown - Text to convert
    additionalFormatting

    ansifyHTML

    public any ansifyHTML([any text], [any tag], [any ansiCode], [any additionalFormatting])

    Converts HTML matches into ANSI text

    Parameters:
    text - HTML to convert
    tag - HTML tag name to replace
    ansiCode - ANSI code to replace tag with
    additionalFormatting

    formatJson

    public any formatJson([any json], [string indent], [string lineEnding], [boolean spaceAfterColon], [string sortKeys], [struct ansiColors])

    Pretty JSON

    Parameters:
    json - A string containing JSON, or a complex value that can be serialized to JSON
    indent
    lineEnding
    spaceAfterColon
    sortKeys
    ansiColors

    slugify

    public any slugify(any str, [numeric maxLength='0'], [any allow=''])

    Create a URL safe slug from a string

    Parameters:
    str - The string to slugify
    maxLength - The maximum number of characters for the slug
    allow - A regex safe list of additional characters to allow

    unescapeHTML

    public any unescapeHTML(any html)

    Converts HTML into plain text

    Parameters:
    html - HTML to convert