Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bb_tag_closer

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bb_tag_closer

  • 1.0.3
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

BBTagCloser

Automatically detects and closes bb_tags (the ones in forums) in the opposite order that they were added.

"[u]My Underlined Text" becomes "[u]My Underlined Text[/u]"

Tags are case insensitive.

Installation

This gem requires Rails 3.2 or later, it was developed and tested on Rails 3.2.9

Add this line to your application's Gemfile:

gem 'bb_tag_closer'

And then execute:

$ bundle

Or install it yourself as:

$ gem install bb_tag_closer

Usage

To use on a model, call auto_close_bb_tags. This will automatically close bb_tags on text (not string) attributes of the model. If you wish to manually specify which attributes to close bb_tags on, call auto_close_bb_tags_for like so:

auto_close_bb_tags_for :attribute1, attribute2, :on => # callback you wish to close tags on, accepts validation, create, update, and save (is save by default)

If the attributes are protected by mass_assignment using the :as option such as attr_accessible :my_attribute, :as => :my_permission; use auto_close_bb_tags or close_tags_for :attribute1, :mass_assignment_keys => :my_permission or close_tags_for :attribute1, :mass_assignment_keys => [:my_permission1, :my_permission2]

BBTagCloser closes [b], [i], [u], [s], [quote], [url], [img], [email], [youtube], [size], and [color] tags by default, each is able to accept additional parameters such as [quote=foo]#...[/quote] To manually set the tags, call the following in an initializer file:

BBTagCloser.configure { |config| config.bb_tags = ["u", "b", "s", "i", "quote", "url", "img", "email", "youtube", "size", "color", # More tags here] }

Contributing

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

FAQs

Package last updated on 06 Dec 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc