sassy-glyph 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b6b78d668e99bf9648bae20cf3c18afd68184c5a
4
+ data.tar.gz: a528057e73a244583635ee7045ab5ab63f40b8b6
5
+ SHA512:
6
+ metadata.gz: 42d223e990f35eddd4f19c3187ff9e4078c6a7b77a69aed67158a480969bd8a5cd4dd95a6d3fcfddb793392f2beb3fbb1d06583ec5265725b4cee9192a33499c
7
+ data.tar.gz: 594e587c0cd0ecc86d867f1cc7dece76c4908735d0563854f1b98119606aad67d9b87df21f76b989a4e7057676a373c404277968b9b105ab0a81733d4c3236f5
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ .sass-cache
7
+ .sass-cache/*
8
+ Gemfile.lock
9
+ InstalledFiles
10
+ _yardoc
11
+ coverage
12
+ doc/
13
+ lib/bundler/man
14
+ pkg
15
+ rdoc
16
+ spec/reports
17
+ test/tmp
18
+ test/version_tmp
19
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in glyph.gemspec
4
+ gemspec
5
+ gem 'sass', "~>3.3.0"
6
+ gem 'compass', '~> 1.0.0.alpha.19'
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Jared Hardy
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Glyph
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'glyph'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install glyph
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( http://github.com/<my-github-username>/glyph/fork )
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/glyph.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ require "./lib/glyph"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "sassy-glyph"
9
+ spec.version = Glyph::VERSION
10
+ spec.authors = ["Jared Hardy"]
11
+ spec.email = ["jared@jaredhardy.com"]
12
+ spec.summary = %q{Easy CSS content glyph character conversion.}
13
+ spec.description = %q{Easy CSS content glyph character conversion.}
14
+ spec.homepage = ""
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.5"
23
+ spec.add_development_dependency "rake"
24
+ end
data/lib/glyph.rb ADDED
@@ -0,0 +1,30 @@
1
+ require "sass"
2
+
3
+ if (defined? Compass)
4
+ Compass::Frameworks.register(
5
+ "sassy-glyph",
6
+ :path => "#{File.dirname(__FILE__)}/.."
7
+ )
8
+ end
9
+
10
+ module Glyph
11
+ VERSION = "0.5.0"
12
+ end
13
+
14
+
15
+ module Sass::Script::Functions
16
+ def to_glyph(string)
17
+ assert_type string, :String
18
+
19
+ converted_string = string.value.unpack("U*").first.to_s(16).upcase;
20
+
21
+ if converted_string.length <= 2
22
+ converted_string = converted_string.insert(0, "\\00")
23
+ else
24
+ converted_string = converted_string.insert(0, "\\")
25
+ end
26
+
27
+ Sass::Script::Value::String.new(converted_string)
28
+ end
29
+ declare :to_glyph, [:string]
30
+ end
@@ -0,0 +1,4 @@
1
+ @function glyph($string) {
2
+ $val: to_glyph($string);
3
+ @return "#{$val}";
4
+ }
data/test/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "compass", "~> 1.0.0.alpha.18"
4
+ gem "true"
5
+ gem "sassy-glyph", path => ".."
data/test/config.rb ADDED
@@ -0,0 +1,11 @@
1
+ # Compass CSS framework config file
2
+ require 'true'
3
+ require 'glyph'
4
+ project_type = :stand_alone
5
+ http_path = "/"
6
+ sass_dir = "scss"
7
+ css_dir = "css"
8
+ line_comments = false
9
+ preferred_syntax = :scss
10
+ output_style = :expanded
11
+ relative_assets = true
data/test/css/test.css ADDED
@@ -0,0 +1,39 @@
1
+ /*
2
+
3
+ ### Character Conversion ------ */
4
+ /* - [function] glyph() (8 Assertions, 8 Passed, 0 Failed) */
5
+ /*
6
+ 1 Tests:
7
+ - 1 Passed
8
+ - 0 Failed */
9
+ .arrow:after {
10
+ content: "\279C";
11
+ }
12
+
13
+ .punctuation:after {
14
+ content: "\00A1";
15
+ }
16
+
17
+ .currency:after {
18
+ content: "\20AC";
19
+ }
20
+
21
+ .bullet:after {
22
+ content: "\2737";
23
+ }
24
+
25
+ .math:after {
26
+ content: "\2A33";
27
+ }
28
+
29
+ .letter:after {
30
+ content: "\00AE";
31
+ }
32
+
33
+ .picto:after {
34
+ content: "\2603";
35
+ }
36
+
37
+ .paren:after {
38
+ content: "\00AB";
39
+ }
data/test/index.html ADDED
@@ -0,0 +1,33 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Glyph Extension Test Results</title>
6
+ <link rel="stylesheet" href="css/test.css">
7
+ </head>
8
+ <body>
9
+ <table>
10
+ <thead>
11
+ <tr>
12
+ <th>Unicode Value</th>
13
+ <th>Expected Character</th>
14
+ <th>Generated Character</th>
15
+ </tr>
16
+ </thead>
17
+
18
+ <tbody>
19
+ <tr><td>\279C</td><td>➜</td><td><div class="arrow"></div></td></tr>
20
+ <tr><td>\00A1</td><td>¡</td><td><div class="punctuation"></div></td></tr>
21
+ <tr><td>\20AC</td><td>€</td><td><div class="currency"></div></td></tr>
22
+ <tr><td>\2737</td><td>✷</td><td><div class="bullet"></div></td></tr>
23
+ <tr><td>\2A33</td><td>⨳</td><td><div class="math"></div></td></tr>
24
+ <tr><td>\00AE</td><td>®</td><td><div class="letter"></div></td></tr>
25
+ <tr><td>\2603</td><td>☃</td><td><div class="picto"></div></td></tr>
26
+ <tr><td>\00AB</td><td>«</td><td><div class="paren"></div></td></tr>
27
+ </tbody>
28
+ </table>
29
+
30
+ </body>
31
+ </html>
32
+
33
+
@@ -0,0 +1,53 @@
1
+ @import "true";
2
+ @import "glyph";
3
+
4
+ $arrow: glyph('➜');
5
+ $punctuation: glyph('¡');
6
+ $currency: glyph('€');
7
+ $bullet: glyph('✷');
8
+ $math: glyph('⨳');
9
+ $letter: glyph('®');
10
+ $picto: glyph('☃');
11
+ $paren: glyph('«');
12
+
13
+
14
+ @include test-module('Character Conversion') {
15
+ @include test('[function] glyph()') {
16
+
17
+ @include assert-equal($arrow, "\279C", "➜ is equal to '\279C'");
18
+ @include assert-equal($punctuation, "\00A1", "¡ is equal to '\00A1'");
19
+ @include assert-equal($currency, "\20AC", "€ is equal to '\20AC'");
20
+ @include assert-equal($bullet, "\2737", "✷ is equal to '\2737'");
21
+ @include assert-equal($math, "\2A33", "⨳ is equal to '\2A33'");
22
+ @include assert-equal($letter, "\00AE", "® is equal to '\00AE'");
23
+ @include assert-equal($picto, "\2603", "☃ is equal to '\2603'");
24
+ @include assert-equal($paren, "\00AB", "« is equal to '\00AB'");
25
+ }
26
+ }
27
+
28
+
29
+ @mixin after($glyph) {
30
+ &:after {
31
+ content: $glyph;
32
+ @content;
33
+ }
34
+ }
35
+
36
+
37
+ .arrow { @include after($arrow);}
38
+ .punctuation { @include after($punctuation); }
39
+ .currency { @include after($currency); }
40
+ .bullet { @include after($bullet); }
41
+ .math { @include after($math); }
42
+ .letter { @include after($letter); }
43
+ .picto { @include after($picto); }
44
+ .paren { @include after($paren); }
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sassy-glyph
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
5
+ platform: ruby
6
+ authors:
7
+ - Jared Hardy
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Easy CSS content glyph character conversion.
42
+ email:
43
+ - jared@jaredhardy.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - glyph.gemspec
54
+ - lib/glyph.rb
55
+ - stylesheets/_sassy-glyph.scss
56
+ - test/Gemfile
57
+ - test/config.rb
58
+ - test/css/test.css
59
+ - test/index.html
60
+ - test/scss/test.scss
61
+ homepage: ''
62
+ licenses:
63
+ - MIT
64
+ metadata: {}
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubyforge_project:
81
+ rubygems_version: 2.0.14
82
+ signing_key:
83
+ specification_version: 4
84
+ summary: Easy CSS content glyph character conversion.
85
+ test_files:
86
+ - test/Gemfile
87
+ - test/config.rb
88
+ - test/css/test.css
89
+ - test/index.html
90
+ - test/scss/test.scss