Skip to content

polleverywhere/html_terminator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

                          _ _
      r┐               ,r:ー'´.::.:: .:..`ヽ、
      |i |                f´.::.,__.:::::..::::::::::::::ヽ
      |l |              チr'´    ̄ ̄ヾ;::.:.|
     ,r1|              キ| __ '´ __  l;::..l
     |l ||              }撻鬱ij!'徼i匐}レ''1
     |lr' i|               f{`~゛ツ; ヾ~´ iノ}|
     ||l l|                ぃ  ´'_`   Y´
     ||| l|                ト、 ´ ̄ ` ,ィ{
     ||| i|                    | `ー-‐ '  }`iー -- 、
     ||| l|                ,! i   / ノ  l _,シ ム
     ||| l|               〃ト、_,,,. ;i'メ  |/ ,/  \
    |! ∥             //lliiiiiiiiiiiiiiiill/{r―‐^ i〃/    ヽ
    |l ∥            / ,イllliiiiiiiiiiiiillll/´  /r- ゝ  '     l
    || ∥           / /´フliiiiiiiiiilllll/ ,  /   |/    |
     jlj l|           / ir'    |liiiiiiiilllllli'  /    |   ーイ、
    ム- 、|          ハ |,    /iiiiillllllllll|  /      |      i
    ノ   `i        / lj   /llllllllllllllllll{/       l      |
    ヽ   /          l |  /llllliillllllllllllll|         |       |
   、r┤ ,ム、        | ヽ|  /lliiiiiiiiiillllllllllll}          |      |
   '{ヽ'r_'__ i         〉  l |iiiiiiiiiiiiiiilllllllllll|        | 、    |
   /〉ー-{ ソト 、     /   ||iiiiiiiiiiiiiiiiiillllllll!、       |  二   |
   しt_;ュ',//   ヽ、 /    | |iiiiiiiiiiiiiiiiiiiiillllllヽ、       |    ` |
    (_,イー'      ´     | |iiiiiiiiiiiiiiiiiiiiiiiiiiiiiillヽ、     ||    ヽ |
     └-、   ノ´        | |iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii|     ||      |

HtmlTerminator

Build Status

Visits Active Record fields and terminates unsafe HTML.

Installation

Add this line to your application's Gemfile:

gem 'html_terminator'

And then execute:

$ bundle

Or install it yourself as:

$ gem install html_terminator

Usage

In your Rails models:

terminate_html :field1, :field2, :field3

Options

Out of the box, HTML Terminator will strip out ALL html. You can pass in specific elements you want to preserve like this:

terminate_html :field1, :elements => ["b", "i", "em"]
terminate_html :field2, :elements => ["br"]
terminate_html :field3, :elements => ["em"]

Learn more about configuration options Here

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

Terminate html in Active Record fields

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages