public
Description: Very basic html rendering script in Ruby
Homepage: http://robertbrook.com/
Clone URL: git://github.com/robertbrook/unarguably.git
drastic
robertbrook (author)
Sat May 24 12:37:14 -0700 2008
commit  7781df405a1bf5245de26bbe5e9160b796c6a94b
tree    eb245a9c1ffa1c3d6555d6eee2703d02a499c23b
parent  cb0fe6cd0d68db834e888c5407d200a7c820f604
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
0
@@ -0,0 +1,99 @@
0
+require 'rubygems'
0
+require 'erb'
0
+require 'activesupport'
0
+
0
+@template = ERB.new(DATA.read)
0
+
0
+def handle(file)
0
+ @content = File.read(file)
0
+ if file == "index.txt"
0
+ @pagetitle = "Robert Brook"
0
+ @title = @pagetitle
0
+ @header = '<span id="home">Robert Brook</span>'
0
+ else
0
+ @pagetitle = File.basename(file, ".txt")
0
+ @title = @pagetitle + ' (Robert Brook)'
0
+ @header = '<span id="home"><a href="http://robertbrook.com" rel="home">Robert Brook</a></span> &rarr; ' + @pagetitle
0
+ end
0
+ @output_filename = File.basename(file).gsub(/[^a-z0-9]+/i, '-').gsub(/.txt/, '.html')
0
+ @output_filename = @output_filename.downcase
0
+ File.open(@output_filename, 'w') {|f| f.write(@template.result) }
0
+ puts @output_filename
0
+end
0
+
0
+Dir.glob("*.txt").each {|file| handle file }
0
+
0
+__END__
0
+<!DOCTYPE HTML>
0
+<html lang="en-GB">
0
+<head profile="http://gmpg.org/xfn/11">
0
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
0
+<title><%= @title %></title>
0
+ <link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" />
0
+ <link rel="schema.DCTERMS" href="http://purl.org/dc/terms/" />
0
+ <meta name="keywords" content="Robert Brook, London, Parliament, Hansard, UK">
0
+ <link rel="DC.rights copyright" href="http://creativecommons.org/licenses/publicdomain/deed.en_GB">
0
+<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.5.1/build/reset-fonts-grids/reset-fonts-grids.css">
0
+ <meta name="author" content="Robert Brook">
0
+ <meta name="DC.title" content="Robert Brook">
0
+ <meta name="DC.creator DC.publisher" content="Robert Brook">
0
+ <meta name="DC.format" content="text/html">
0
+ <meta name="DC.type" content="Text">
0
+ <meta name="DC.identifier" content="http://robertbrook.com/<%= @output_filename %>">
0
+ <meta name="DC.language language" content="en-GB">
0
+ <link rel="openid.server" href="http://www.myopenid.com/server">
0
+ <link rel="openid.delegate" href="http://robertbrook.myopenid.com/">
0
+ <meta http-equiv="X-XRDS-Location" content="http://www.myopenid.com/xrds?username=robertbrook.myopenid.com">
0
+ <meta name="generator" content="unarguably" />
0
+<style>
0
+a {text-decoration:none;}
0
+ #doc{width:50%;min-width:250px;line-height:140%;}
0
+ #hd{margin:1em 0;}
0
+ #ft{margin:1em 0;}
0
+ p{padding-bottom:1em;}
0
+ .tags{font-weight:bold;}
0
+ h1{font-weight:bold;margin:1em 0;}
0
+
0
+ h2{font-weight:bold;margin:1em 0;}
0
+ blockquote{margin:0 1em;font-style:italic;}
0
+ strong{font-weight:bold;}
0
+ q{font-style:italic;}
0
+ </style>
0
+ <link rel="alternate" type="application/atom+xml" title="Robert Brook" href="http://robertbrook.com" />
0
+<meta name="verify-v1" content="Rbg5bP3j0LuUCH76tKokxueugQYNG1oUUh66JI82IaM=">
0
+</head>
0
+<body id="robertbrook-com">
0
+<div id="doc" class="yui-t7">
0
+ <div id="hd">
0
+
0
+<h1><%= @header %></h1>
0
+
0
+ </div>
0
+ <div id="bd">
0
+ <div class="yui-g">
0
+
0
+<%= @content %>
0
+
0
+</div>
0
+
0
+ </div>
0
+ <div id="ft">
0
+
0
+<!-- footer -->
0
+
0
+</div>
0
+</div>
0
+
0
+<script type="text/javascript">
0
+var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
0
+document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
0
+</script>
0
+<script type="text/javascript">
0
+var pageTracker = _gat._getTracker("UA-294350-3");
0
+pageTracker._initData();
0
+pageTracker._trackPageview();
0
+</script>
0
+
0
+
0
+</body>
0
+</html>
0
\ No newline at end of file

Comments

    No one has commented yet.