`
mqqqvpppm
  • 浏览: 63784 次
  • 性别: Icon_minigender_1
  • 来自: Kun Ming
社区版块
存档分类
最新评论

What is RedCloth

    博客分类:
  • ror
阅读更多

RedCloth is a module for using Textile in Ruby. Textile is a text format. A very simple text format. Another stab at making readable text that can be converted to HTML .

What is Textile?

Textile is a simple markup language.

textile to html a phrasea phrase
_a phrase_ ->
*a phrase* -> a phrase
_*a phrase*_ ->
"Google":http://google.com -> Google

No need to use verbose HTML to build your docs, your blogs, your pages. Textile gives you readable text while you’re writing and beautiful text for your readers. And if you need to break out into HTML , Textile will allow you to do so.

Textile also handles some subtleties of formatting which will enhance your document’s readability:

  • Single- and double-quotes around words or phrases are converted to curly quotations, much easier on the eye. “Observe!”
  • Double hyphens are replaced with an em-dash. Observe—very nice!
  • Single hyphens are replaced with en-dashes. Observe – so cute!
  • Triplets of periods become an ellipsis. Observe…
  • The letter ‘x’ becomes a dimension sign when used alone. Observe: 2×2.
  • Conversion of (TM) to™, (R) to®, (C) to©.

For more on Textile’s language, hop over to A Textile Reference .

Using RedCloth

The RedCloth class is an extension of Ruby’s String class. Use it like you would a String:

  >> r = RedCloth.new "*strong text* and _emphasized text_" 
  => "*strong text* and _emphasized text_" 
  >> r.gsub!( 'text', 'words' )
  => "*strong words* and _emphasized words_" 

To generate HTML from your RedCloth object, use the RedCloth#to_html method:

  >> r.to_html
  => "

strong words and emphasized words

"

Installing RedCloth

To install RedCloth via RubyGems:

  gem install RedCloth

Or download RedCloth and simply run the install.rb like so:

  ruby install.rb config
  ruby install.rb setup
  sudo ruby install.rb install
分享到:
评论
1 楼 yangzhihuan 2008-09-07  
正想用rails搞一个wiki的东东,你介绍的东西正适用,多谢了。

相关推荐

    redcloth 安装至ruby on rails 项目中

    redcloth使用,其包括了redcloth.rb以及页面显示用到的js,css,image.以及语法帮助。 博文链接:https://hooney.iteye.com/blog/208838

    redcloth, RedCloth是一个用于将 Textile 转换为HTML的ruby 库.zip

    redcloth, RedCloth是一个用于将 Textile 转换为HTML的ruby 库 RedCloth - ruby的Textile 解析器主页redcloth.org维护者Joshua Siler github.com/joshuasiler作者Garber版权

    redcloth-formatters-plain:与RedCloth中包含HTML和Latex格式化程序类似,这一代码使您可以将Textile转换为纯文本,而无需使用Textile语法

    this is *simple* _test_").to_plain 将返回: "this is simple test" 显示网址的示例RedCloth.new(%Q{"Please contact support":http://example.com/support}).to_plain 将返回: "Please contact support <http>

    wiki引擎git-wiki.zip

    git-wiki 是使用 Git 做为数据存储的 wiki 引擎,使用 Ruby 开发。要求环境支持: rubygems sinatra grit redcloth rubypants 标签:gitwiki

    jekyll gem

    6. **RedCloth-4.2.9-x86-mingw32.gem**: RedCloth 是一个Textile处理器,Textile是一种轻量级的标记语言,类似于Markdown,用于将文本格式化为HTML。在Jekyll中,RedCloth帮助将Textile语法转换为美观的HTML。 7. ...

    JavaCloth-开源

    JavaCloth是一个开源项目,它的出现是为了在Java环境中提供与RedCloth和Markdown类似的文本解析功能。RedCloth是Textile格式的一种实现,而Markdown则是一种轻量级的标记语言,两者都广泛用于将易读的文本格式转换为...

    webgen-website:Webgen网站的来源

    Webgen网站的来源 ...$ gem install maruku rdiscount rdoc RedCloth sass $ gem install webgen-zurb_foundation-bundle $ gem install webgen-font_awesome-bundle $ gem install webgen-tipue_search-bund

    diy-broadcast:自己动手做广播电视台广播项目

    gem install RedCloth -v '4.2.9' gem install nokogiri -v '1.6.6.2' 克隆此存储库后,运行: bundle install以下载构建所需的依赖项。 bundle exec jekyll serve在本地运行,或bundle exec jekyll build ./...

    rdiscount:打折(对于Ruby)John Gruber的Markdown的实现

    Ruby降价促销处理器 Discount是...用法RDiscount实现了RedCloth流行并被BlueCloth采用的基本协议: require 'rdiscount'markdown = RDiscount.new("Hello World!")puts markdown.to_html创建RDiscount对象时,可以打

    YAML.rb: YAML for Ruby-开源

    在提供的文件列表中,我们看到有一个名为`redcloth-2.0.2`的文件。这可能是一个文本处理器的gem,如RedCloth,它专门用于处理Markdown文本,并将其转换为HTML。虽然它不是`YAML.rb`的一部分,但在Ruby开发中,这种...

    rubygems-1.6.2.tgz

    在Redmine的安装过程中,RubyGems用于获取和安装Redmine本身及其依赖的gem,比如数据库连接器(如pg或mysql2)、文本处理库(如RedCloth或Kramdown)、邮件处理库(如ActionMailer)等。这些gem确保了Redmine能够...

Global site tag (gtag.js) - Google Analytics