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 phrase_ |
-> |
a 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
分享到:
相关推荐
redcloth使用,其包括了redcloth.rb以及页面显示用到的js,css,image.以及语法帮助。 博文链接:https://hooney.iteye.com/blog/208838
redcloth, RedCloth是一个用于将 Textile 转换为HTML的ruby 库 RedCloth - ruby的Textile 解析器主页redcloth.org维护者Joshua Siler github.com/joshuasiler作者Garber版权
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>
git-wiki 是使用 Git 做为数据存储的 wiki 引擎,使用 Ruby 开发。要求环境支持: rubygems sinatra grit redcloth rubypants 标签:gitwiki
6. **RedCloth-4.2.9-x86-mingw32.gem**: RedCloth 是一个Textile处理器,Textile是一种轻量级的标记语言,类似于Markdown,用于将文本格式化为HTML。在Jekyll中,RedCloth帮助将Textile语法转换为美观的HTML。 7. ...
JavaCloth是一个开源项目,它的出现是为了在Java环境中提供与RedCloth和Markdown类似的文本解析功能。RedCloth是Textile格式的一种实现,而Markdown则是一种轻量级的标记语言,两者都广泛用于将易读的文本格式转换为...
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
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 ./...
Ruby降价促销处理器 Discount是...用法RDiscount实现了RedCloth流行并被BlueCloth采用的基本协议: require 'rdiscount'markdown = RDiscount.new("Hello World!")puts markdown.to_html创建RDiscount对象时,可以打
在提供的文件列表中,我们看到有一个名为`redcloth-2.0.2`的文件。这可能是一个文本处理器的gem,如RedCloth,它专门用于处理Markdown文本,并将其转换为HTML。虽然它不是`YAML.rb`的一部分,但在Ruby开发中,这种...
在Redmine的安装过程中,RubyGems用于获取和安装Redmine本身及其依赖的gem,比如数据库连接器(如pg或mysql2)、文本处理库(如RedCloth或Kramdown)、邮件处理库(如ActionMailer)等。这些gem确保了Redmine能够...