Skip to content

Commit

Permalink
make up html with markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
hayamiz committed Dec 13, 2009
1 parent 8813513 commit 2a8cef0
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
15 changes: 15 additions & 0 deletions doc/web/Makefile
@@ -0,0 +1,15 @@

RM ?= rm -f
PUBLISH := ./publish.rb

.PHONY: all clean

.SUFFIXES: .text .html

all: index.html

.text.html:
$(PUBLISH) $<

clean:
$(RM) *.html
8 changes: 8 additions & 0 deletions doc/web/index.text
@@ -0,0 +1,8 @@
<!-- -*- mode: markdown -*- -->

Twittering-mode
===============

Twittering-mode is a major mode for Twitter. It enables you to check
timelines, tweet, mark posts as favorites and so on.

48 changes: 48 additions & 0 deletions doc/web/publish.rb
@@ -0,0 +1,48 @@
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-

require 'rubygems'
require 'bluecloth'

$web_dir = File.dirname(__FILE__)

$html_header = "
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"ja\" lang=\"ja\">
<head>
<title>Twittering-mode</title>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />
</head>
<body>
"
$html_footer = "
</body>
</html>
"

textfile = nil
htmlfile = nil

ARGV.each do |arg|
next unless File.exist?(arg)
textfile = File.open(arg)
if arg =~ /\.text$/
htmlfile = arg.gsub(/\.text$/, ".html")
else
htmlfile = arg + ".html"
end
htmlfile = File.open(htmlfile, "w")
break
end

unless textfile
textfile = $stdin
htmlfile = $stdout
end

html_body = BlueCloth.new(textfile.read).to_html
htmlfile.puts($html_header + html_body + $html_footer)



0 comments on commit 2a8cef0

Please sign in to comment.