all repos — markup @ v0.2.0

The code we use to render README.your_favorite_markup

lib/github/markups.rb (view raw)

 1markup(:markdown, /md|mkdn?|mdown|markdown/) do |content|
 2  Markdown.new(content).to_html
 3end
 4
 5markup(:redcloth, /textile/) do |content|
 6  RedCloth.new(content).to_html
 7end
 8
 9markup('github/markup/rdoc', /rdoc/) do |content|
10  GitHub::Markup::RDoc.new(content).to_html
11end
12
13markup('org-ruby', /org/) do |content|
14  Orgmode::Parser.new(content).to_html
15end
16
17command(:rest2html, /rest|rst/)
18
19command('asciidoc -s --backend=xhtml11 -o - -', /asciidoc/)
20
21# pod2html is nice enough to generate a full-on HTML document for us,
22# so we return the favor by ripping out the good parts.
23#
24# Any block passed to `command` will be handed the command's STDOUT for
25# post processing.
26command("/usr/bin/env pod2html", /pod/) do |rendered|
27  require 'fileutils'
28  if rendered =~ /<body.+?>\s*(.+)\s*<\/body>/mi
29    FileUtils.rm("pod2htmd.tmp") if File.exists?('pod2htmd.tmp') rescue nil
30    FileUtils.rm("pod2htmi.tmp") if File.exists?('pod2htmi.tmp') rescue nil
31    $1.sub('<!-- INDEX BEGIN -->', '').sub('<!-- INDEX END -->', '')
32  end
33end