mircparser v0.1.0 MircParser

Parse mIRC colour codes and render to HTML.

The characters used for each kind of formatting are:

  • "x01": Bold. Represented with <b>.
  • "x1D": Italic. Represented with <i>.
  • "x1F": Underline. Represented with <u>.
  • "x16": Reverse text. Represented with a span of class reverse.
  • "x0F": Strips all formatting.
  • "x03": Sets the foreground colour. This is represented with a san of class fg<int>.
  • "x03,": Sets the foreground and background colour. This is represented with a span of classes fg<int> bg<int>.
  • "x03": Terminates colouring.

The colour codes are:

  • 0: White (#FFFFFF)
  • 1: Black (#000000)
  • 2: Navy (#00007F)
  • 3: Green (#009300)
  • 4: Red (#FF0000)
  • 5: Maroon (#7F0000)
  • 6: Purple (#9C009C)
  • 7: Orange (#FC7F00)
  • 8: Yellow (#FFFF00)
  • 9: Light Green (#00FC00)
  • 10: Teal (#009393)
  • 11: Cyan (#00FFFF)
  • 12: Blue (#0000FC)
  • 13: Pink (#FF00FF)
  • 14: Grey (#7F7F7F)
  • 15: Light Grey (#D2D2D2)

Link to this section Summary

Functions

Converts a string of mIRC formatted text into tokens.

Turns a list of tokens into an HTML string.

Link to this section Functions

Converts a string of mIRC formatted text into tokens.

Examples

iex> MircParser.parse("plain\x1Ditalic")
["plain", :italic, "italic"]

Turns a list of tokens into an HTML string.

Examples

iex> MircParser.render(["foo", :bold, "bar"])
"foo<b>bar</b>"