hi-lite 0.0.0 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. data/README.rdoc +1 -15
  2. data/VERSION +1 -1
  3. data/hi-lite.gemspec +2 -2
  4. data/lib/hi-lite.rb +16 -0
  5. metadata +2 -2
@@ -1,17 +1,3 @@
1
1
  = hi-lite
2
2
 
3
- Description goes here.
4
-
5
- == Note on Patches/Pull Requests
6
-
7
- * Fork the project.
8
- * Make your feature addition or bug fix.
9
- * Add tests for it. This is important so I don't break it in a
10
- future version unintentionally.
11
- * Commit, do not mess with rakefile, version, or history.
12
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
- * Send me a pull request. Bonus points for topic branches.
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2009 Pavel Pravosud. See LICENSE for details.
3
+ Simplimistic libriary for highlighting source code with Textmate styles.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 0.0.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{hi-lite}
8
- s.version = "0.0.0"
8
+ s.version = "0.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Pavel Pravosud"]
12
- s.date = %q{2009-12-17}
12
+ s.date = %q{2009-12-29}
13
13
  s.description = %q{Textmate-like source code highlighting}
14
14
  s.email = %q{rwz@duckroll.ru}
15
15
  s.extra_rdoc_files = [
@@ -23,8 +23,24 @@ module HiLite
23
23
  Uv.syntaxes
24
24
  end
25
25
 
26
+ def nice_lang_list
27
+ lang_list.inject(Hash.new) { |langs, s| langs.merge!({ s => nicer(s) }) }
28
+ end
29
+
26
30
  private
27
31
 
32
+ LANGS_REGISTER = %w(CSS HTML XML CSV PHP XHTML JSON IO ActionScript SSH SQL ML lighttpd ASP ASP.NET VB.NET jQuery man GreaseMonkey)
33
+
34
+ def nicer(lang)
35
+ result = lang.dup
36
+ result.gsub!(/[_-]+/, " ")
37
+ register = LANGS_REGISTER.map{ |s| s.downcase }
38
+ result = result.downcase.split.map{ |s| register.include?(s) ? LANGS_REGISTER[register.index(s)] : s.capitalize }.join(" ")
39
+ result.gsub!(/script/i, "Script")
40
+ result.gsub!(/wiki/i, "Wiki")
41
+ result
42
+ end
43
+
28
44
  def parse(code, opts)
29
45
  Parser.parse(code, opts)
30
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hi-lite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Pravosud
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-17 00:00:00 +03:00
12
+ date: 2009-12-29 00:00:00 +03:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency