color-japanese 1.0.0
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.
- data/CHANGELOG.txt +3 -0
 - data/History.txt +3 -0
 - data/Manifest.txt +37 -0
 - data/README.txt +123 -0
 - data/Rakefile +123 -0
 - data/bin/jcolorc +119 -0
 - data/examples/Rakefile +57 -0
 - data/examples/color-test.html.in +57 -0
 - data/examples/color2html.rb +173 -0
 - data/examples/default.css.in +66 -0
 - data/examples/default.html +60 -0
 - data/examples/palletize.rb +58 -0
 - data/helper/helper.rb +3 -0
 - data/helper/rake.rb +58 -0
 - data/helper/rake_sh_filter.rb +23 -0
 - data/helper/util.rb +19 -0
 - data/lib/color/rgb/jp.rb +12 -0
 - data/lib/color/rgb/jp/base.rb +10 -0
 - data/lib/color/rgb/jp/base/color_name.rb +39 -0
 - data/lib/color/rgb/jp/base/encode.rb +23 -0
 - data/lib/color/rgb/jp/base/named_rgb.rb +15 -0
 - data/lib/color/rgb/jp/base/pallet.rb +49 -0
 - data/lib/color/rgb/jp/compiler/command.rb +102 -0
 - data/lib/color/rgb/jp/compiler/compiler.rb +203 -0
 - data/lib/color/rgb/jp/jisz8102.rb +547 -0
 - data/lib/color/rgb/jp/traditional.rb +943 -0
 - data/lib/color/rgb/jp/version.rb +11 -0
 - data/setup.rb +1585 -0
 - data/test/helper.rb +25 -0
 - data/test/test_color_name.rb +77 -0
 - data/test/test_compiler.rb +181 -0
 - data/test/test_encode.rb +42 -0
 - data/test/test_jisz8102.rb +39 -0
 - data/test/test_named_rgb.rb +25 -0
 - data/test/test_pallet.rb +78 -0
 - data/test/test_traditional.rb +39 -0
 - data/test/test_version.rb +19 -0
 - metadata +106 -0
 
    
        data/CHANGELOG.txt
    ADDED
    
    
    
        data/History.txt
    ADDED
    
    
    
        data/Manifest.txt
    ADDED
    
    | 
         @@ -0,0 +1,37 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            CHANGELOG.txt
         
     | 
| 
      
 2 
     | 
    
         
            +
            History.txt
         
     | 
| 
      
 3 
     | 
    
         
            +
            Manifest.txt
         
     | 
| 
      
 4 
     | 
    
         
            +
            README.txt
         
     | 
| 
      
 5 
     | 
    
         
            +
            Rakefile
         
     | 
| 
      
 6 
     | 
    
         
            +
            bin/jcolorc
         
     | 
| 
      
 7 
     | 
    
         
            +
            examples/Rakefile
         
     | 
| 
      
 8 
     | 
    
         
            +
            examples/color-test.html.in
         
     | 
| 
      
 9 
     | 
    
         
            +
            examples/color2html.rb
         
     | 
| 
      
 10 
     | 
    
         
            +
            examples/default.css.in
         
     | 
| 
      
 11 
     | 
    
         
            +
            examples/default.html
         
     | 
| 
      
 12 
     | 
    
         
            +
            examples/palletize.rb
         
     | 
| 
      
 13 
     | 
    
         
            +
            helper/helper.rb
         
     | 
| 
      
 14 
     | 
    
         
            +
            helper/rake.rb
         
     | 
| 
      
 15 
     | 
    
         
            +
            helper/rake_sh_filter.rb
         
     | 
| 
      
 16 
     | 
    
         
            +
            helper/util.rb
         
     | 
| 
      
 17 
     | 
    
         
            +
            lib/color/rgb/jp.rb
         
     | 
| 
      
 18 
     | 
    
         
            +
            lib/color/rgb/jp/base.rb
         
     | 
| 
      
 19 
     | 
    
         
            +
            lib/color/rgb/jp/base/color_name.rb
         
     | 
| 
      
 20 
     | 
    
         
            +
            lib/color/rgb/jp/base/encode.rb
         
     | 
| 
      
 21 
     | 
    
         
            +
            lib/color/rgb/jp/base/named_rgb.rb
         
     | 
| 
      
 22 
     | 
    
         
            +
            lib/color/rgb/jp/base/pallet.rb
         
     | 
| 
      
 23 
     | 
    
         
            +
            lib/color/rgb/jp/compiler/command.rb
         
     | 
| 
      
 24 
     | 
    
         
            +
            lib/color/rgb/jp/compiler/compiler.rb
         
     | 
| 
      
 25 
     | 
    
         
            +
            lib/color/rgb/jp/jisz8102.rb
         
     | 
| 
      
 26 
     | 
    
         
            +
            lib/color/rgb/jp/traditional.rb
         
     | 
| 
      
 27 
     | 
    
         
            +
            lib/color/rgb/jp/version.rb
         
     | 
| 
      
 28 
     | 
    
         
            +
            setup.rb
         
     | 
| 
      
 29 
     | 
    
         
            +
            test/helper.rb
         
     | 
| 
      
 30 
     | 
    
         
            +
            test/test_color_name.rb
         
     | 
| 
      
 31 
     | 
    
         
            +
            test/test_compiler.rb
         
     | 
| 
      
 32 
     | 
    
         
            +
            test/test_encode.rb
         
     | 
| 
      
 33 
     | 
    
         
            +
            test/test_jisz8102.rb
         
     | 
| 
      
 34 
     | 
    
         
            +
            test/test_named_rgb.rb
         
     | 
| 
      
 35 
     | 
    
         
            +
            test/test_pallet.rb
         
     | 
| 
      
 36 
     | 
    
         
            +
            test/test_traditional.rb
         
     | 
| 
      
 37 
     | 
    
         
            +
            test/test_version.rb
         
     | 
    
        data/README.txt
    ADDED
    
    | 
         @@ -0,0 +1,123 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            == color-japanese
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            === DESCRIPTION
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            color-japanese defines RGB value for Japanese color names.
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Supported color names are:
         
     | 
| 
      
 8 
     | 
    
         
            +
            * Japanese traditional colors
         
     | 
| 
      
 9 
     | 
    
         
            +
            * JIS Z 8102 (Names of non-luminous object colours)
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            === SYNOPSIS
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              require "rubygems"
         
     | 
| 
      
 15 
     | 
    
         
            +
              require "color/rgb/jp"
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              # way to get sakura-iro.
         
     | 
| 
      
 18 
     | 
    
         
            +
              # you can specify color name as kanji, hiragana, katakana and romaji (UTF-8).
         
     | 
| 
      
 19 
     | 
    
         
            +
              puts Color::RGB::JP::Traditional::Sakurairo
         
     | 
| 
      
 20 
     | 
    
         
            +
              puts Color::RGB::JP::Traditional["桜色"]
         
     | 
| 
      
 21 
     | 
    
         
            +
              puts Color::RGB::JP::Traditional["さくらいろ"]
         
     | 
| 
      
 22 
     | 
    
         
            +
              puts Color::RGB::JP::Traditional["サクライロ"]
         
     | 
| 
      
 23 
     | 
    
         
            +
              puts Color::RGB::JP::Traditional["sakura-iro"]
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
              # use other encoding.
         
     | 
| 
      
 26 
     | 
    
         
            +
              puts Color::RGB::JP::Traditional[sjis_string, "Shift_JIS"]
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
              # puts color names (UTF-8).
         
     | 
| 
      
 29 
     | 
    
         
            +
              c = Color::RGB::JP::Traditional["桜色"]  #=> #<Color::RGB::JP::NamedRGB:0xXXXXXXXX ...>
         
     | 
| 
      
 30 
     | 
    
         
            +
              puts c                 #=> "sakura-iro (#fef4f4)"
         
     | 
| 
      
 31 
     | 
    
         
            +
              puts c.name.kanji      #=> "桜色"
         
     | 
| 
      
 32 
     | 
    
         
            +
              puts c.name.hiragana   #=> "さくらいろ"
         
     | 
| 
      
 33 
     | 
    
         
            +
              puts c.name.katakana   #=> "サクライロ"
         
     | 
| 
      
 34 
     | 
    
         
            +
              puts c.name.romaji     #=> "sakura-iro"
         
     | 
| 
      
 35 
     | 
    
         
            +
              puts c.name.to_a       #=> ["桜色", "さくらいろ", "サクライロ", "sakura-iro"]
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
              # and Shift_JIS.
         
     | 
| 
      
 38 
     | 
    
         
            +
              puts c.name.kanji("Shift_JIS")
         
     | 
| 
      
 39 
     | 
    
         
            +
              puts c.name.hiragana("Shift_JIS")
         
     | 
| 
      
 40 
     | 
    
         
            +
              puts c.name.katakana("Shift_JIS")
         
     | 
| 
      
 41 
     | 
    
         
            +
              puts c.name.to_a("Shift_JIS")
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
              # Color::RGB class provided by color-tools.
         
     | 
| 
      
 44 
     | 
    
         
            +
              puts c.rgb             #=> #<Color::RGB:0xXXXXXXXX>
         
     | 
| 
      
 45 
     | 
    
         
            +
              puts c.rgb.html        #=> "#fef4f4"
         
     | 
| 
      
 46 
     | 
    
         
            +
              cmyk = c.rgb.to_cmyk
         
     | 
| 
      
 47 
     | 
    
         
            +
              p %W(c m y k).map{|e| cmyk.__send__(e) } #=> [0.00379838523644751, 0.0430140715109573, 0.0430140715109573, 0.00012318339100346]
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
              # Enumerable methods.
         
     | 
| 
      
 51 
     | 
    
         
            +
              puts Color::RGB::JP::Traditional.grep{|e| e.name.romaji =~ /[sz]akura/i }.map{|e| e.name.romaji}
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
              # puts all traditional color names.
         
     | 
| 
      
 54 
     | 
    
         
            +
              Color::RGB::JP::Traditional.each do |c|
         
     | 
| 
      
 55 
     | 
    
         
            +
                puts "%s: %s (%s)" % [c.rgb.html, c.name.kanji, c.name.hiragana]
         
     | 
| 
      
 56 
     | 
    
         
            +
              end
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
              # and JIS Z 8102.
         
     | 
| 
      
 59 
     | 
    
         
            +
              Color::RGB::JP::JISZ8102.each do |c|
         
     | 
| 
      
 60 
     | 
    
         
            +
                puts "%s: %s (%s)" % [c.rgb.html, c.name.kanji, c.name.hiragana]
         
     | 
| 
      
 61 
     | 
    
         
            +
              end
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
            === COMMAND
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
            color-japanese provies _jcolorc_ command.
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
            For more details, please see {jcolorc}[link:files/bin/jcolorc.html] document.
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
            === LIST OF COLORS
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
            example color pallets (generated by examples/color2html.rb).
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
            * {Color::RGB::JP::Traditional}[link:examples/traditional.html]
         
     | 
| 
      
 76 
     | 
    
         
            +
            * {Color::RGB::JP::JISZ8102}[link:examples/jisz8102.html]
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
            === REQUIREMENTS
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
            * color-tools[http://ruby-pdf.rubyforge.org/color-tools/index.html]
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
            === INSTALL
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
            [Unix]
         
     | 
| 
      
 87 
     | 
    
         
            +
                sudo gem install -y color-japanese
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
            [Windows]
         
     | 
| 
      
 90 
     | 
    
         
            +
                gem install -y color-japanese
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
            === LICENSE
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
            color-japanese is released under the MIT license.
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
            Copyright (c) 2007 MIYAMUKO Katsuyuki.
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining
         
     | 
| 
      
 100 
     | 
    
         
            +
            a copy of this software and associated documentation files (the
         
     | 
| 
      
 101 
     | 
    
         
            +
            'Software'), to deal in the Software without restriction, including
         
     | 
| 
      
 102 
     | 
    
         
            +
            without limitation the rights to use, copy, modify, merge, publish,
         
     | 
| 
      
 103 
     | 
    
         
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         
     | 
| 
      
 104 
     | 
    
         
            +
            permit persons to whom the Software is furnished to do so, subject to
         
     | 
| 
      
 105 
     | 
    
         
            +
            the following conditions:
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be
         
     | 
| 
      
 108 
     | 
    
         
            +
            included in all copies or substantial portions of the Software.
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
         
     | 
| 
      
 111 
     | 
    
         
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         
     | 
| 
      
 112 
     | 
    
         
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
         
     | 
| 
      
 113 
     | 
    
         
            +
            IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
         
     | 
| 
      
 114 
     | 
    
         
            +
            CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
         
     | 
| 
      
 115 
     | 
    
         
            +
            TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
         
     | 
| 
      
 116 
     | 
    
         
            +
            SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         
     | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
      
 118 
     | 
    
         
            +
             
     | 
| 
      
 119 
     | 
    
         
            +
            === OTHER STUFF
         
     | 
| 
      
 120 
     | 
    
         
            +
             
     | 
| 
      
 121 
     | 
    
         
            +
            Author::      MIYAMUKO Katsuyuki <mailto:miyamuko@gmail.com>
         
     | 
| 
      
 122 
     | 
    
         
            +
            Home URL::    http://color-japanese.rubyforge.org
         
     | 
| 
      
 123 
     | 
    
         
            +
            Project URL:: http://rubyforge.org/projects/color-japanese
         
     | 
    
        data/Rakefile
    ADDED
    
    | 
         @@ -0,0 +1,123 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # -*- ruby -*-
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'hoe'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'rake/contrib/rubyforgepublisher'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            require 'color'
         
     | 
| 
      
 8 
     | 
    
         
            +
            require './lib/color/rgb/jp/version.rb'
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            require "helper/helper"
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            RUBYFORGE_PROJECT = 'color-japanese'
         
     | 
| 
      
 14 
     | 
    
         
            +
            PROJECT_NAME = RUBYFORGE_PROJECT
         
     | 
| 
      
 15 
     | 
    
         
            +
            PROJECT_VERSION = Color::RGB::JP::VERSION::STRING
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            RDOC_DIR = "./html"
         
     | 
| 
      
 18 
     | 
    
         
            +
            EXAMPLES_DIR = "#{RDOC_DIR}/examples"
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            PROJECT_URL = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
         
     | 
| 
      
 21 
     | 
    
         
            +
            HOME_URL = "http://#{RUBYFORGE_PROJECT}.rubyforge.org/"
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            NEWS_FILE = "news.txt"
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            directory EXAMPLES_DIR
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            hoe = Hoe.new(PROJECT_NAME, PROJECT_VERSION) do |p|
         
     | 
| 
      
 29 
     | 
    
         
            +
              p.rubyforge_name = RUBYFORGE_PROJECT
         
     | 
| 
      
 30 
     | 
    
         
            +
              p.author = ["MIYAMUKO Katsuyuki"]
         
     | 
| 
      
 31 
     | 
    
         
            +
              p.email = "miyamuko@gmail.com"
         
     | 
| 
      
 32 
     | 
    
         
            +
              p.url = HOME_URL
         
     | 
| 
      
 33 
     | 
    
         
            +
              p.extra_deps << "color-tools"
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
              p.summary = p.paragraphs_of('README.txt', 2..2)[0]
         
     | 
| 
      
 36 
     | 
    
         
            +
              p.description = p.paragraphs_of('README.txt', 2..3).join("\n\n")
         
     | 
| 
      
 37 
     | 
    
         
            +
              p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
              p.need_zip = true
         
     | 
| 
      
 40 
     | 
    
         
            +
              p.need_tar = true
         
     | 
| 
      
 41 
     | 
    
         
            +
            end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            #
         
     | 
| 
      
 45 
     | 
    
         
            +
            # new task
         
     | 
| 
      
 46 
     | 
    
         
            +
            #
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            desc 'Uninstall the gem package'
         
     | 
| 
      
 49 
     | 
    
         
            +
            task_for_windows :uninstall_gem do
         
     | 
| 
      
 50 
     | 
    
         
            +
              sh "gem.bat uninstall #{PROJECT_NAME}"
         
     | 
| 
      
 51 
     | 
    
         
            +
            end
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
            #
         
     | 
| 
      
 55 
     | 
    
         
            +
            # overwrite hoe defined tasks.
         
     | 
| 
      
 56 
     | 
    
         
            +
            #
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
            remove_tasks(:clobber_docs, :docs, :redocs)
         
     | 
| 
      
 59 
     | 
    
         
            +
            Rake::RDocTask.new(:docs) do |rd|
         
     | 
| 
      
 60 
     | 
    
         
            +
              rd.main = "README.txt"
         
     | 
| 
      
 61 
     | 
    
         
            +
              rd.rdoc_dir = RDOC_DIR
         
     | 
| 
      
 62 
     | 
    
         
            +
              files = File.read("Manifest.txt").split.grep(/^(lib|bin)|txt$/)
         
     | 
| 
      
 63 
     | 
    
         
            +
              files -= ['Manifest.txt']
         
     | 
| 
      
 64 
     | 
    
         
            +
              rd.rdoc_files.push(*files)
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
              rd.options << "-t #{PROJECT_NAME}-#{PROJECT_VERSION} Documentation"
         
     | 
| 
      
 67 
     | 
    
         
            +
              rd.options << '--charset=UTF-8'
         
     | 
| 
      
 68 
     | 
    
         
            +
            end
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
            desc "Build the color list HTML Files."
         
     | 
| 
      
 71 
     | 
    
         
            +
            task :example => [EXAMPLES_DIR] do
         
     | 
| 
      
 72 
     | 
    
         
            +
              %W(Traditional JISZ8102).each do |e|
         
     | 
| 
      
 73 
     | 
    
         
            +
                sh "ruby examples/color2html.rb -p #{e} > #{EXAMPLES_DIR}/#{e.downcase}.html"
         
     | 
| 
      
 74 
     | 
    
         
            +
              end
         
     | 
| 
      
 75 
     | 
    
         
            +
            end
         
     | 
| 
      
 76 
     | 
    
         
            +
            task :docs => [:example]
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
            task_for_windows :install_gem do
         
     | 
| 
      
 79 
     | 
    
         
            +
              sh "gem.bat install pkg/*.gem"
         
     | 
| 
      
 80 
     | 
    
         
            +
            end
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
            task_for_windows :ridocs do
         
     | 
| 
      
 83 
     | 
    
         
            +
              sh "rdoc.bat --ri -o ri ."
         
     | 
| 
      
 84 
     | 
    
         
            +
            end
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
            task_for_windows :publish_docs do
         
     | 
| 
      
 87 
     | 
    
         
            +
              config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml")))
         
     | 
| 
      
 88 
     | 
    
         
            +
              Rake::RubyForgePublisher.new(RUBYFORGE_PROJECT, config["username"]).upload
         
     | 
| 
      
 89 
     | 
    
         
            +
            end
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
            # rake publish_docs SCP=pscp
         
     | 
| 
      
 92 
     | 
    
         
            +
            if ENV["SCP"] and ENV["SCP"] != "scp"
         
     | 
| 
      
 93 
     | 
    
         
            +
              add_sh_filter_for(/\Ascp /) {|cmd|
         
     | 
| 
      
 94 
     | 
    
         
            +
                cmd[0].sub!(/\Ascp/, ENV["SCP"])
         
     | 
| 
      
 95 
     | 
    
         
            +
                cmd[0].sub!(/-rq/, "-r")
         
     | 
| 
      
 96 
     | 
    
         
            +
                cmd
         
     | 
| 
      
 97 
     | 
    
         
            +
              }
         
     | 
| 
      
 98 
     | 
    
         
            +
            end
         
     | 
| 
      
 99 
     | 
    
         
            +
             
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
            task :create_news do
         
     | 
| 
      
 102 
     | 
    
         
            +
              subject, title, body, urls = hoe.announcement
         
     | 
| 
      
 103 
     | 
    
         
            +
              open(NEWS_FILE, "w") do |w|
         
     | 
| 
      
 104 
     | 
    
         
            +
                w.puts "#{title}\n\n#{body}\n\n"
         
     | 
| 
      
 105 
     | 
    
         
            +
                w.puts "--"
         
     | 
| 
      
 106 
     | 
    
         
            +
                w.puts "Home URL:    #{HOME_URL}"
         
     | 
| 
      
 107 
     | 
    
         
            +
                w.puts "Project URL: #{PROJECT_URL}"
         
     | 
| 
      
 108 
     | 
    
         
            +
              end
         
     | 
| 
      
 109 
     | 
    
         
            +
            end
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
            override_task :post_news => [:create_news] do
         
     | 
| 
      
 112 
     | 
    
         
            +
              require 'rubyforge'
         
     | 
| 
      
 113 
     | 
    
         
            +
              rf = RubyForge.new
         
     | 
| 
      
 114 
     | 
    
         
            +
              rf.login
         
     | 
| 
      
 115 
     | 
    
         
            +
              rf.post_news(rubyforge_name, subject, File.read(NEWS_FILE))
         
     | 
| 
      
 116 
     | 
    
         
            +
              puts "Posted to rubyforge"
         
     | 
| 
      
 117 
     | 
    
         
            +
              rm_f NEWS_FILE
         
     | 
| 
      
 118 
     | 
    
         
            +
            end
         
     | 
| 
      
 119 
     | 
    
         
            +
            task :clean do
         
     | 
| 
      
 120 
     | 
    
         
            +
              rm_f NEWS_FILE
         
     | 
| 
      
 121 
     | 
    
         
            +
            end
         
     | 
| 
      
 122 
     | 
    
         
            +
             
     | 
| 
      
 123 
     | 
    
         
            +
            # vim: syntax=Ruby
         
     | 
    
        data/bin/jcolorc
    ADDED
    
    | 
         @@ -0,0 +1,119 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            #
         
     | 
| 
      
 4 
     | 
    
         
            +
            # == NAME
         
     | 
| 
      
 5 
     | 
    
         
            +
            #
         
     | 
| 
      
 6 
     | 
    
         
            +
            # jcolorc - Japanese color name compiler
         
     | 
| 
      
 7 
     | 
    
         
            +
            #
         
     | 
| 
      
 8 
     | 
    
         
            +
            # == SYNOPSIS
         
     | 
| 
      
 9 
     | 
    
         
            +
            #
         
     | 
| 
      
 10 
     | 
    
         
            +
            #    jcolorc [options] < default.css.in > default.css
         
     | 
| 
      
 11 
     | 
    
         
            +
            #    jcolorc [options] default.css.in -o default.css
         
     | 
| 
      
 12 
     | 
    
         
            +
            #
         
     | 
| 
      
 13 
     | 
    
         
            +
            # == DESCRIPTION
         
     | 
| 
      
 14 
     | 
    
         
            +
            #
         
     | 
| 
      
 15 
     | 
    
         
            +
            # jcolorc is a filter to convert from Japanese color name to RGB value.
         
     | 
| 
      
 16 
     | 
    
         
            +
            #
         
     | 
| 
      
 17 
     | 
    
         
            +
            #
         
     | 
| 
      
 18 
     | 
    
         
            +
            # == SYNTAX
         
     | 
| 
      
 19 
     | 
    
         
            +
            #
         
     | 
| 
      
 20 
     | 
    
         
            +
            # [<tt>##<em><color name></em></tt>]
         
     | 
| 
      
 21 
     | 
    
         
            +
            #     Replace with RGB value for <em><color name></em>.
         
     | 
| 
      
 22 
     | 
    
         
            +
            #
         
     | 
| 
      
 23 
     | 
    
         
            +
            #     You can use kanji, hiragana, katakana and romaji for <em><color name></em>.
         
     | 
| 
      
 24 
     | 
    
         
            +
            #
         
     | 
| 
      
 25 
     | 
    
         
            +
            # [<tt>##alias <em><new color name></em> <em><color name></em></tt>]
         
     | 
| 
      
 26 
     | 
    
         
            +
            #     Gives alias to <em><color name></em>.
         
     | 
| 
      
 27 
     | 
    
         
            +
            #
         
     | 
| 
      
 28 
     | 
    
         
            +
            #
         
     | 
| 
      
 29 
     | 
    
         
            +
            # == EXAMPLE
         
     | 
| 
      
 30 
     | 
    
         
            +
            #
         
     | 
| 
      
 31 
     | 
    
         
            +
            # === Short example:
         
     | 
| 
      
 32 
     | 
    
         
            +
            #
         
     | 
| 
      
 33 
     | 
    
         
            +
            #   % echo color: ##sakura-iro | jcolorc
         
     | 
| 
      
 34 
     | 
    
         
            +
            #   color: #fbdade
         
     | 
| 
      
 35 
     | 
    
         
            +
            #
         
     | 
| 
      
 36 
     | 
    
         
            +
            # === Long example:
         
     | 
| 
      
 37 
     | 
    
         
            +
            #
         
     | 
| 
      
 38 
     | 
    
         
            +
            # INPUT (default.css.in):
         
     | 
| 
      
 39 
     | 
    
         
            +
            #
         
     | 
| 
      
 40 
     | 
    
         
            +
            #     @charset "Shift_JIS";
         
     | 
| 
      
 41 
     | 
    
         
            +
            #     body {
         
     | 
| 
      
 42 
     | 
    
         
            +
            #         color: ##暗黒色;
         
     | 
| 
      
 43 
     | 
    
         
            +
            #         background: ##sakura-iro;
         
     | 
| 
      
 44 
     | 
    
         
            +
            #     }
         
     | 
| 
      
 45 
     | 
    
         
            +
            #     .warning {
         
     | 
| 
      
 46 
     | 
    
         
            +
            #         color: ##こいくれない;
         
     | 
| 
      
 47 
     | 
    
         
            +
            #         background: ##ニジイロ;
         
     | 
| 
      
 48 
     | 
    
         
            +
            #         border: 2px solid #ff0000;
         
     | 
| 
      
 49 
     | 
    
         
            +
            #         padding: 4px;
         
     | 
| 
      
 50 
     | 
    
         
            +
            #     }
         
     | 
| 
      
 51 
     | 
    
         
            +
            #
         
     | 
| 
      
 52 
     | 
    
         
            +
            # FILTER COMMAND:
         
     | 
| 
      
 53 
     | 
    
         
            +
            #
         
     | 
| 
      
 54 
     | 
    
         
            +
            #     % jcolorc -p traditional -Ks -o default.css default.css.in
         
     | 
| 
      
 55 
     | 
    
         
            +
            #
         
     | 
| 
      
 56 
     | 
    
         
            +
            # OUTPUT (default.css):
         
     | 
| 
      
 57 
     | 
    
         
            +
            #
         
     | 
| 
      
 58 
     | 
    
         
            +
            #     @charset "Shift_JIS";
         
     | 
| 
      
 59 
     | 
    
         
            +
            #     body {
         
     | 
| 
      
 60 
     | 
    
         
            +
            #         color: #16160e;
         
     | 
| 
      
 61 
     | 
    
         
            +
            #         background: #fef4f4;
         
     | 
| 
      
 62 
     | 
    
         
            +
            #     }
         
     | 
| 
      
 63 
     | 
    
         
            +
            #     .warning {
         
     | 
| 
      
 64 
     | 
    
         
            +
            #         color: #a22041;
         
     | 
| 
      
 65 
     | 
    
         
            +
            #         background: #f6bfbc;
         
     | 
| 
      
 66 
     | 
    
         
            +
            #         border: 2px solid #ff0000;
         
     | 
| 
      
 67 
     | 
    
         
            +
            #         padding: 4px;
         
     | 
| 
      
 68 
     | 
    
         
            +
            #     }
         
     | 
| 
      
 69 
     | 
    
         
            +
            #
         
     | 
| 
      
 70 
     | 
    
         
            +
            #
         
     | 
| 
      
 71 
     | 
    
         
            +
            # === alias example:
         
     | 
| 
      
 72 
     | 
    
         
            +
            #
         
     | 
| 
      
 73 
     | 
    
         
            +
            # Gives logical name for shinku (真紅).
         
     | 
| 
      
 74 
     | 
    
         
            +
            #
         
     | 
| 
      
 75 
     | 
    
         
            +
            # INPUT (default.css.in):
         
     | 
| 
      
 76 
     | 
    
         
            +
            #
         
     | 
| 
      
 77 
     | 
    
         
            +
            #     ##alias my-red shinku
         
     | 
| 
      
 78 
     | 
    
         
            +
            #     table, th, td {
         
     | 
| 
      
 79 
     | 
    
         
            +
            #         border: 1px solid ##my-red;
         
     | 
| 
      
 80 
     | 
    
         
            +
            #     }
         
     | 
| 
      
 81 
     | 
    
         
            +
            #     .column {
         
     | 
| 
      
 82 
     | 
    
         
            +
            #         border: 2px dotted ##my-red;
         
     | 
| 
      
 83 
     | 
    
         
            +
            #     }
         
     | 
| 
      
 84 
     | 
    
         
            +
            #
         
     | 
| 
      
 85 
     | 
    
         
            +
            # FILTER COMMAND:
         
     | 
| 
      
 86 
     | 
    
         
            +
            #
         
     | 
| 
      
 87 
     | 
    
         
            +
            #     % jcolorc -p traditional -o default.css default.css.in
         
     | 
| 
      
 88 
     | 
    
         
            +
            #
         
     | 
| 
      
 89 
     | 
    
         
            +
            # OUTPUT (default.css):
         
     | 
| 
      
 90 
     | 
    
         
            +
            #
         
     | 
| 
      
 91 
     | 
    
         
            +
            #     table, th, td {
         
     | 
| 
      
 92 
     | 
    
         
            +
            #         border: 1px solid #a22041;
         
     | 
| 
      
 93 
     | 
    
         
            +
            #     }
         
     | 
| 
      
 94 
     | 
    
         
            +
            #     .column {
         
     | 
| 
      
 95 
     | 
    
         
            +
            #         border: 2px dotted #a22041;
         
     | 
| 
      
 96 
     | 
    
         
            +
            #     }
         
     | 
| 
      
 97 
     | 
    
         
            +
            #
         
     | 
| 
      
 98 
     | 
    
         
            +
            #
         
     | 
| 
      
 99 
     | 
    
         
            +
            # == USAGE
         
     | 
| 
      
 100 
     | 
    
         
            +
            #
         
     | 
| 
      
 101 
     | 
    
         
            +
            #     Usage: jcolorc [options] <source file>
         
     | 
| 
      
 102 
     | 
    
         
            +
            #
         
     | 
| 
      
 103 
     | 
    
         
            +
            #       Options:
         
     | 
| 
      
 104 
     | 
    
         
            +
            #         -o, --output <output file>       output file (default: stdout)
         
     | 
| 
      
 105 
     | 
    
         
            +
            #         -p, --pallet <color pallet>      color pallet (jis or traditional).
         
     | 
| 
      
 106 
     | 
    
         
            +
            #                                          (default: jis)
         
     | 
| 
      
 107 
     | 
    
         
            +
            #         -K<kcode>                        specifies KANJI code-set (default: UTF-8)
         
     | 
| 
      
 108 
     | 
    
         
            +
            #         -E                               output preprocessed ERB script
         
     | 
| 
      
 109 
     | 
    
         
            +
            #             --prefix=<directive prefix>  prefix the pre-processor directive.
         
     | 
| 
      
 110 
     | 
    
         
            +
            #                                          (default: ##)
         
     | 
| 
      
 111 
     | 
    
         
            +
            #
         
     | 
| 
      
 112 
     | 
    
         
            +
            #         -v, --version                    print the version
         
     | 
| 
      
 113 
     | 
    
         
            +
            #         -h, --help                       print this message
         
     | 
| 
      
 114 
     | 
    
         
            +
            #
         
     | 
| 
      
 115 
     | 
    
         
            +
             
     | 
| 
      
 116 
     | 
    
         
            +
            require "rubygems"
         
     | 
| 
      
 117 
     | 
    
         
            +
            require "color/rgb/jp/compiler/command"
         
     | 
| 
      
 118 
     | 
    
         
            +
             
     | 
| 
      
 119 
     | 
    
         
            +
            Color::RGB::JP::Compiler::Command.dispatch
         
     | 
    
        data/examples/Rakefile
    ADDED
    
    | 
         @@ -0,0 +1,57 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            $base = File.dirname(__FILE__)
         
     | 
| 
      
 2 
     | 
    
         
            +
            $lib = File.join($base, "../lib")
         
     | 
| 
      
 3 
     | 
    
         
            +
            $bin = File.join($base, "../bin")
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            def jcolorc(*args)
         
     | 
| 
      
 6 
     | 
    
         
            +
              ruby "-I#{$lib} #{$bin}/jcolorc #{args * ' '}"
         
     | 
| 
      
 7 
     | 
    
         
            +
            end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            desc "run all examples (default)."
         
     | 
| 
      
 11 
     | 
    
         
            +
            task :all => []
         
     | 
| 
      
 12 
     | 
    
         
            +
            task :default => [:all]
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            file "default.css" => "default.css.in" do |t|
         
     | 
| 
      
 15 
     | 
    
         
            +
              jcolorc "-Ks -o #{t.name} #{t.prerequisites[0]}"
         
     | 
| 
      
 16 
     | 
    
         
            +
            end
         
     | 
| 
      
 17 
     | 
    
         
            +
            task :clean do
         
     | 
| 
      
 18 
     | 
    
         
            +
              rm_f "default.css"
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            desc "run css example."
         
     | 
| 
      
 22 
     | 
    
         
            +
            task :css => ["default.css"] do
         
     | 
| 
      
 23 
     | 
    
         
            +
              puts "*** check default.html ***"
         
     | 
| 
      
 24 
     | 
    
         
            +
            end
         
     | 
| 
      
 25 
     | 
    
         
            +
            task :all => [:css]
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            file "color-test.html" => "color-test.html.in" do |t|
         
     | 
| 
      
 29 
     | 
    
         
            +
              jcolorc "-o #{t.name} #{t.prerequisites[0]}"
         
     | 
| 
      
 30 
     | 
    
         
            +
            end
         
     | 
| 
      
 31 
     | 
    
         
            +
            task :clean do
         
     | 
| 
      
 32 
     | 
    
         
            +
              rm_f "color-test.html"
         
     | 
| 
      
 33 
     | 
    
         
            +
            end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            desc "run color-test example."
         
     | 
| 
      
 36 
     | 
    
         
            +
            task :colortest => ["color-test.html"] do
         
     | 
| 
      
 37 
     | 
    
         
            +
              puts "*** check color-test.html ***"
         
     | 
| 
      
 38 
     | 
    
         
            +
            end
         
     | 
| 
      
 39 
     | 
    
         
            +
            task :all => [:colortest]
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            desc "run color2html example."
         
     | 
| 
      
 43 
     | 
    
         
            +
            task :color2html do
         
     | 
| 
      
 44 
     | 
    
         
            +
              ruby "-I#{$lib} color2html.rb -p Traditional -o traditional.html"
         
     | 
| 
      
 45 
     | 
    
         
            +
              puts "*** check traditional.html ***"
         
     | 
| 
      
 46 
     | 
    
         
            +
            end
         
     | 
| 
      
 47 
     | 
    
         
            +
            task :clean do
         
     | 
| 
      
 48 
     | 
    
         
            +
              rm_f "traditional.html"
         
     | 
| 
      
 49 
     | 
    
         
            +
            end
         
     | 
| 
      
 50 
     | 
    
         
            +
            task :all => [:color2html]
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
            desc "run palletize example."
         
     | 
| 
      
 54 
     | 
    
         
            +
            task :palletize do
         
     | 
| 
      
 55 
     | 
    
         
            +
              ruby "-I#{$lib} palletize.rb 0063DC FF0084"
         
     | 
| 
      
 56 
     | 
    
         
            +
            end
         
     | 
| 
      
 57 
     | 
    
         
            +
            task :all => [:palletize]
         
     |