-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhriki.rb
More file actions
197 lines (151 loc) · 5.49 KB
/
hriki.rb
File metadata and controls
197 lines (151 loc) · 5.49 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
####################################################################
# Hriki -- The happily ruby wiki compiler
#
# Thanks to all the past and current work by the ikiwiki developers,
# but I dislike perl.
##
require 'optparse'
require 'optparse/time'
require 'ostruct'
require 'hriki/config'
require 'hriki/render'
module Hriki
# hriki version
VERSION = 0.1
class Opts
def self.parse(args)
opts = OptionParser.new do |opts|
opts.banner = "Usage: #{$0} [options]"
opts.separator ""
opts.separator "Specific options:"
# opts.on("-s", "--setup SETUP", "Hriki configuration setup file") do |s|
# Config.setup = s
# end
# opts.on("--wikiname WIKINAME", "Name the wiki") do |w|
# Config.wikiname = w
# end
# opts.on("-v", "--[no-]verbose", "Turn on verbose output") do |v|
# Config.verbose = v
# end
# opts.on("--[no-]syslog", "Logging with syslog") do |s|
# Config.syslog = s
# end
# opts.on("--rebuild", "Rebuild all pages, changed or not") do |r|
# Config.rebuild = r
# end
# opts.on("--refresh", "Refresh changed pages") do |r|
# Config.refresh = r
# end
# opts.on("--post-commit", "Run in post-commit mode") do |p|
# Config.post_commit = p
# end
# opts.on("--render FILE", "Render a single file") do |r|
# Config.render = r
# end
# opts.on("--[no-]usedirs", "Toggle output with diretories or pages") do |u|
# Config.usedirs = u
# end
# opts.on("--[no-]prefix-directives", "Toggle using the [[! prefix") do |p|
# Config.prefix_directives = p
# end
# opts.on("--getctime", "Get the ctime from the RCS instead of the filesystem") do |c|
# Config.getctime = c
# end
# opts.on("--numbacklinks NUM", "Set the number of backlinks at the bottom of the page") do |b|
# Config.numbacklinks = b
# end
opts.on("--srcdir SRCDIR", "The directory to draw from!") do |s|
Config.srcdir = s
end
opts.on("--destdir DESTDIR", "The destination!") do |d|
Config.destdir = d
end
opts.on("--preprocdir PROCDIR", "Where plugins are held") do |d|
Config.preprocdir = d
end
# opts.on("--rcs RCS", [:git, :svn, :hg], "Set the RCS type to pull the wiki from") do |r|
# Config.rcs = r
# end
# opts.on("--no-rcs", "Only draw from the file system") do |nr|
# Config.rcs = nr
# end
# opts.on("--url URL", "Base url") do |u|
# Config.url = u
# end
# opts.on("--historyurl URL", "RCS history url") do |u|
# Config.historyurl = u
# end
# opts.on("--diffurl URL", "RCS diff url") do |d|
# Config.diffurl = d
# end
# opts.on("--adminemail EMAIL", "Email of the wiki administrator") do |a|
# Config.adminemail = a
# end
# opts.on("--timeformat TIME", "Format the time displays") do |t|
# Config.timeformat = t
# end
# opts.on("--sslcookie", "Only send cookies over an ssl connection") do |s|
# Config.sslcookie = s
# end
# opts.on("--httpauth", "Use http for authentication") do |h|
# Config.httpauth = h
# end
# opts.on("--userdir", "Allows links to go to a subpage, good for users") do |ud|
# Config.userdir = ud
# end
opts.on("--htmlext EXT", "Change the default generated extension") do |e|
Config.htmlext = e
end
opts.on("--srcext EXT", "Change the default source file extension") do |e|
Config.srcext = e
end
# opts.on("--libdir DIR", "Add a directory to search for libraries") do |l|
# Config.libdir = l
# end
# opts.on("--exclude REGEX", "Exclude the regex of source files") do |e|
# Config.exclude = e
# end
# opts.on("--adminuser USER", "Set the administrative user") do |au|
# Config.adminuser = au
# end
# opts.on("--templatedir DIR", "Directory of templates") do |t|
# Config.templatedir = t
# end
# opts.on("--underlaydir DIR", "Directory for the underlay wiki") do |u|
# Config.underlaydir = u
# end
opts.on("--plugin x,y,z", Array, "List of plugins to use") do |p|
Config.plugin = p
end
# opts.on("--disable-plugin x,y,z", Array, "List of plugns to not use") do |d|
# Config.disable_plugin = d
# end
# opts.on("--pingurl URL", "URL to ping when wiki is updated") do |p|
# Config.pingurl = p
# end
opts.separator ""
opts.separator "Common options:"
opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end
opts.on_tail("--version", "Show version") do
puts Hriki::VERSION
exit
end
end
opts.parse!(args)
end
end
def self.run
Opts.parse(ARGV)
Config.srcdir = "~/code/hriki/test/src"
Config.destdir = "~/code/hriki/test/dest"
Config.htmlext = ".html"
Config.srcext = ".mdwn"
Config.plugin = ['basic_clean']
puts "Oh, this wont go well..."
Render.all
end
end
Hriki::run if $0 == __FILE__