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

vidibus-textile

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vidibus-textile

  • 0.3.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= vidibus-textile

Basically, this is a wrapper for RedCloth with some extensions. It is inspired by the acts_as_textiled plugin and extends your Mongoid models.

This gem is part of the open source SOA framework Vidibus: http://vidibus.org

== Installation

Add the dependency to the Gemfile of your application:

gem "vidibus-textile"

Then call bundle install on your console.

== Usage

The basic methods are:

Vidibus::Textile.new('Some say, "love":http://doit.xxx is a river.').to_html

=> '

Some say, love is a river.

'

(#to_html is provided by RedCloth)

Vidibus::Textile.new('Some say, "love":http://doit.xxx is a river.').to_text

=> "Some say, love is a river."

The method #to_text will return a plain text version of textile content but keep newlines intact. However, if you just want a stripped version without newlines, provide the option :plain => true

#to_text with :plain => true

Vidibus::Textile.new("Super\nTrouper").to_text(:plain => true)

=> "Super Trouper"

== Mongoid integration

Adding textile content to your Mongoid model is simple:

class Page include Mongoid::Document include Vidibus::Textile::Mongoid textile :body end

By setting textile :body on the page model above, it will be extended by two fields:

field :body

=> Contains the textile content.

field :body_plain

=> Contains a plain text version of the content, stored in the database.

Additionally, the method #body_html is available. As one could guess, it returns rendered html from the textile content.

== View helper

For your convenience, the view helper #stripped is available (as counterpart for Rails' #textilize).

In your view...

stripped("Super\nTrouper", :plain => true)

=> "Super Trouper"

== Copyright

Copyright (c) 2010 Andre Pankratz. See LICENSE for details.

FAQs

Package last updated on 15 Oct 2013

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