├── .gitignore
├── .travis.yml
├── CHANGES.txt
├── Gemfile
├── Gemfile.lock
├── MIT_LICENSE
├── README.rdoc
├── Rakefile
├── VERSION
├── html_to_plain_text.gemspec
├── lib
└── html_to_plain_text.rb
└── spec
├── html_to_plain_text_spec.rb
└── spec_helper.rb
/.gitignore:
--------------------------------------------------------------------------------
1 | pkg
2 | tmp
3 | rdoc
4 | *.rbc
5 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: ruby
2 | cache: bundler
3 | sudo: false
4 | rvm:
5 | - 1.9.3
6 | - 2.0.0
7 | - 2.1.7
8 | - 2.2.3
9 | - rbx
10 | - jruby
11 |
--------------------------------------------------------------------------------
/CHANGES.txt:
--------------------------------------------------------------------------------
1 | 1.0.5
2 |
3 | Only add pipes on tables if border attributes set to non-zero value.
4 |
5 | 1.0.4
6 |
7 | Small tweak to outputing link URLs when they don't make sense.
8 |
9 | 1.0.3
10 |
11 | * improve performance slightly by replacing runtime strings with constants
12 | * testing on modern rubies (grosser)
13 | * using gemspec in Gemfile (grosser)
14 | * not shipping test files for smaller gem / faster installs / smaller cached gems (grosser)
15 | * rake bump:patch -> increment version (grosser)
16 | * rake release -> ship new version (grosser)
17 |
18 | 1.0.2
19 |
20 | * remove trailing whitespace on converted text.
21 |
22 | 1.0.1
23 |
24 | * better handling of non-html or nil text
25 |
26 | 1.0.0
27 |
28 | * initial release
29 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source 'http://rubygems.org'
2 |
3 | gemspec
4 |
5 | gem 'byebug', :platform => (RUBY_VERSION > "2.0.0" ? :mri : :mswin)
6 |
--------------------------------------------------------------------------------
/Gemfile.lock:
--------------------------------------------------------------------------------
1 | PATH
2 | remote: .
3 | specs:
4 | html_to_plain_text (1.0.5)
5 | nokogiri (>= 1.4.0)
6 |
7 | GEM
8 | remote: http://rubygems.org/
9 | specs:
10 | bump (0.5.2)
11 | byebug (8.2.1)
12 | diff-lcs (1.2.5)
13 | mini_portile (0.6.2)
14 | nokogiri (1.6.6.2)
15 | mini_portile (~> 0.6.0)
16 | rake (0.9.2)
17 | rspec (3.3.0)
18 | rspec-core (~> 3.3.0)
19 | rspec-expectations (~> 3.3.0)
20 | rspec-mocks (~> 3.3.0)
21 | rspec-core (3.3.2)
22 | rspec-support (~> 3.3.0)
23 | rspec-expectations (3.3.1)
24 | diff-lcs (>= 1.2.0, < 2.0)
25 | rspec-support (~> 3.3.0)
26 | rspec-mocks (3.3.2)
27 | diff-lcs (>= 1.2.0, < 2.0)
28 | rspec-support (~> 3.3.0)
29 | rspec-support (3.3.0)
30 |
31 | PLATFORMS
32 | ruby
33 |
34 | DEPENDENCIES
35 | bump
36 | byebug
37 | html_to_plain_text!
38 | rake
39 | rspec (> 2.6.0)
40 |
41 | BUNDLED WITH
42 | 1.10.6
43 |
--------------------------------------------------------------------------------
/MIT_LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011 Brian Durand
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be
12 | included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/README.rdoc:
--------------------------------------------------------------------------------
1 | = HTML To Plain Text
2 |
3 | gem install html_to_plain_text
4 |
5 | A simple gem that provide code to convert HTML into a plain text alternative. Line breaks from HTML block level elements will be maintained. Lists and tables will also maintain a little bit of formatting.
6 |
7 | * Line breaks will be approximated using the generally established default margins for HTML tags (i.e.
8 | tag generates two line breaks,