evil-front 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +1 -0
  3. data/ChangeLog.md +3 -0
  4. data/LICENSE +20 -0
  5. data/Rakefile +13 -0
  6. data/evil-front.gemspec +27 -0
  7. data/lib/assets/javascripts/evil-front/after.js +7 -0
  8. data/lib/assets/javascripts/evil-front/ajax.js +61 -0
  9. data/lib/assets/javascripts/evil-front/core.js +13 -0
  10. data/lib/assets/javascripts/evil-front/detect-3d.js +5 -0
  11. data/lib/assets/javascripts/evil-front/every.js +7 -0
  12. data/lib/assets/javascripts/evil-front/http.js +29 -0
  13. data/lib/assets/javascripts/evil-front/jquery.js +43 -0
  14. data/lib/assets/javascripts/evil-front/links.js +10 -0
  15. data/lib/assets/javascripts/evil-front/outside.js +40 -0
  16. data/lib/assets/javascripts/evil-front/queue.js +43 -0
  17. data/lib/assets/javascripts/evil-front/tappable.js +46 -0
  18. data/lib/assets/javascripts/evil-front/transform3d.js +38 -0
  19. data/lib/assets/javascripts/evil-front.js +7 -0
  20. data/lib/assets/stylesheets/evil-front/clearfix.sass +8 -0
  21. data/lib/assets/stylesheets/evil-front/colors.sass +11 -0
  22. data/lib/assets/stylesheets/evil-front/easings.sass +35 -0
  23. data/lib/assets/stylesheets/evil-front/flying-quotes.sass +6 -0
  24. data/lib/assets/stylesheets/evil-front/height.sass +9 -0
  25. data/lib/assets/stylesheets/evil-front/import-ruble.sass +42 -0
  26. data/lib/assets/stylesheets/evil-front/media.sass +25 -0
  27. data/lib/assets/stylesheets/evil-front/no-hover.sass +17 -0
  28. data/lib/assets/stylesheets/evil-front/no-tap-highlight.sass +9 -0
  29. data/lib/assets/stylesheets/evil-front/reset.sass +31 -0
  30. data/lib/assets/stylesheets/evil-front/size.sass +8 -0
  31. data/lib/assets/stylesheets/evil-front/sticky-footer.sass +20 -0
  32. data/lib/assets/stylesheets/evil-front/stroke-text.sass +8 -0
  33. data/lib/assets/stylesheets/evil-front/styled-taps.sass +11 -0
  34. data/lib/assets/stylesheets/evil-front/to-px.sass +6 -0
  35. data/lib/assets/stylesheets/evil-front.sass +18 -0
  36. data/lib/evil-front/helpers/capitalize_first.rb +8 -0
  37. data/lib/evil-front/helpers/disable_mobile_zoom.rb +13 -0
  38. data/lib/evil-front/helpers/flying_quote.rb +20 -0
  39. data/lib/evil-front/helpers/head_content.rb +10 -0
  40. data/lib/evil-front/helpers/head_tag.rb +26 -0
  41. data/lib/evil-front/helpers/ruble.rb +15 -0
  42. data/lib/evil-front/helpers/russian_typograph.rb +21 -0
  43. data/lib/evil-front/helpers/standard_assets.rb +13 -0
  44. data/lib/evil-front/helpers/tel.rb +12 -0
  45. data/lib/evil-front/helpers/title.rb +14 -0
  46. data/lib/evil-front/helpers/title_tag.rb +27 -0
  47. data/lib/evil-front/helpers.rb +25 -0
  48. data/lib/evil-front/russian.rb +84 -0
  49. data/lib/evil-front/slim.rb +6 -0
  50. data/lib/evil-front/version.rb +3 -0
  51. data/lib/evil-front.rb +30 -0
  52. data/spec/helpers_spec.rb +98 -0
  53. data/spec/russian_spec.rb +100 -0
  54. data/spec/sass/empty.txt +0 -0
  55. data/spec/sass/inline-ruble.sass +3 -0
  56. data/spec/sass/load.sass +7 -0
  57. data/spec/sass/media.sass +9 -0
  58. data/spec/sass/ruble.sass +3 -0
  59. data/spec/sass/size.sass +10 -0
  60. data/spec/sass_spec.rb +75 -0
  61. data/spec/spec_helper.rb +3 -0
  62. data/vendor/assets/fonts/evil-front/alsrubl-arial-bold.woff +0 -0
  63. data/vendor/assets/fonts/evil-front/alsrubl-arial-bolditalic.woff +0 -0
  64. data/vendor/assets/fonts/evil-front/alsrubl-arial-italic.woff +0 -0
  65. data/vendor/assets/fonts/evil-front/alsrubl-arial-regular.woff +0 -0
  66. metadata +220 -0
@@ -0,0 +1,20 @@
1
+ // Sticky footer, which show on bottom of screen if content height is less,
2
+ // that screen content
3
+ //
4
+ // +sticky-footer(100px)
5
+ //
6
+ // You can specify footer selector (`.footer-layout` by default):
7
+ //
8
+ // +sticky-footer(100px, 'footer')
9
+ @mixin sticky-footer($height, $footer: unquote(".footer-layout"))
10
+ html
11
+ position: relative
12
+ min-height: 100%
13
+ body
14
+ margin-bottom: $height
15
+ #{$footer}
16
+ position: absolute
17
+ left: 0
18
+ bottom: 0
19
+ height: $height
20
+ width: 100%
@@ -0,0 +1,8 @@
1
+ // Stroke text by some shadow. Useful, when you white on transparent background.
2
+ //
3
+ // .banner
4
+ // background: black(0.2)
5
+ // color: white
6
+ // +stroke-text(black)
7
+ @mixin stroke-text($color)
8
+ text-shadow: 1px 1px 1px $color, 1px -1px 1px $color, 1px 1px 1px $color, -1px -1px 1px $color
@@ -0,0 +1,11 @@
1
+ // Disable standard browser tap highlight and transitions for hover and tapped
2
+ // states.
3
+ //
4
+ // +styled-taps
5
+ //
6
+ // Must be used with `evil-front/tappable` JS and `no-hover` Sass mixin.
7
+ @mixin styled-taps
8
+ .is-tapped, :active
9
+ transition: none !important
10
+ body
11
+ +no-tap-highlight
@@ -0,0 +1,6 @@
1
+ // Add "px" if unit is unitless. Used in +media and +size.
2
+ @function to-px($var)
3
+ @if unitless($var)
4
+ @return $var * 1px
5
+ @else
6
+ @return $var
@@ -0,0 +1,18 @@
1
+ @import "rails-sass-images"
2
+
3
+ @import "evil-front/to-px"
4
+
5
+ @import "evil-front/size"
6
+ @import "evil-front/reset"
7
+ @import "evil-front/media"
8
+ @import "evil-front/colors"
9
+ @import "evil-front/height"
10
+ @import "evil-front/easings"
11
+ @import "evil-front/no-hover"
12
+ @import "evil-front/clearfix"
13
+ @import "evil-front/styled-taps"
14
+ @import "evil-front/stroke-text"
15
+ @import "evil-front/import-ruble"
16
+ @import "evil-front/flying-quotes"
17
+ @import "evil-front/sticky-footer"
18
+ @import "evil-front/no-tap-highlight"
@@ -0,0 +1,8 @@
1
+ module EvilFront::Helpers
2
+ # Capitalize only first letter (like titles in Russian).
3
+ #
4
+ # = capitalize_first post.title
5
+ def capitalize_first(text)
6
+ EvilFront::Russian.capitalize_first(text)
7
+ end
8
+ end
@@ -0,0 +1,13 @@
1
+ module EvilFront::Helpers
2
+ # Disable user zoom in mobile browsers. You should use it only if your styles
3
+ # are special optimized for mobile screens.
4
+ #
5
+ # html
6
+ # head
7
+ # = disable_mobile_zoom
8
+ def disable_mobile_zoom
9
+ html = '<meta name="viewport" content="width=device-width, ' +
10
+ 'initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />'
11
+ EvilFront.html_safe(html)
12
+ end
13
+ end
@@ -0,0 +1,20 @@
1
+ module EvilFront::Helpers
2
+ # Mark quotes to move first quote before the text line.
3
+ #
4
+ # = flying_quotes feedback.text
5
+ #
6
+ # You can send block:
7
+ #
8
+ # = flying_quotes do
9
+ # a href=course.url
10
+ # = course.name
11
+ def flying_quotes(text = nil, options = { }, &block)
12
+ text = if block_given?
13
+ capture(&block).strip
14
+ else
15
+ EvilFront.escape(text)
16
+ end
17
+ text = EvilFront::Russian.flying_quotes(text, options)
18
+ EvilFront.html_safe(text)
19
+ end
20
+ end
@@ -0,0 +1,10 @@
1
+ module EvilFront::Helpers
2
+ # Add content to head tag. Will be useful in page views.
3
+ #
4
+ # - head_content do
5
+ # meta name="description" content=page.seo.description
6
+ # meta name="keywords" content=page.seo.keywords
7
+ def head_content(&block)
8
+ content_for(:evil_front_head, &block)
9
+ end
10
+ end
@@ -0,0 +1,26 @@
1
+ module EvilFront::Helpers
2
+ # Add content from `head_content` and statistics counter in production,
3
+ # if you set `:stats` option.
4
+ #
5
+ # html
6
+ # head
7
+ # = head_tag do
8
+ # = title_tag(t.title)
9
+ # = standard_assets
10
+ #
11
+ # You can disable statistics counter by options:
12
+ #
13
+ # = head_tag(statistics: false) do
14
+ def head_tag(options = { }, &block)
15
+ head = tag(:meta, charset: 'UTF-8')
16
+ head += capture(&block) if block_given?
17
+ head += content_for(:evil_front_head)
18
+
19
+ options[:statistics] = true unless options.has_key? :statistics
20
+ if options[:statistics] and Rails.env.production?
21
+ head += render('layouts/statistics') rescue ''
22
+ end
23
+
24
+ content_tag(:head, head)
25
+ end
26
+ end
@@ -0,0 +1,15 @@
1
+ # encoding: utf-8
2
+
3
+ module EvilFront::Helpers
4
+ # Insert symbol of Russian currency.
5
+ #
6
+ # = order.price
7
+ # = ruble
8
+ #
9
+ # Don’t forget to import ruble’s fonts and class in you Sass:
10
+ #
11
+ # +import-ruble("PT Sane, sans-serif", $regular: inline)
12
+ def ruble
13
+ EvilFront.html_safe('<span class="ruble">Р</span>')
14
+ end
15
+ end
@@ -0,0 +1,21 @@
1
+ module EvilFront::Helpers
2
+ # Insert non-break spaces and mark quotes to have nice text. Work only with
3
+ # Russian language.
4
+ #
5
+ # = typograph user.description
6
+ #
7
+ # You can send block:
8
+ #
9
+ # = typograph do
10
+ # = user.name
11
+ # = user.profession
12
+ def russian_typograph(text = nil, &block)
13
+ text = if block_given?
14
+ capture(&block)
15
+ else
16
+ EvilFront.escape(text)
17
+ end
18
+ text = EvilFront::Russian.typograph_html(text)
19
+ EvilFront.html_safe(text)
20
+ end
21
+ end
@@ -0,0 +1,13 @@
1
+ module EvilFront::Helpers
2
+ # Add `application.css`, jQuery from Google CDN and `application.js`.
3
+ #
4
+ # html
5
+ # = head_tag do
6
+ # = standard_assets
7
+ def standard_assets(attributes = { })
8
+ stylesheet_link_tag('application', media: 'all') +
9
+ include_jquery(attributes.dup) +
10
+ content_for(:evil_libraries) +
11
+ javascript_include_tag('application', attributes)
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ module EvilFront::Helpers
2
+ # Render link with phone number. It will remove all non-digits symbols from
3
+ # phone number and format `tel:` protocol URI.
4
+ #
5
+ # label Contact us:
6
+ # = tel('+7 (495) 660−83−79')
7
+ def tel(number, args = { })
8
+ args[:href] = "tel:" + number.gsub(/[^\d\+]/, '')
9
+ args[:class] = (['tel', args[:class]]).compact.join(' ')
10
+ content_tag(:a, number, args)
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+ module EvilFront::Helpers
2
+ # Add page title. Will be used with site title in document title tag by
3
+ # `title_tag`.
4
+ #
5
+ # - title 'FAQ'
6
+ #
7
+ # You can set subtitles (order will be reversed):
8
+ #
9
+ # - title 'FAQ', 'Ask'
10
+ def title(*titles)
11
+ @evil_front_titles ||= []
12
+ @evil_front_titles += titles
13
+ end
14
+ end
@@ -0,0 +1,27 @@
1
+ # encoding: utf-8
2
+
3
+ require 'i18n'
4
+
5
+ module EvilFront::Helpers
6
+ # Return title tag with current page title. It will just join page titles
7
+ # from `title` helper and `site` name.
8
+ #
9
+ # By default, separator will be m-dash for Russian and n-dash for others.
10
+ #
11
+ # html
12
+ # head
13
+ # = title_tag('Foo Company')
14
+ #
15
+ # Separator will be taken by current locale. But, you can change it by
16
+ # `separator` option:
17
+ #
18
+ # = title_tag('Foo Company', separator: ' * ')
19
+ def title_tag(*site)
20
+ @evil_front_titles ||= []
21
+ options = site.extract_options!
22
+ separator = options[:separator] || (I18n.locale == :ru ? ' — ' : ' - ')
23
+ titles = (@evil_front_titles + site).compact
24
+ titles = titles.join(separator)
25
+ EvilFront.html_safe("<title>#{ EvilFront.escape(titles) }</title>")
26
+ end
27
+ end
@@ -0,0 +1,25 @@
1
+ module EvilFront
2
+ HTML_ESCAPE = { '&' => '&amp;', '>' => '&gt;', '<' => '&lt;' }
3
+
4
+ # Call `html_safe` if String has this methods.
5
+ def self.html_safe(string)
6
+ if string.respond_to?(:html_safe)
7
+ string.html_safe
8
+ else
9
+ string.to_s
10
+ end
11
+ end
12
+
13
+ # Escape unsafe strings
14
+ def self.escape(string)
15
+ string = string.to_s
16
+ if not string.respond_to?(:html_safe?) or string.html_safe?
17
+ string
18
+ else
19
+ string.gsub(/[&><]/, HTML_ESCAPE).html_safe
20
+ end
21
+ end
22
+ end
23
+
24
+ dir = Pathname(__FILE__).dirname.join('helpers')
25
+ Dir.glob(dir.join('*.rb').to_s) { |helper| require helper }
@@ -0,0 +1,84 @@
1
+ # encoding: utf-8
2
+
3
+ require 'unicode_utils'
4
+ require 'nokogiri'
5
+ require 'standalone_typograf'
6
+
7
+ module EvilFront
8
+ # Helpers to work with Russian text.
9
+ module Russian
10
+ # Capitalize only first letter (like titles in Russian).
11
+ #
12
+ # = EvilFront::Russian.capitalize_first(title)
13
+ def self.capitalize_first(text)
14
+ UnicodeUtils.upcase(text[0]) + text[1..-1]
15
+ end
16
+
17
+ # Insert non-break spaces and mark quotes to have nice text. Work only with
18
+ # Russian language.
19
+ #
20
+ # EvilFront::Russian.typograph(article)
21
+ def self.typograph(text)
22
+ return text if text.nil? or text.empty?
23
+
24
+ text = StandaloneTypograf::Typograf.new(text).prepare
25
+
26
+ tiny = %w(ни не и но а или да как из-за про по за для
27
+ на до при меж о у в во с со от ото из без
28
+ безо к ко об обо под подо над перед передо)
29
+ tiny += tiny.map { |i| capitalize_first(i) }
30
+ tiny.each do |word|
31
+ regexp = Regexp.new(" #{Regexp.quote word} ") # fix JRuby issue
32
+ text.gsub! regexp, " #{word} " # non-break space
33
+ end
34
+
35
+ text.gsub!(/([^\s" ]+)-([^\s" ]+)/, '\1‑\2')
36
+
37
+ text
38
+ end
39
+
40
+ # Like `typograph`, but process only text nodes in HTML.
41
+ #
42
+ # EvilFront::Russian.typograph_html(article.html)
43
+ def self.typograph_html(html)
44
+ return html if html.nil? or html.empty?
45
+
46
+ if html.include? '<'
47
+ nodes = Nokogiri::HTML::DocumentFragment.parse(html)
48
+ typograph_node! nodes
49
+ nodes.to_html
50
+ else
51
+ auto_flying_quotes(typograph(html))
52
+ end
53
+ end
54
+
55
+ # Find quotes in text and make them flying
56
+ def self.auto_flying_quotes(text)
57
+ text.gsub(/\s«[^»]+»/) { |i| flying_quotes i[2..-2], space: i[0] }.
58
+ gsub(/^«[^»]+»/) { |i| flying_quotes i[1..-2], space: '' }
59
+ end
60
+
61
+ # Mark quotes to move first quote before the text line.
62
+ def self.flying_quotes(text, options = { })
63
+ sp = options[:space] || ' '
64
+ sp = "<span class=\"space-before-quote\">#{sp}</span>" if sp != ''
65
+ "#{ sp }<span class=\"quotes\">«#{ text }»</span>"
66
+ end
67
+
68
+ private
69
+
70
+ # Recursively apply typography to Nokogiri nodes
71
+ def self.typograph_node!(node)
72
+ return if node.name == 'code'
73
+
74
+ node.children.each do |child|
75
+ if child.is_a? Nokogiri::XML::Text
76
+ text = EvilFront.escape(child.content)
77
+ child.replace( auto_flying_quotes(typograph(text)) )
78
+ else
79
+ typograph_node! child
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,6 @@
1
+ module EvilFront
2
+ # Set default options to Slim
3
+ def self.set_slim_options!
4
+ Slim::Engine.set_default_options(pretty: true, format: :html5)
5
+ end
6
+ end
@@ -0,0 +1,3 @@
1
+ module EvilFront
2
+ VERSION = '0.1.0' unless defined? EvilFront::VERSION
3
+ end
data/lib/evil-front.rb ADDED
@@ -0,0 +1,30 @@
1
+ require 'pathname'
2
+
3
+ require 'slim'
4
+ require 'sass'
5
+ require 'sprockets'
6
+ require 'rails-sass-images'
7
+
8
+ module EvilFront
9
+ autoload :Russian, 'evil-front/russian'
10
+
11
+ if defined?(::Rails)
12
+ # Enable `lib/assets/` and `vendor/assets/` in Rails app.
13
+ class Engine < ::Rails::Engine
14
+ end
15
+ end
16
+
17
+ # Install Evil Front to standalone Sprockets environment.
18
+ def self.install(sprockets)
19
+ RailsSassImages.install(sprockets)
20
+
21
+ root = Pathname(__FILE__).dirname.join('..')
22
+ sprockets.append_path(root.join('lib/assets/javascripts'))
23
+ sprockets.append_path(root.join('lib/assets/stylesheets'))
24
+ sprockets.append_path(root.join('vendor/assets/fonts'))
25
+ end
26
+ end
27
+
28
+ require_relative 'evil-front/version'
29
+ require_relative 'evil-front/helpers'
30
+ require_relative 'evil-front/slim'
@@ -0,0 +1,98 @@
1
+ # encoding: utf-8
2
+
3
+ require_relative 'spec_helper'
4
+ require 'slim'
5
+
6
+ describe EvilFront::Helpers do
7
+ include EvilFront::Helpers
8
+
9
+ describe 'capitalize_first' do
10
+
11
+ it 'capitalizes Russian' do
12
+ capitalize_first('тест').should == 'Тест'
13
+ end
14
+
15
+ end
16
+
17
+ describe 'disable_mobile_zoom' do
18
+
19
+ it 'returns viewport meta tag' do
20
+ disable_mobile_zoom.should =~ /^<meta name="viewport" /
21
+ end
22
+
23
+ end
24
+
25
+ describe 'flying_quotes' do
26
+
27
+ it 'set quotes to text' do
28
+ flying_quotes('a').should == '<span class="space-before-quote"> </span>' +
29
+ '<span class="quotes">«a»</span>'
30
+ end
31
+
32
+ it 'escapes HTML' do
33
+ flying_quotes('<br>').should ==
34
+ '<span class="space-before-quote"> </span>' +
35
+ '<span class="quotes">«&lt;br&gt;»</span>'
36
+ end
37
+
38
+ end
39
+
40
+ describe 'ruble' do
41
+
42
+ it 'returns span' do
43
+ ruble.should be_a(String)
44
+ end
45
+
46
+ end
47
+
48
+ describe 'russian_typograph' do
49
+
50
+ it 'typograps text inside tags' do
51
+ tag = '<a title="а - б">а - б</a>'.html_safe
52
+ russian_typograph(tag).should == '<a title="а - б">а — б</a>'
53
+ end
54
+
55
+ it 'escapes HTML' do
56
+ russian_typograph('<a>').should == '&lt;a&gt;'
57
+ end
58
+
59
+ end
60
+
61
+ describe 'title' do
62
+ after do
63
+ I18n.locale = :en
64
+ @evil_front_titles = nil
65
+ end
66
+
67
+ it 'shows site name' do
68
+ title_tag('Site').should == '<title>Site</title>'
69
+ end
70
+
71
+ it 'shows site names' do
72
+ title_tag('One', 'Two').should == '<title>One - Two</title>'
73
+ end
74
+
75
+ it 'shows page name' do
76
+ title 'Page', 'Section'
77
+ title_tag('Site').should == '<title>Page - Section - Site</title>'
78
+ end
79
+
80
+ it 'shows Russian separator' do
81
+ I18n.locale = :ru
82
+ title 'Страница', 'Раздел'
83
+ title_tag('Сайт').should == '<title>Страница — Раздел — Сайт</title>'
84
+ end
85
+
86
+ it 'shows custom separator' do
87
+ title 'One', 'Two'
88
+ title_tag(separator: ' | ').should == '<title>One | Two</title>'
89
+ end
90
+
91
+ it 'escapes HTML' do
92
+ title '<B>'
93
+ title_tag.should == '<title>&lt;B&gt;</title>'
94
+ end
95
+
96
+ end
97
+
98
+ end
@@ -0,0 +1,100 @@
1
+ # encoding: utf-8
2
+
3
+ require_relative 'spec_helper'
4
+
5
+ describe EvilFront::Russian do
6
+
7
+ describe 'capitalize_first' do
8
+
9
+ it 'capitalizes first letter in russian text' do
10
+ EvilFront::Russian.capitalize_first('тест тест').should == 'Тест тест'
11
+ end
12
+
13
+ end
14
+
15
+ describe 'flying_quotes' do
16
+
17
+ it 'inserts tags and quotes with space by default' do
18
+ EvilFront::Russian.flying_quotes('тест').should ==
19
+ '<span class="space-before-quote"> </span>' +
20
+ '<span class="quotes">«тест»</span>'
21
+ end
22
+
23
+ it 'inserts specified space' do
24
+ EvilFront::Russian.flying_quotes('тест', space: '-').should ==
25
+ '<span class="space-before-quote">-</span>' +
26
+ '<span class="quotes">«тест»</span>'
27
+ end
28
+
29
+ it 'ignores space on request' do
30
+ EvilFront::Russian.flying_quotes('тест', space: '').should ==
31
+ '<span class="quotes">«тест»</span>'
32
+ end
33
+
34
+ end
35
+
36
+ describe 'auto_flying_quotes' do
37
+
38
+ it 'replaces quotes on start' do
39
+ EvilFront::Russian.auto_flying_quotes('«тест»').should ==
40
+ '<span class="quotes">«тест»</span>'
41
+ end
42
+
43
+ it 'replaces quotes in middle' do
44
+ EvilFront::Russian.auto_flying_quotes('на «тесте».').should ==
45
+ 'на<span class="space-before-quote"> </span>' +
46
+ '<span class="quotes">«тесте»</span>.'
47
+ end
48
+
49
+ end
50
+
51
+ describe 'typograph' do
52
+
53
+ it 'changes quotes' do
54
+ EvilFront::Russian.typograph('сказал "смотри "зорко"".').should ==
55
+ 'сказал «смотри „зорко“».'
56
+ end
57
+
58
+ it 'changes dashes' do
59
+ EvilFront::Russian.typograph('а - это б').should == 'а — это б'
60
+ end
61
+
62
+ it 'changes ellipsis' do
63
+ EvilFront::Russian.typograph('а...').should == 'а…'
64
+ end
65
+
66
+ it 'inserts non-break spaces' do
67
+ EvilFront::Russian.typograph('оно не надо').should == 'оно не надо'
68
+ end
69
+
70
+ end
71
+
72
+ describe 'typograph_html' do
73
+
74
+ it 'typographs plain text' do
75
+ EvilFront::Russian.typograph_html('а - б').should == 'а — б'
76
+ end
77
+
78
+ it 'typographs only in text nodes' do
79
+ EvilFront::Russian.typograph_html('<a title="а - б">а - б</a>').should ==
80
+ '<a title="а - б">а — б</a>'
81
+ end
82
+
83
+ it 'ignores code tags' do
84
+ EvilFront::Russian.typograph_html('<code>а - б</code>').should ==
85
+ '<code>а - б</code>'
86
+ end
87
+
88
+ it 'keeps escaping' do
89
+ EvilFront::Russian.typograph_html('<b>&lt;a&gt;</b>').should ==
90
+ '<b>&lt;a&gt;</b>'
91
+ end
92
+
93
+ it 'inserts flying quotes' do
94
+ EvilFront::Russian.typograph_html('<a>"ссылка"</a>').should ==
95
+ '<a><span class="quotes">«ссылка»</span></a>'
96
+ end
97
+
98
+ end
99
+
100
+ end
File without changes
@@ -0,0 +1,3 @@
1
+ @import "evil-front"
2
+
3
+ +import-ruble("PT Sans, sans-serif", $italic: "inline")
@@ -0,0 +1,7 @@
1
+ @import "evil-front"
2
+
3
+ a
4
+ content: inline("empty.txt")
5
+ background: black(0.5)
6
+ transition: all 1s $easeInSine
7
+ +clearfix
@@ -0,0 +1,9 @@
1
+ @import "evil-front"
2
+
3
+ .one
4
+ +max-width(100)
5
+ color: black
6
+
7
+ .two
8
+ +min-width(200px)
9
+ color: white
@@ -0,0 +1,3 @@
1
+ @import "evil-front"
2
+
3
+ +import-ruble("PT Sans, sans-serif")
@@ -0,0 +1,10 @@
1
+ @import "evil-front"
2
+
3
+ .all
4
+ +size(10px, 20px)
5
+
6
+ .one
7
+ +size(30px)
8
+
9
+ .no-unit
10
+ +size(15)