truncate_html_text 0.0.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 086f01f8c351b7033c715cc1d272ca43ae91a0ed
4
- data.tar.gz: 0b2c6323e6ccc4bdc5335c09aa7bd7612d5cd028
3
+ metadata.gz: da1dae46e4b0d66ed6ee47309a50aad00ef15866
4
+ data.tar.gz: 7635f874a28c14ee1b2527f6c65c5404b5b87ed5
5
5
  SHA512:
6
- metadata.gz: 71cbf1b72c591316440fb61a34073f4bf3c32a24103dcb70834cbef18ce70765613f8797c7b8cfacf56cfe928e7227708b60f846030aad30cf439fb25e863cb9
7
- data.tar.gz: 71e3efdd657b0eb24c161534b87f89b737cd65ad1225aff8282f31d6ff74e484e6350f1dae001f69b2d81836b4bbd9191d19812d771a77f85cb7a85d04af8197
6
+ metadata.gz: 0f5a561baac594e7ab8f2ecddc40d454e0d97528814b470aeb41ed362bfcfc2bbeb1d5e6accd75003838984ce9ce215db7a5309d7532199196e08777a029b99c
7
+ data.tar.gz: 5f8d8f2ca9b64498b72d95bd99bf252417bf3ec49b9e5c6485e38714a97d64328533e3ab7cce413477b3502e3f3210dc957ce3a9f8ebbc0b8eae97e9f055a355
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.2
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015 TODO: Write your name
1
+ Copyright (c) 2015-2017 Tarun Agrawal
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,6 +1,13 @@
1
+ [![Gem Version](https://badge.fury.io/rb/truncate_html_text.svg)][gem]
2
+ [![License](http://img.shields.io/license/MIT.png?color=green)][license]
3
+
4
+ [gem]: http://badge.fury.io/rb/truncate_html_text
5
+ [license]: http://opensource.org/licenses/MIT
6
+
1
7
  # TruncateHtmlText
2
8
 
3
- TODO: Write a gem description
9
+ This gem allows users to truncate html or non-html text by using options.
10
+ This gem provides an easy way to integrate `truncate_html_text` jQuery plugin with your Rails apps.
4
11
 
5
12
  ## Installation
6
13
 
@@ -20,7 +27,77 @@ Or install it yourself as:
20
27
 
21
28
  ## Usage
22
29
 
23
- TODO: Write usage instructions here
30
+ To insert JavaScript files in your Rails app, add following line in your `app/assets/javascripts/application.js` file (make sure to add after requiring `jquery`).
31
+
32
+ ```javascript
33
+ //= require truncate_html_text_main
34
+ ```
35
+
36
+
37
+ ```rails
38
+ <%= truncate_html_text_tag(:div, '<p>Truncate Html <i>text</i></p>')%>
39
+ <div class="truncate"><p>Truncate Html <i>text</i></p></div>
40
+ ```
41
+
42
+
43
+ ## Options
44
+
45
+ Default options are...
46
+
47
+ ### length
48
+
49
+ *Default: Infinity*
50
+
51
+ The maximum length (including the ellipsis) of the truncated html.
52
+
53
+ ```rails
54
+ <%= truncate_html_text_tag(:div, '<p>Truncate Html <i>text</i></p>', data:{length:20})%>
55
+ <div class="truncate" data-length="20"><p>Truncate Html <i>t...</i></p></div>
56
+ ```
57
+
58
+ ### stripTags
59
+
60
+ *Default: false*
61
+
62
+ If `stripTags` is truthy all html tags will be stipped, leaving only the text.
63
+
64
+ ```rails
65
+ <%= truncate_html_text_tag(:div, '<p>Truncate Html <i>text</i></p>', data:{length:20, stripTags: true})%>
66
+ <div class="truncate" data-length="20" data-stripTags="true">Truncate Html t...</div>
67
+ ```
68
+
69
+ ### words
70
+
71
+ *Default: false*
72
+
73
+ If `words` is truthy the input will only be truncated at word boundaries.
74
+
75
+ ```rails
76
+ <%= truncate_html_text_tag(:div, '<p>Truncate Html <i>text</i></p>', data:{length:20, words: true})%>
77
+ <div class="truncate" data-length="20" data-words="true"><p>Truncate Html...</p></div>
78
+ ```
79
+
80
+ ### noBreaks
81
+
82
+ *Default: false*
83
+
84
+ If `noBreaks` is truthy the input will contain no break elements.
85
+
86
+ ```rails
87
+ <%= truncate_html_text_tag(:div, '<p>Truncate Html <br><i>text</i></p>', data:{length:20, noBreaks: true})%>
88
+ <div class="truncate" data-length="20" data-noBreaks="true"><p>Truncate Html <i>t...</i></p></div>
89
+ ```
90
+
91
+ ### ellipsis
92
+
93
+ *Default: '…'*
94
+
95
+ The `ellipsis` setting is used to provide a different character for the ellipsis.
96
+
97
+ ```rails
98
+ <%= truncate_html_text_tag(:div, '<p>Truncate Html <br><i>text</i></p>', data:{length:20, ellipsis: '~'})%>
99
+ <div class="truncate" data-length="20" data-ellipsis="true"><p>Truncate Html <i>t~</i></p></div>
100
+ ```
24
101
 
25
102
  ## Contributing
26
103
 
data/Rakefile CHANGED
@@ -1,2 +1,11 @@
1
+ require 'rake/testtask'
1
2
  require "bundler/gem_tasks"
2
3
 
4
+ Rake::TestTask.new do |t|
5
+ t.libs << 'test'
6
+ t.test_files = FileList['lib/test/test*.rb']
7
+ t.verbose = true
8
+ end
9
+
10
+ desc 'Run tests'
11
+ task :default => :test
@@ -0,0 +1,9 @@
1
+ require "minitest/autorun"
2
+
3
+ class TestHelperMethod < Minitest::Test
4
+
5
+ def test_that_kitty_can_eat
6
+ assert true
7
+ end
8
+
9
+ end
@@ -1,3 +1,3 @@
1
1
  module TruncateHtmlText
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -1,7 +1,7 @@
1
- require_relative "truncate_html_text/version"
2
- require_relative "truncate_html_text/engine"
3
- require_relative "truncate_html_text/truncate_html_text_helper"
4
- require_relative "truncate_html_text/railtie"
1
+ require "truncate_html_text/version"
2
+ require "truncate_html_text/engine"
3
+ require "truncate_html_text/truncate_html_text_helper"
4
+ require "truncate_html_text/railtie"
5
5
 
6
6
  #module TruncateHtmlText
7
7
  # Your code goes here...
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Tarun Agrawal"]
10
10
  spec.email = ["tarun7588@gmail.com"]
11
11
  spec.summary = %q{Rails HTML Text Truncate}
12
- spec.description = %q{This is a Rails gem for Html Text Truncate}
13
- spec.homepage = ""
12
+ spec.description = %q{This is a Rails gem for Truncate Html Text}
13
+ spec.homepage = "https://github.com/iamtarun/truncate_html_text"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.7"
21
+ spec.add_development_dependency "bundler", '>= 1.0'
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "minitest"
23
24
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: truncate_html_text
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tarun Agrawal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-30 00:00:00.000000000 Z
11
+ date: 2015-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.7'
19
+ version: '1.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.7'
26
+ version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,7 +38,21 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
- description: This is a Rails gem for Html Text Truncate
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
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
+ description: This is a Rails gem for Truncate Html Text
42
56
  email:
43
57
  - tarun7588@gmail.com
44
58
  executables: []
@@ -46,6 +60,7 @@ extensions: []
46
60
  extra_rdoc_files: []
47
61
  files:
48
62
  - ".gitignore"
63
+ - ".travis.yml"
49
64
  - Gemfile
50
65
  - LICENSE.txt
51
66
  - README.md
@@ -53,13 +68,14 @@ files:
53
68
  - app/assets/javascripts/truncate_html_text.js
54
69
  - app/assets/javascripts/truncate_html_text_initializer.js
55
70
  - app/assets/javascripts/truncate_html_text_main.js
71
+ - lib/test/test_helper_method.rb
56
72
  - lib/truncate_html_text.rb
57
73
  - lib/truncate_html_text/engine.rb
58
74
  - lib/truncate_html_text/railtie.rb
59
75
  - lib/truncate_html_text/truncate_html_text_helper.rb
60
76
  - lib/truncate_html_text/version.rb
61
77
  - truncate_html_text.gemspec
62
- homepage: ''
78
+ homepage: https://github.com/iamtarun/truncate_html_text
63
79
  licenses:
64
80
  - MIT
65
81
  metadata: {}