From: Alexey Verkhovsky Date: 2005-04-15T09:45:24+09:00 Subject: Re: RedCloth, BlueCloth... Hal Fulton wrote: > I want to know what's the best way to manage a file that has > both text and HTML versions. (Yes, I'm talking about the > comp.lang.ruby FAQ, which should autopost tomorrow.) Then you put in the same directory your faq.txt, and a Rakefile with tasks for rendering and publishing. The task for rendering may look like (this is working code that I use for reformatting my CV): QTE render.rb require 'redcloth' Dir['*.txt'].each do |txt| html = RedCloth.new(File.read(txt), [:hard_breaks]).to_html name = File.basename(txt).sub(/\.txt$/, '') File.delete(name + '.html') if File.exists?(name + '.html') File.open(name + '.html', 'w+') { |f| f.write html } end UNQTE -- Best regards, Alexey Verkhovsky Ruby Forum: http://ruby-forum.org (moderator) RForum: http://rforum.andreas-s.net (co-author) Instiki: http://instiki.org (maintainer)