Sha256: d3ea3a1e1c5ba21696bf8d0747ced9eda54cc2741010156e2fa6f3436eaf3325

Contents?: true

Size: 681 Bytes

Versions: 83

Compression:

Stored size: 681 Bytes

Contents

# ANSI::BBCode

The BBCode module provides methods for converting between
BBCodes, basic HTML and ANSI codes.

    require 'ansi/bbcode'

BBCodes are color and style codes in square brackets, quite
popular with on line forums.

    bbcode = "this is [COLOR=red]red[/COLOR], this is [B]bold[/B]"

We can convert this to ANSI code simply enough:

    ansi = ANSI::BBCode.bbcode_to_ansi(bbcode)

    ansi.assert == "this is \e[0;31mred\e[0m, this is \e[1mbold\e[0m\n"

In addition the BBCode module supports conversion to simple HTML.

    html = ANSI::BBCode.bbcode_to_html(bbcode)

    html.assert == "this is <font color=\"red\">red</font>, this is <strong>bold</strong><br />\n"

Version data entries

83 entries across 41 versions & 13 rubygems

Version Path
op_connect-0.1.2 vendor/bundle/ruby/3.1.0/gems/ansi-1.5.0/demo/10_bbcode.md
paynow_sdk-1.1.0 vendor/bundle/ruby/2.7.0/gems/paynow_sdk-1.0.9/vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/10_bbcode.md
paynow_sdk-1.1.0 vendor/bundle/ruby/2.7.0/gems/paynow_sdk-1.0.9/vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/10_bbcode.md
paynow_sdk-1.1.0 vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/10_bbcode.md
paynow_sdk-1.1.0 vendor/bundle/ruby/2.7.0/gems/ansi-1.5.0/demo/10_bbcode.md
paynow_sdk-1.1.0 vendor/bundle/ruby/2.7.0/gems/paynow_sdk-1.0.9/vendor/bundle/ruby/2.7.0/gems/ansi-1.5.0/demo/10_bbcode.md
paynow_sdk-1.1.0 vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/10_bbcode.md
paynow_sdk-1.0.9 vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/10_bbcode.md
paynow_sdk-1.0.9 vendor/bundle/ruby/2.7.0/gems/ansi-1.5.0/demo/10_bbcode.md
paynow_sdk-1.0.9 vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/10_bbcode.md
paynow_sdk-1.0.8 vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/10_bbcode.md
paynow_sdk-1.0.8 vendor/bundle/ruby/2.7.0/gems/ansi-1.5.0/demo/10_bbcode.md
paynow_sdk-1.0.8 vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/10_bbcode.md
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/ansi-1.5.0/demo/10_bbcode.md
paynow_sdk-1.0.7 vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/10_bbcode.md
paynow_sdk-1.0.7 vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/10_bbcode.md
paynow_sdk-1.0.6 vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/10_bbcode.md
paynow_sdk-1.0.6 vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/10_bbcode.md
paynow_sdk-1.0.5 vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/10_bbcode.md
paynow_sdk-1.0.5 vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/10_bbcode.md