Sha256: 359b932c6a5eff2fe4b774e0b3c32208c1fec86d2acb6e125a12830160208523

Contents?: true

Size: 669 Bytes

Versions: 20

Compression:

Stored size: 669 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

20 entries across 20 versions & 5 rubygems

Version Path
arcabouco-0.2.13 vendor/bundle/gems/ansi-1.4.3/demo/10_bbcode.rdoc
challah-1.0.0 vendor/bundle/gems/ansi-1.4.3/demo/10_bbcode.rdoc
swipe-rails-0.0.5 vendor/bundle/gems/ansi-1.4.3/demo/10_bbcode.rdoc
challah-1.0.0.beta3 vendor/bundle/gems/ansi-1.4.3/demo/10_bbcode.rdoc
challah-1.0.0.beta2 vendor/bundle/gems/ansi-1.4.3/demo/10_bbcode.rdoc
challah-1.0.0.beta vendor/bundle/gems/ansi-1.4.3/demo/10_bbcode.rdoc
challah-0.9.1.beta.3 vendor/bundle/gems/ansi-1.4.3/demo/10_bbcode.rdoc
challah-0.9.1.beta vendor/bundle/gems/ansi-1.4.3/demo/10_bbcode.rdoc
challah-0.9.0 vendor/bundle/gems/ansi-1.4.3/demo/10_bbcode.rdoc
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/ansi-1.4.3/demo/10_bbcode.rdoc
challah-0.8.3 vendor/bundle/gems/ansi-1.4.3/demo/10_bbcode.rdoc
ansi-1.4.3 demo/10_bbcode.rdoc
challah-0.6.1 vendor/bundle/gems/ansi-1.4.2/qed/10_bbcode.rdoc
challah-0.6.0 vendor/bundle/gems/ansi-1.4.2/qed/10_bbcode.rdoc
ansi-1.4.2 qed/10_bbcode.rdoc
ansi-1.4.1 qed/02_bbcode.rdoc
ansi-1.4.0 qed/02_bbcode.rdoc
ansi-1.3.0 qed/02_bbcode.rdoc
ansi-1.2.5 qed/02_bbcode.rdoc
ansi-1.2.4 qed/02_bbcode.rdoc