quotation-marks 0.1.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 92d0c294fc3e301111a7c4ecca512f41f00af47d
4
+ data.tar.gz: d4c6c2a856ebd23c6a69cff2eabac9d66ac1f0b7
5
+ SHA512:
6
+ metadata.gz: a34610672a7afa37b7e3944a2ed6850ce62bd60269b0638a04ffb1401a7f05343a302ef35e5859612fa39f4b111f2c9517c4950286ea22e207c99e5a4e4323ea
7
+ data.tar.gz: c018b4c9271eee37450dfc0c9e6247b17441c362b305c176bc1094fa4a4d1ee8ae387436158c4ee37ea57fa9c5865c7b791917ad0de27d06c6f19e4c3d285465
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0
4
+
5
+ * Initial release
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
data/LICENSE.md ADDED
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2014 Nico Hagenburger
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.
23
+
data/README.md ADDED
@@ -0,0 +1,95 @@
1
+ # Quotation Marks
2
+
3
+ An easy to use mixin for quotation marks in Sass
4
+
5
+
6
+ ## Usage
7
+
8
+
9
+ ### Add quotation marks to an element
10
+
11
+ ``` scss
12
+ @import "quotation-marks";
13
+
14
+ .my-class {
15
+ @include quotation-marks(en);
16
+ }
17
+ ```
18
+
19
+ ``` css
20
+ .my-class:before {
21
+ content: "“";
22
+ }
23
+
24
+ .my-class:after {
25
+ content: "”";
26
+ }
27
+ ```
28
+
29
+
30
+ ### Use :lang()
31
+
32
+ ``` html
33
+ <html lang="de">
34
+ <body>
35
+ <div class="my-class">Hello World!</div>
36
+ </body>
37
+ </html>
38
+ ```
39
+
40
+ ``` scss
41
+ @import "quotation-marks";
42
+
43
+ .my-class {
44
+ @include localized-quotation-marks(en de);
45
+ }
46
+ ```
47
+
48
+ ``` css
49
+ .my-class:lang(en):before,
50
+ .my-class:lang(de):after {
51
+ content: "“";
52
+ }
53
+
54
+ .my-class:lang(en):after {
55
+ content: "”";
56
+ }
57
+
58
+ .my-class:lang(de):before {
59
+ content: "„";
60
+ }
61
+ ```
62
+
63
+ **Notice:** This gem uses `%placeholders`—so it combines all similar
64
+ quotation mark and just adds the selectors.
65
+
66
+
67
+ ## Installation
68
+
69
+ Add this line to your application’s Gemfile:
70
+
71
+ gem 'quotation-marks'
72
+
73
+ And then execute:
74
+
75
+ $ bundle
76
+
77
+ Or install it yourself as:
78
+
79
+ $ gem install quotation-marks
80
+
81
+
82
+ ## Contributing
83
+
84
+ 1. Fork it
85
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
86
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
87
+ 4. Push to the branch (`git push origin my-new-feature`)
88
+ 5. Create new Pull Request
89
+
90
+
91
+ ## Copyright
92
+
93
+ Copyright (c) 2014 [Nico Hagenburger](http://www.hagenburger.net).
94
+ See [MIT-LICENSE.md](MIT-LICENSE.md) for details.
95
+ Get in touch with [@hagenburger](http://twitter.com/hagenburger) on Twitter.
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new :test do |t|
5
+ t.libs << 'lib'
6
+ t.libs << 'test'
7
+ test_files = FileList['test/**/*_test.rb']
8
+ t.test_files = test_files
9
+ t.verbose = true
10
+ end
11
+
12
+ task :default => [:test]
13
+
@@ -0,0 +1,15 @@
1
+ require 'quotation-marks/version'
2
+
3
+ module QuotationMarks
4
+ end
5
+
6
+ base_directory = File.join(File.dirname(__FILE__), '..')
7
+ begin
8
+ require 'compass'
9
+ Compass::Frameworks.register 'quotation-marks', path: base_directory
10
+ rescue LoadError
11
+ require 'sass'
12
+ ENV['SASS_PATH'] ||= ''
13
+ ENV['SASS_PATH'] = ENV['SASS_PATH'] + File::PATH_SEPARATOR + File.join(base_directory, 'stylesheets')
14
+ end
15
+
@@ -0,0 +1,3 @@
1
+ module QuotationMarks
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'quotation-marks/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'quotation-marks'
8
+ spec.version = QuotationMarks::VERSION
9
+ spec.authors = ['Nico Hagenburger']
10
+ spec.email = ['nico@hagenburger.net']
11
+ spec.description = %q{An easy to use mixin for quotation marks in Sass}
12
+ spec.summary = %q{I18n quotation marks for Sass}
13
+ spec.homepage = ''
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'sass', '>= 3.3'
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.3'
24
+ spec.add_development_dependency 'rake'
25
+ spec.add_development_dependency 'minitest'
26
+ end
27
+
@@ -0,0 +1,95 @@
1
+ $quotation-marks: (
2
+ af: “ ”,
3
+ ar: ” “,
4
+ az: « »,
5
+ be: « »,
6
+ bg: „ “,
7
+ ca: « »,
8
+ cs: „ “,
9
+ da: » «,
10
+ de: „ “,
11
+ de-at: „ “,
12
+ de-ch: « »,
13
+ el: « »,
14
+ en: “ ”,
15
+ en-ca: “ ”,
16
+ en-uk: ‘ ’,
17
+ en-us: “ ”,
18
+ eo: “ ”,
19
+ es: « »,
20
+ et: „ “,
21
+ eu: « »,
22
+ fa: « »,
23
+ fi: ” ”,
24
+ fr: « »,
25
+ fr-ch: « »,
26
+ ga: “ ”,
27
+ he: „ ”,
28
+ hr: „ ”,
29
+ hu: „ ”,
30
+ hy: « »,
31
+ ia: “ ”,
32
+ id: “ ”,
33
+ is: „ “,
34
+ it: « »,
35
+ it-ch: « »,
36
+ ja: 「 」,
37
+ ka: „ “,
38
+ ko: “ ”,
39
+ lt: „ “,
40
+ lv: « »,
41
+ mk: „ “,
42
+ nl: ‘ ’,
43
+ no: « »,
44
+ pl: „ ”,
45
+ pt-br: “ ”,
46
+ pt-pt: « »,
47
+ ro: „ ”,
48
+ ru: « »,
49
+ sk: „ “,
50
+ sl: „ “,
51
+ sq: „ “,
52
+ sr: „ ”,
53
+ sv: ” ”,
54
+ th: “ ”,
55
+ tr: “ ”,
56
+ uk: « »,
57
+ vi: “ ”,
58
+ zh: “ ”,
59
+ );
60
+
61
+ $quotation-mark-placeholders: ();
62
+
63
+ @mixin quotation-marks($language) {
64
+ $localized-quotation-marks: map-get($quotation-marks, $language);
65
+ $start: nth($localized-quotation-marks, 1);
66
+ $end: nth($localized-quotation-marks, 2);
67
+
68
+ @if not index($quotation-mark-placeholders, $start) {
69
+ $quotation-mark-placeholders: append($quotation-mark-placeholders, $start) !global;
70
+ @at-root %quotation-mark-#{$start} {
71
+ content: "#{$start}";
72
+ }
73
+ }
74
+ &:before {
75
+ @extend %quotation-mark-#{$start};
76
+ }
77
+
78
+ @if not index($quotation-mark-placeholders, $end) {
79
+ $quotation-mark-placeholders: append($quotation-mark-placeholders, $end) !global;
80
+ @at-root %quotation-mark-#{$end} {
81
+ content: "#{$end}";
82
+ }
83
+ }
84
+ &:after {
85
+ @extend %quotation-mark-#{$end};
86
+ }
87
+ }
88
+
89
+ @mixin localized-quotation-marks($languages) {
90
+ @each $language in $languages {
91
+ &:lang(#{$language}) {
92
+ @include quotation-marks($language);
93
+ }
94
+ }
95
+ }
@@ -0,0 +1,72 @@
1
+ require 'test_helper'
2
+
3
+ describe 'quotation marks' do
4
+
5
+ it 'should use english quotation marks' do
6
+ assert_sass <<-SCSS, <<-CSS
7
+ @import "quotation-marks";
8
+ .my-class {
9
+ @include quotation-marks(en);
10
+ }
11
+ SCSS
12
+ .my-class:before {
13
+ content: "“";
14
+ }
15
+
16
+ .my-class:after {
17
+ content: "”";
18
+ }
19
+ CSS
20
+ end
21
+
22
+ it 'should use english and german quotation marks and use as few selectors as possible' do
23
+ assert_sass <<-SCSS, <<-CSS
24
+ @import "quotation-marks";
25
+ .my-class {
26
+ @include quotation-marks(en);
27
+ }
28
+
29
+ .my-other-class {
30
+ @include quotation-marks(de);
31
+ }
32
+ SCSS
33
+ .my-class:before,
34
+ .my-other-class:after {
35
+ content: "“";
36
+ }
37
+
38
+ .my-class:after {
39
+ content: "”";
40
+ }
41
+
42
+ .my-other-class:before {
43
+ content: "„";
44
+ }
45
+ CSS
46
+ end
47
+
48
+ it 'should use quotation marks per language' do
49
+ assert_sass <<-SCSS, <<-CSS
50
+ @import "quotation-marks";
51
+ .my-class {
52
+ @include localized-quotation-marks(en de);
53
+ }
54
+ SCSS
55
+ .my-class:lang(en):before,
56
+ .my-class:lang(de):after {
57
+ content: "“";
58
+ }
59
+
60
+ .my-class:lang(en):after {
61
+ content: "”";
62
+ }
63
+
64
+ .my-class:lang(de):before {
65
+ content: "„";
66
+ }
67
+ CSS
68
+ end
69
+
70
+ end
71
+
72
+
@@ -0,0 +1,14 @@
1
+ require 'minitest/autorun'
2
+ require 'quotation-marks'
3
+
4
+ def assert_sass(scss, css)
5
+ options = {
6
+ :syntax => :scss,
7
+ :cache => false,
8
+ :read_cache => false
9
+ }
10
+ result = Sass::Engine.new(scss, options).render
11
+ result.gsub! %r(@charset "UTF-8";), ''
12
+ result.strip.gsub(/\s+/, ' ').must_equal css.strip.gsub(/\s+/, ' ').strip
13
+ end
14
+
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: quotation-marks
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Nico Hagenburger
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sass
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '3.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '3.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: An easy to use mixin for quotation marks in Sass
70
+ email:
71
+ - nico@hagenburger.net
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - CHANGELOG.md
78
+ - Gemfile
79
+ - LICENSE.md
80
+ - README.md
81
+ - Rakefile
82
+ - lib/quotation-marks.rb
83
+ - lib/quotation-marks/version.rb
84
+ - quotation-marks.gemspec
85
+ - stylesheets/_quotation-marks.scss
86
+ - test/quotation_marks_test.rb
87
+ - test/test_helper.rb
88
+ homepage: ''
89
+ licenses:
90
+ - MIT
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - '>='
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ requirements: []
107
+ rubyforge_project:
108
+ rubygems_version: 2.1.11
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: I18n quotation marks for Sass
112
+ test_files:
113
+ - test/quotation_marks_test.rb
114
+ - test/test_helper.rb