jekyll-typogrify 0.2.0 → 0.3.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 +4 -4
- data/.editorconfig +3 -0
- data/.gitignore +1 -0
- data/CONTRIBUTING.md +21 -0
- data/README.md +93 -6
- data/bin/server +5 -0
- data/bin/setup +0 -2
- data/bin/test +5 -0
- data/jekyll-typogrify.gemspec +8 -7
- data/lib/jekyll/typogrify/version.rb +1 -1
- data/lib/jekyll/typogrify.rb +25 -10
- data/screenshots/after.png +0 -0
- data/screenshots/before.png +0 -0
- metadata +9 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 0a7a52249e9456f56e2493916d691b1c5d61442d
         | 
| 4 | 
            +
              data.tar.gz: 671eb9d8b6d1b07def4f1a4c55b84057ead7383a
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 10e8a84ed26241289868fde1dc772313f6eef5f2da07a8990441e95d5ae038328efdb3049622e491f8039df3d255b765a43ef9fcda8cf0b0c22be1b26b261cdb
         | 
| 7 | 
            +
              data.tar.gz: 357660fef7529d17f3aa80e1ab5f7869a9daaadf09d0d2c6ef1ea0b8ad8581e556541d61039ddae7db357904de7aee37ecb89f084f974677aa5f19c7fafd2f7c
         | 
    
        data/.editorconfig
    ADDED
    
    
    
        data/.gitignore
    CHANGED
    
    
    
        data/CONTRIBUTING.md
    ADDED
    
    | @@ -0,0 +1,21 @@ | |
| 1 | 
            +
            # Contributing
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            I love to get pull requests from everyone. By participating in this project, you agree to abide by the [code of conduct](CODE_OF_CONDUCT.md).
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            [Fork](https://github.com/myles/jekyll-typogrify/fork), then clone the repo:
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            	git clone git@github.com:your-username/jekyll-typogrify.git
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            Set up your machine:
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            	./bin/setup
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            Make sure the tests pass
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            	./bin/test
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            Make your change. Add tests for your change. Make the tests pass:
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            	./bin/test
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            Push to your fork and [submit a pull request](https://github.com/myles/jekyll-typogrify/compare/).
         | 
    
        data/README.md
    CHANGED
    
    | @@ -1,8 +1,12 @@ | |
| 1 | 
            +
            [](https://travis-ci.org/myles/jekyll-typogrify) [](http://badge.fury.io/rb/jekyll-typogrify) [](https://www.quantifiedcode.com/app/project/e017e34c1f35482e87e0ea12390ef7cc)
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            # Jekyll::Typogrify
         | 
| 2 4 |  | 
| 3 5 | 
             
            Improves typography on your Jekyll site using [typogruby](http://avdgaag.github.io/typogruby/) and [titlecase](https://github.com/samsouder/titlecase).
         | 
| 4 6 |  | 
| 5 | 
            -
             | 
| 7 | 
            +
            | Before | After |
         | 
| 8 | 
            +
            | ------ | ----- |
         | 
| 9 | 
            +
            |  |  |
         | 
| 6 10 |  | 
| 7 11 | 
             
            ## Installation
         | 
| 8 12 |  | 
| @@ -20,8 +24,65 @@ Or install it yourself as: | |
| 20 24 |  | 
| 21 25 | 
             
                $ gem install jekyll-typogrify
         | 
| 22 26 |  | 
| 27 | 
            +
            You now need to enable the plugin in your Jekyll web site. Append it to the `gems` array in your `_config.yml` file:
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            ```yaml
         | 
| 30 | 
            +
            gems:
         | 
| 31 | 
            +
            - jekyll-typogrify
         | 
| 32 | 
            +
            ```
         | 
| 33 | 
            +
             | 
| 23 34 | 
             
            ## Usage
         | 
| 24 35 |  | 
| 36 | 
            +
            ### Andpercent
         | 
| 37 | 
            +
             | 
| 38 | 
            +
            Converts an andpercent (ex. `&`) converts a & surrounded by optional whitespace or a non-breaking space to the HTML entity and surrounds it in a span with a styled class.
         | 
| 39 | 
            +
             | 
| 40 | 
            +
            ```html
         | 
| 41 | 
            +
            <h1>{{ "Mr. & Mrs. Smith" | amp }}</h1>
         | 
| 42 | 
            +
             | 
| 43 | 
            +
            <h1>Mr. <span class="amp">&</span> Mrs. Smith</h1>
         | 
| 44 | 
            +
            ```
         | 
| 45 | 
            +
             | 
| 46 | 
            +
            ### Capitalisation
         | 
| 47 | 
            +
             | 
| 48 | 
            +
            Surrounds two or more consecutive capital letters, perhaps with interspersed digits and periods in a span with a styled class.
         | 
| 49 | 
            +
             | 
| 50 | 
            +
            ```html
         | 
| 51 | 
            +
            <h1>{{ "A.B.C. Corp." | caps }}</h1>
         | 
| 52 | 
            +
             | 
| 53 | 
            +
            <h1><span class="caps">A.B.C.</span> Corp.</h1>
         | 
| 54 | 
            +
            ```
         | 
| 55 | 
            +
             | 
| 56 | 
            +
            ### Entities
         | 
| 57 | 
            +
             | 
| 58 | 
            +
            Converts special characters (excluding HTML tags) to HTML entities.
         | 
| 59 | 
            +
             | 
| 60 | 
            +
            ```html
         | 
| 61 | 
            +
            <p>© Myles Braithwaite</p>
         | 
| 62 | 
            +
             | 
| 63 | 
            +
            <p>© Myles Braithwaite</p>
         | 
| 64 | 
            +
            ```
         | 
| 65 | 
            +
             | 
| 66 | 
            +
            ### Initial Quotes
         | 
| 67 | 
            +
             | 
| 68 | 
            +
            Encloses initial single or double quote, or their entities (optionally preceeded by a block element and perhaps an inline element) with a span that can be styled.
         | 
| 69 | 
            +
             | 
| 70 | 
            +
            ```html
         | 
| 71 | 
            +
            <h1>{{ '"Do not cry because it is over, simile because it happened."' | initial_quotes }}</h1>
         | 
| 72 | 
            +
             | 
| 73 | 
            +
            <h1><span class="dquo">"</span>Do not cry because it is over, simile because it happened."</h1>
         | 
| 74 | 
            +
            ```
         | 
| 75 | 
            +
             | 
| 76 | 
            +
            ### Smartypants
         | 
| 77 | 
            +
             | 
| 78 | 
            +
            Applies smartypants to a given piece of text.
         | 
| 79 | 
            +
             | 
| 80 | 
            +
            ```html
         | 
| 81 | 
            +
            <p>{{ "Today I'm going to the... coffeeshop." | smartypants }}</p>
         | 
| 82 | 
            +
             | 
| 83 | 
            +
            <p>Today I’m going to the… coffeeshop.</p>
         | 
| 84 | 
            +
            ```
         | 
| 85 | 
            +
             | 
| 25 86 | 
             
            ### Widont
         | 
| 26 87 |  | 
| 27 88 | 
             
            Replaces space(s) before the last word (or tag before the last word) before an optional closing element (a, em, span, strong) before a closing tag (p, h[1-6], li, dt, dd) or the end of the string.
         | 
| @@ -32,6 +93,36 @@ Replaces space(s) before the last word (or tag before the last word) before an o | |
| 32 93 | 
             
            <h1>This is a rather long title.</h1>
         | 
| 33 94 | 
             
            ```
         | 
| 34 95 |  | 
| 96 | 
            +
            ### Titlecase
         | 
| 97 | 
            +
             | 
| 98 | 
            +
            Convert a given piece of text to titlecase.
         | 
| 99 | 
            +
             | 
| 100 | 
            +
            ```html
         | 
| 101 | 
            +
            <h1>{{ "i love toronto" | titlecase }}</h1>
         | 
| 102 | 
            +
             | 
| 103 | 
            +
            <h1>I Love Toronto</h1>
         | 
| 104 | 
            +
            ```
         | 
| 105 | 
            +
             | 
| 106 | 
            +
            ### Improve
         | 
| 107 | 
            +
             | 
| 108 | 
            +
            Main function to do all the typogruby functions from the method.
         | 
| 109 | 
            +
             | 
| 110 | 
            +
            ```html
         | 
| 111 | 
            +
            <h1>{{ "Improve This Title" | improve }}</h1>
         | 
| 112 | 
            +
             | 
| 113 | 
            +
            <h1>Improve This Title</h1>
         | 
| 114 | 
            +
            ```
         | 
| 115 | 
            +
             | 
| 116 | 
            +
            ### Letter Spacing
         | 
| 117 | 
            +
             | 
| 118 | 
            +
            Let's make sure click doesn't look like dick.
         | 
| 119 | 
            +
             | 
| 120 | 
            +
            ```html
         | 
| 121 | 
            +
            <p>{{ "There’s more to love with every click." | letter_spacing }}</p>
         | 
| 122 | 
            +
             | 
| 123 | 
            +
            <p>There’s more to love with every <span class="fix-letter-spacing">click</p>.</p>
         | 
| 124 | 
            +
            ```
         | 
| 125 | 
            +
             | 
| 35 126 | 
             
            ## Development
         | 
| 36 127 |  | 
| 37 128 | 
             
            After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
         | 
| @@ -40,8 +131,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To | |
| 40 131 |  | 
| 41 132 | 
             
            ## Contributing
         | 
| 42 133 |  | 
| 43 | 
            -
             | 
| 44 | 
            -
            2. Create your feature branch (`git checkout -b my-new-feature`)
         | 
| 45 | 
            -
            3. Commit your changes (`git commit -am 'Add some feature'`)
         | 
| 46 | 
            -
            4. Push to the branch (`git push origin my-new-feature`)
         | 
| 47 | 
            -
            5. Create a new Pull Request
         | 
| 134 | 
            +
            See [CONTRIBUTING.md](CONTRIBUTING.md).
         | 
    
        data/bin/server
    ADDED
    
    
    
        data/bin/setup
    CHANGED
    
    
    
        data/bin/test
    ADDED
    
    
    
        data/jekyll-typogrify.gemspec
    CHANGED
    
    | @@ -6,22 +6,23 @@ require 'jekyll/typogrify/version' | |
| 6 6 | 
             
            Gem::Specification.new do |spec|
         | 
| 7 7 | 
             
              spec.name          = "jekyll-typogrify"
         | 
| 8 8 | 
             
              spec.version       = Jekyll::Typogrify::VERSION
         | 
| 9 | 
            -
              spec.authors       = ["Myles Braithwaite"]
         | 
| 10 | 
            -
              spec.email         = ["me@mylesbraithwaite.com"]
         | 
| 11 | 
            -
             | 
| 12 9 | 
             
              spec.summary       = %q{A Jekyll plugin that bring the functions of typogruby.}
         | 
| 13 10 | 
             
              spec.description   = %q{A Jekyll plugin that bring the functions of typogruby.}
         | 
| 14 | 
            -
              spec.homepage      = "https://github.com/myles/jekyll-typogrify"
         | 
| 15 11 | 
             
              spec.license       = "MIT"
         | 
| 16 12 |  | 
| 13 | 
            +
              spec.authors       = ["Myles Braithwaite"]
         | 
| 14 | 
            +
              spec.email         = ["me@mylesbraithwaite.com"]
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              spec.homepage      = "http://myles.github.io/jekyll-typogrify/"
         | 
| 17 | 
            +
             | 
| 17 18 | 
             
              spec.files         = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
         | 
| 18 19 | 
             
              spec.bindir        = "exe"
         | 
| 19 20 | 
             
              spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
         | 
| 20 21 | 
             
              spec.require_paths = ["lib"]
         | 
| 21 | 
            -
             | 
| 22 | 
            +
             | 
| 22 23 | 
             
              spec.add_runtime_dependency "typogruby"
         | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 24 | 
            +
              spec.add_runtime_dependency "titlecase"
         | 
| 25 | 
            +
             | 
| 25 26 | 
             
              spec.add_development_dependency "bundler", "~> 1.7"
         | 
| 26 27 | 
             
              spec.add_development_dependency "rspec", "~> 3.0"
         | 
| 27 28 | 
             
              spec.add_development_dependency "rake", "~> 10.0"
         | 
    
        data/lib/jekyll/typogrify.rb
    CHANGED
    
    | @@ -12,16 +12,16 @@ module Jekyll | |
| 12 12 | 
             
                # @param [String] text input text
         | 
| 13 13 | 
             
                # @return [String] input text with ampersands wrapped
         | 
| 14 14 | 
             
                def amp(text)
         | 
| 15 | 
            -
                  return Typogruby.amp(text)
         | 
| 15 | 
            +
                  return Typogruby.amp(text.to_s)
         | 
| 16 16 | 
             
                end
         | 
| 17 17 |  | 
| 18 | 
            -
                # surrounds two or more consecutive  | 
| 18 | 
            +
                # surrounds two or more consecutive capital letters, perhaps with
         | 
| 19 19 | 
             
                # interspersed digits and periods in a span with a styled class.
         | 
| 20 20 | 
             
                #
         | 
| 21 21 | 
             
                # @param [String] text input text
         | 
| 22 22 | 
             
                # @return [String] input text with caps wrapped
         | 
| 23 23 | 
             
                def caps(text)
         | 
| 24 | 
            -
                  return Typogruby.caps(text)
         | 
| 24 | 
            +
                  return Typogruby.caps(text.to_s)
         | 
| 25 25 | 
             
                end
         | 
| 26 26 |  | 
| 27 27 | 
             
                # Converts special characters (excluding HTML tags) to HTML entities.
         | 
| @@ -30,7 +30,7 @@ module Jekyll | |
| 30 30 | 
             
                # @return [String] input text with all special characters converted to
         | 
| 31 31 | 
             
                #   HTML entities.
         | 
| 32 32 | 
             
                def entities(text)
         | 
| 33 | 
            -
                  return Typogruby.entities(text)
         | 
| 33 | 
            +
                  return Typogruby.entities(text.to_s)
         | 
| 34 34 | 
             
                end
         | 
| 35 35 |  | 
| 36 36 | 
             
                # main function to do all the functions from the method.
         | 
| @@ -38,7 +38,7 @@ module Jekyll | |
| 38 38 | 
             
                # @param [String] text input text
         | 
| 39 39 | 
             
                # @return [String] input text with all filters applied
         | 
| 40 40 | 
             
                def improve(text)
         | 
| 41 | 
            -
                  return Typogruby.improve(text)
         | 
| 41 | 
            +
                  return Typogruby.improve(text.to_s)
         | 
| 42 42 | 
             
                end
         | 
| 43 43 |  | 
| 44 44 | 
             
                # encloses initial single or double quote, or their entities
         | 
| @@ -49,7 +49,7 @@ module Jekyll | |
| 49 49 | 
             
                # @return [String] input text with initial quotes wrapped
         | 
| 50 50 |  | 
| 51 51 | 
             
                def initial_quotes(text)
         | 
| 52 | 
            -
                  return Typogruby.initial_quotes(text)
         | 
| 52 | 
            +
                  return Typogruby.initial_quotes(text.to_s)
         | 
| 53 53 | 
             
                end
         | 
| 54 54 |  | 
| 55 55 | 
             
                # Applies smartypants to a given piece of text
         | 
| @@ -58,7 +58,7 @@ module Jekyll | |
| 58 58 | 
             
                # @param [String] text input text
         | 
| 59 59 | 
             
                # @return [String] input text with smartypants applied
         | 
| 60 60 | 
             
                def smartypants(text)
         | 
| 61 | 
            -
                  return Typogruby.smartypants(text)
         | 
| 61 | 
            +
                  return Typogruby.smartypants(text.to_s)
         | 
| 62 62 | 
             
                end
         | 
| 63 63 |  | 
| 64 64 | 
             
                # replaces space(s) before the last word (or tag before the last word)
         | 
| @@ -71,13 +71,28 @@ module Jekyll | |
| 71 71 | 
             
                # @param [String] text input text
         | 
| 72 72 | 
             
                # @return [String] input text with non-breaking spaces inserted
         | 
| 73 73 | 
             
                def widont(text)
         | 
| 74 | 
            -
                  return Typogruby.widont(text)
         | 
| 74 | 
            +
                  return Typogruby.widont(text.to_s)
         | 
| 75 75 | 
             
                end
         | 
| 76 76 |  | 
| 77 | 
            +
                # convert a given piece of text to titlecase
         | 
| 78 | 
            +
                #
         | 
| 79 | 
            +
                # @param [String] text input text
         | 
| 80 | 
            +
                # @return [String] input text convert to titlecase
         | 
| 77 81 | 
             
                def titlecase(text)
         | 
| 78 | 
            -
                  return text.titlecase
         | 
| 82 | 
            +
                  return text.to_s.titlecase
         | 
| 83 | 
            +
                end
         | 
| 84 | 
            +
                
         | 
| 85 | 
            +
                # wraps words in a span class that can look like something else
         | 
| 86 | 
            +
                #
         | 
| 87 | 
            +
                # @param [String] text input text
         | 
| 88 | 
            +
                # @return [String] input text with words that look strange in a span
         | 
| 89 | 
            +
                def letter_spacing(text)
         | 
| 90 | 
            +
                  text.gsub(/(click|clint|final|curt|flicks|flick|clicks|flickering)/im) { |str|
         | 
| 91 | 
            +
                    tag, before, word = $1, $2, $3
         | 
| 92 | 
            +
                    "#{before}<span class=\"fix-letter-spacing\">#{str}</span>"
         | 
| 93 | 
            +
                  }
         | 
| 79 94 | 
             
                end
         | 
| 80 95 | 
             
              end
         | 
| 81 96 | 
             
            end
         | 
| 82 97 |  | 
| 83 | 
            -
            Liquid::Template.register_filter(Jekyll::TypogrifyFilter)
         | 
| 98 | 
            +
            Liquid::Template.register_filter(Jekyll::TypogrifyFilter)
         | 
| Binary file | 
| Binary file | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: jekyll-typogrify
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.3.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Myles Braithwaite
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2016- | 
| 11 | 
            +
            date: 2016-02-26 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: typogruby
         | 
| @@ -101,21 +101,27 @@ executables: [] | |
| 101 101 | 
             
            extensions: []
         | 
| 102 102 | 
             
            extra_rdoc_files: []
         | 
| 103 103 | 
             
            files:
         | 
| 104 | 
            +
            - ".editorconfig"
         | 
| 104 105 | 
             
            - ".gitignore"
         | 
| 105 106 | 
             
            - ".rspec"
         | 
| 106 107 | 
             
            - ".travis.yml"
         | 
| 107 108 | 
             
            - CODE_OF_CONDUCT.md
         | 
| 109 | 
            +
            - CONTRIBUTING.md
         | 
| 108 110 | 
             
            - Gemfile
         | 
| 109 111 | 
             
            - LICENSE.txt
         | 
| 110 112 | 
             
            - README.md
         | 
| 111 113 | 
             
            - Rakefile
         | 
| 112 114 | 
             
            - bin/console
         | 
| 115 | 
            +
            - bin/server
         | 
| 113 116 | 
             
            - bin/setup
         | 
| 117 | 
            +
            - bin/test
         | 
| 114 118 | 
             
            - jekyll-typogrify.gemspec
         | 
| 115 119 | 
             
            - lib/jekyll-typogrify.rb
         | 
| 116 120 | 
             
            - lib/jekyll/typogrify.rb
         | 
| 117 121 | 
             
            - lib/jekyll/typogrify/version.rb
         | 
| 118 | 
            -
             | 
| 122 | 
            +
            - screenshots/after.png
         | 
| 123 | 
            +
            - screenshots/before.png
         | 
| 124 | 
            +
            homepage: http://myles.github.io/jekyll-typogrify/
         | 
| 119 125 | 
             
            licenses:
         | 
| 120 126 | 
             
            - MIT
         | 
| 121 127 | 
             
            metadata: {}
         |