isaac-formatting 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +19 -0
- data/README.mkd +46 -0
- data/lib/isaac-formatting.rb +56 -0
- metadata +57 -0
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2009 Danny Tatom
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.mkd
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# isaac-formatting
|
2
|
+
|
3
|
+
Formatting for your [isaac](http://github.com/ichverstehe/isaac)-powered IRC bots.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
If you already have gemcutter as a source, it's as easy as:
|
8
|
+
|
9
|
+
sudo gem install isaac-formatting
|
10
|
+
|
11
|
+
Otherwise, you'll need to install by source
|
12
|
+
|
13
|
+
gem-install isaac-formatting --source http://gemcutter.org
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
The following formatting options are available:
|
18
|
+
|
19
|
+
* plain
|
20
|
+
* bold
|
21
|
+
* italic
|
22
|
+
* underline
|
23
|
+
* colors
|
24
|
+
|
25
|
+
### Example
|
26
|
+
|
27
|
+
require 'isaac'
|
28
|
+
require 'isaac-formatting'
|
29
|
+
|
30
|
+
configure do |c|
|
31
|
+
c.nick = 'OHYEAHCOLORS'
|
32
|
+
c.server = 'irc.freenode.net'
|
33
|
+
c.port = 6667
|
34
|
+
end
|
35
|
+
|
36
|
+
on :connect do
|
37
|
+
join '#welovecolors'
|
38
|
+
end
|
39
|
+
|
40
|
+
on :channel do
|
41
|
+
msg channel, "#{nick} said #{color(:blue)} #{message} #{bold} IN COLOR #{plain} #{stop_color}"
|
42
|
+
end
|
43
|
+
|
44
|
+
## Copyright
|
45
|
+
|
46
|
+
Copyright (c) 2009 Danny Tatom. See LICENSE for details.
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Isaac
|
2
|
+
class Formatting
|
3
|
+
# Formatting for your isaac-powered IRC bots.
|
4
|
+
#
|
5
|
+
# At the moment this only works with mIRC's formatting system,
|
6
|
+
# though other clients like Irsii use it as well.
|
7
|
+
#
|
8
|
+
# A quick note, this was highly inspired/ripped from libs/formatting.rb
|
9
|
+
# in RISCfuture's autumn.
|
10
|
+
#
|
11
|
+
# Usage:
|
12
|
+
# msg channel, "Hey guys, this is #{bold}bold text#{plain}!"
|
13
|
+
# msg channel, "Oh yeah, and this is #{color(:blue)}blue text#{stop_color}!"
|
14
|
+
helpers do
|
15
|
+
# All text after this will go unformatted
|
16
|
+
PLAIN = 15.chr
|
17
|
+
# All text after this will be bold
|
18
|
+
BOLD = 2.chr
|
19
|
+
# All text after this will be italicized
|
20
|
+
ITALIC = 22.chr
|
21
|
+
# All text after this will be underlined
|
22
|
+
UNDERLINE = 31.chr
|
23
|
+
|
24
|
+
def plain; PLAIN; end
|
25
|
+
def bold; BOLD; end
|
26
|
+
def italic; ITALIC; end
|
27
|
+
def underline; UNDERLINE; end
|
28
|
+
|
29
|
+
# This begins the colorizing of text
|
30
|
+
START_COLOR = 3.chr
|
31
|
+
# And this stops it
|
32
|
+
STOP_COLOR = START_COLOR
|
33
|
+
|
34
|
+
# Massive amounts of colors goin' on 'round these parts
|
35
|
+
COLORS = { :white => '00', :black => '01', :dark_blue => '02',
|
36
|
+
:navy_blue => '02', :dark_green => '03', :red => '04',
|
37
|
+
:brown => '05', :dark_red => '05', :purple => '06',
|
38
|
+
:dark_yellow => '07', :olive => '07', :orange => '07',
|
39
|
+
:yellow => '08', :green => '09', :lime => '09',
|
40
|
+
:dark_cyan => '10', :teal => '10', :cyan => '11',
|
41
|
+
:blue => '12', :royal_blue => '12', :magenta => '13',
|
42
|
+
:pink => '13', :fuchsia => '13', :gray => '14',
|
43
|
+
:light_gray => '15', :silver => '15' }
|
44
|
+
|
45
|
+
# This line is ripped 100% from autumn!
|
46
|
+
def color foreground, background=nil
|
47
|
+
foreground = :black unless COLORS.include? foreground
|
48
|
+
background = :white unless background.nil? or COLORS.include? background
|
49
|
+
|
50
|
+
"#{START_COLOR}#{COLORS[foreground]}#{background ? (',' + COLORS[background]) : ''}"
|
51
|
+
end
|
52
|
+
|
53
|
+
def stop_color; STOP_COLOR; end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
metadata
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: isaac-formatting
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Danny Tatom
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-10-26 00:00:00 -05:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Formatting for your isaac-powered IRC bots.
|
17
|
+
email: dannytatom@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
|
+
files:
|
25
|
+
- README.mkd
|
26
|
+
- LICENSE
|
27
|
+
- lib/isaac-formatting.rb
|
28
|
+
has_rdoc: true
|
29
|
+
homepage: http://github.com/dannytatom/isaac-formatting
|
30
|
+
licenses: []
|
31
|
+
|
32
|
+
post_install_message:
|
33
|
+
rdoc_options: []
|
34
|
+
|
35
|
+
require_paths:
|
36
|
+
- lib
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: "0"
|
42
|
+
version:
|
43
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: "0"
|
48
|
+
version:
|
49
|
+
requirements: []
|
50
|
+
|
51
|
+
rubyforge_project:
|
52
|
+
rubygems_version: 1.3.5
|
53
|
+
signing_key:
|
54
|
+
specification_version: 3
|
55
|
+
summary: Formatting for your isaac-powered IRC bots.
|
56
|
+
test_files: []
|
57
|
+
|