the blog of
Wes Hargrove

Technology in Vino: RedCloth

When I started writing Vino I knew I wanted to make it open source. Important among several reasons is I have gained a lot of knowledge from open source projects and want to contribute to the community in the same respect. In addition this project is a learning endeavor for me; so why should I keep it to myself?

One of the technologies I’m using in Vino is RedCloth.

RedCloth is a gem built for Ruby that parses Textile into HTML. This is super helpful for blogging because it allows me to write posts in plain text, store them in my database in plain text, but in the Rails view layer show rendered HTML to the browser.

For example:

bq. A block quote becomes

A block quote

And …

"Link to Wikipedia": becomes

Link to Wikipedia

Neat, huh?

In app/views/posts/show.html.erb Vino takes the Post.content (a string of Textile) and parses the string to HTML.

<% if @post.content %>
  <%= sanitize %>
<% end %>

RedCloth returns an HTML string and is sanitized so the browser will render it as if the HTML was included in the view itself. (Because Vino can publish a post that does not have any content, I am checking that content exists before passing @post.content to RedCloth. Otherwise RedCloth will raise a TypeError exception.)

That’s it for my simple implementation of RedCloth parsing in Vino! Stay tuned for more posts in this series.

This is the first post in a series of Technology in Vino. Check out the Vino source code on Github: whargrove/Vino.

| Posted by Wes at 2014-03-10 6:04:05 PM

 Foundations of Programming: Programming for Kids with David Gassner

| Posted by Wes at 2014-03-06 2:58:13 PM


If you’re using Sublime Text (and shame on you if you are not) you need this plugin.

| Posted by Wes at 2014-02-16 2:13:43 PM

 GitHub Goes to School

I’ve always been a huge fan of Github, but this takes my admiration to the next level.

GitHub Education provides tools for teachers and students to collaborate in computer science classrooms. No more zipping up code files and distributing out via email.

GitHub has put together a guide for teachers to get started.

Using GitHub is a boon to productivity for CS teachers, but introducing version control to students at an earlier age is the hidden gem here.

| Posted by Wes at 2014-02-12 6:24:41 PM

 Connect the Dots

Corbin intends the PyTruck to be a resource for people who want to learn traditional computer programming as well as skills for applying computing to practical aspects of their daily lives.

Inspiring article in the most recent edition of The Magazine about Brian Corbin pushing some unique ideas about making programming more accessible to children in rural areas.

The PyTruck referred to in this quote is a gutted School Bus he intends to use as a mobile computer lab to show off Raspberry Pi and Python to kids. Very neat.

| Posted by Wes at 2014-02-12 6:22:37 PM