soxer 0.9.7 → 0.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +31 -2
- data/bin/soxer +2 -3
- data/lib/soxer/main.rb +211 -89
- data/lib/soxer/skel/empty/content/index.yaml +2 -3
- data/lib/soxer/skel/empty/views/css/css.sass +5 -6
- data/lib/soxer/views/atom.haml +18 -32
- data/lib/soxer/views/atom_layout.haml +13 -0
- data/lib/soxer/views/breadcrumb.haml +16 -0
- data/lib/soxer/views/sitemap.haml +2 -2
- data/soxer.gemspec +2 -2
- metadata +6 -4
data/CHANGES
CHANGED
@@ -1,10 +1,39 @@
|
|
1
|
+
= 0.9.8 / 2010-11-28
|
2
|
+
|
3
|
+
* Standardized and beautified code (no particular standard though.)
|
4
|
+
|
5
|
+
* Rdoc documentation rewritten from scratch.
|
6
|
+
|
7
|
+
* YAML file downloading disabled. This was a severe bug.
|
8
|
+
|
9
|
+
* Url-to-file routing completely redone, now far more flexible and
|
10
|
+
extendible, while less error prone.
|
11
|
+
|
12
|
+
* Atom feed generator completely redone. Not backwards compatible. However,
|
13
|
+
it was not logical and mostly broken anyway.
|
14
|
+
|
15
|
+
* Added breadcrumb generator function
|
16
|
+
|
17
|
+
* Added ttf/otf mime types to default Rack set
|
18
|
+
|
19
|
+
* Fixed skeleton creation to include empty directories.
|
20
|
+
|
21
|
+
* Developement mode output padded with newline. Annoyance only.
|
22
|
+
|
23
|
+
* get_list now filters list of files: If both 'dir/something.yaml' and
|
24
|
+
'dir/something/index.html' exist, only the first is included.
|
25
|
+
|
26
|
+
* Fixed sitemap generator to use new settings.origin. This was a severe bug.
|
27
|
+
|
1
28
|
= 0.9.7 / 2010-11-03
|
2
29
|
|
3
|
-
* Fixed "views/css/css.sass" for empty skeleton to comply with new sass
|
30
|
+
* Fixed "views/css/css.sass" for empty skeleton to comply with new sass
|
31
|
+
notation.
|
4
32
|
|
5
33
|
* Created a README.markdown document
|
6
34
|
|
7
|
-
* Added sinatra-reloader as dependency, although it's only needed in
|
35
|
+
* Added sinatra-reloader as dependency, although it's only needed in
|
36
|
+
developement mode.
|
8
37
|
|
9
38
|
* Added proper license
|
10
39
|
|
data/bin/soxer
CHANGED
@@ -85,8 +85,7 @@ def create template, dir
|
|
85
85
|
when File.exist?(dir) then
|
86
86
|
return err "The destination directory exists."
|
87
87
|
else
|
88
|
-
FileUtils.
|
89
|
-
FileUtils.cp_r( Dir.glob( File.join(skel, template, '*') ), dir)
|
88
|
+
FileUtils.copy_entry( File.join(skel, template), dir)
|
90
89
|
return notice "Successfuly created '#{dir}' application directory from '#{template}'."
|
91
90
|
end
|
92
91
|
end
|
@@ -96,7 +95,7 @@ def test port
|
|
96
95
|
server = 'webrick'
|
97
96
|
ENV['PATH'].split(':').each {|folder| server = 'thin' if File.exists?(folder+'/thin')}
|
98
97
|
system("rackup -s #{server} -p #{port}")
|
99
|
-
return "Developement mode ends
|
98
|
+
return "Developement mode ends.\n\n"
|
100
99
|
end
|
101
100
|
|
102
101
|
case $*[0]
|
data/lib/soxer/main.rb
CHANGED
@@ -3,7 +3,9 @@ require 'yaml'
|
|
3
3
|
require 'haml'
|
4
4
|
require 'uuid'
|
5
5
|
|
6
|
-
|
6
|
+
#== Sinatra, web publishing DSL
|
7
|
+
#
|
8
|
+
# http://www.sinatrarb.com
|
7
9
|
module Sinatra
|
8
10
|
|
9
11
|
#== Soxer, the web publishing tool.
|
@@ -22,19 +24,26 @@ module Sinatra
|
|
22
24
|
|
23
25
|
# === The Filereader class
|
24
26
|
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
27
|
+
# Filereader is responsible for reading a YAML file, that contains the
|
28
|
+
# content and metadata for each web page.
|
29
|
+
#
|
30
|
+
# Filereader also assumes that each YAML file contains 2 top level fields:
|
31
|
+
# uuid:: A Universally Unique Identifier field
|
32
|
+
# date:: A standard date and time field
|
33
|
+
# if the fields are not present, they are automatically generated and
|
34
|
+
# saved in the file.
|
31
35
|
class Filereader
|
36
|
+
# The name of the YAML file
|
32
37
|
attr_accessor :filename
|
33
|
-
|
38
|
+
|
39
|
+
# The standard Sinatra application settings, recieved from sinatra/base.
|
40
|
+
# These settings are configurable in __./config.ru__ file in the application
|
41
|
+
# directory.
|
34
42
|
def settings
|
35
43
|
@s = Sinatra::Application
|
36
44
|
end
|
37
45
|
|
46
|
+
# The method, that retuns the YAML structure in a ::hash::.
|
38
47
|
def get_content
|
39
48
|
self.settings
|
40
49
|
out = YAML.load_file( @filename )
|
@@ -47,6 +56,8 @@ module Sinatra
|
|
47
56
|
|
48
57
|
private
|
49
58
|
|
59
|
+
# A private method, that generates and adds a Universally Unique
|
60
|
+
# Identifier field to the data structure.
|
50
61
|
def add_id
|
51
62
|
mtime = File.mtime( @filename )
|
52
63
|
File.open( @filename, 'r+' ) do |f|
|
@@ -57,6 +68,7 @@ module Sinatra
|
|
57
68
|
File.utime( 0, mtime, @filename )
|
58
69
|
end
|
59
70
|
|
71
|
+
# A private method, that adds a standard Time.now to the data structure.
|
60
72
|
def add_date
|
61
73
|
mtime = File.mtime( @filename )
|
62
74
|
File.open( @filename, 'r+' ) do |f|
|
@@ -74,12 +86,19 @@ module Sinatra
|
|
74
86
|
# (the default is "content" directory within application root) or a
|
75
87
|
# directory path with index.yaml
|
76
88
|
class Urlreader
|
89
|
+
|
90
|
+
# Url, recieved from the request
|
77
91
|
attr_accessor :url
|
78
92
|
|
93
|
+
# The standard Sinatra application settings, recieved from sinatra/base.
|
94
|
+
# These settings are configurable in __./config.ru__ file in the application
|
95
|
+
# directory.
|
79
96
|
def settings
|
80
97
|
@s = Sinatra::Application
|
81
98
|
end
|
82
99
|
|
100
|
+
# Creates a filereader instance, maps the url to either yaml file or
|
101
|
+
# index.yaml within a directory represented by url.
|
83
102
|
def get_content
|
84
103
|
self.settings
|
85
104
|
fn = case true
|
@@ -93,114 +112,173 @@ module Sinatra
|
|
93
112
|
end
|
94
113
|
end
|
95
114
|
|
115
|
+
# === Helper module
|
116
|
+
#
|
117
|
+
# This module introduces several helper methods to Soxer application.
|
96
118
|
module Helpers
|
97
|
-
# ===
|
98
|
-
#
|
99
|
-
# Read the document in yaml format (with .yaml) ending directly mapped from
|
100
|
-
# the given parameter. Sinatra's *settings.route* and Soxers
|
101
|
-
# *settings.origin* are prefixed to the path in order to get an absolute
|
102
|
-
# filename. If the filename cannot be found, a directory by that name and
|
103
|
-
# an index file within are probed and read.
|
119
|
+
# === Document reader
|
120
|
+
# This method reads a yaml file from disk and returns a hash.
|
104
121
|
#
|
105
|
-
#
|
122
|
+
# ====Accepts
|
123
|
+
# [url => String]
|
124
|
+
# The string url. If empty, url recieved is used.
|
125
|
+
#
|
126
|
+
# ====Returns
|
127
|
+
# [=> Hash]
|
128
|
+
# A hash representation of yaml file.
|
106
129
|
def get_page url=params[:splat][0]
|
107
130
|
out = Urlreader.new
|
108
131
|
out.url = url
|
109
132
|
out.get_content
|
110
133
|
end
|
111
134
|
|
112
|
-
|
135
|
+
# === Document list generator method
|
136
|
+
# This method returns a list of documents filtered by &block statement.
|
137
|
+
#
|
138
|
+
# ====Accepts
|
139
|
+
# [&block]
|
140
|
+
# A callback method for filtering all available file.
|
113
141
|
#
|
114
|
-
#
|
115
|
-
#
|
116
|
-
#
|
117
|
-
#==== &block
|
118
|
-
# Block is a callback, which filters the entire array of yaml files.
|
119
|
-
# The result is an array of hashes, representing a subset of all yaml
|
120
|
-
# files from "origin" directory. It can be sorted by using Array.sort
|
121
|
-
# method.
|
142
|
+
# ====Returns
|
143
|
+
# [=> Array]
|
144
|
+
# Array of hashes representing yaml files.
|
122
145
|
def get_list &block
|
123
|
-
|
124
|
-
|
146
|
+
fileset= Dir.glob File.join( settings.origin, "**", "*.yaml" )
|
147
|
+
fileset.delete_if {|d| (d=~/\/index.yaml$/ and fileset.include? d[0..-12]+'.yaml') }
|
148
|
+
output = fileset.map! do |f|
|
125
149
|
file = Filereader.new
|
126
150
|
file.filename = f
|
127
151
|
if block_given?
|
128
152
|
f = block.call file.get_content
|
153
|
+
else
|
154
|
+
f = file.get_content
|
129
155
|
end
|
130
156
|
end.compact
|
131
157
|
end
|
132
158
|
|
133
|
-
#=== The "sitemap" the sitemap generator
|
159
|
+
#=== The "sitemap" the sitemap generator partial
|
134
160
|
#
|
135
161
|
# This funnction accepts no arguments. It simply renders a sitemap file
|
136
162
|
# with all available urls from the site
|
163
|
+
|
164
|
+
# === Sitemap generator method
|
165
|
+
# This generated an XML sitemap.
|
166
|
+
#
|
167
|
+
# ====Accepts
|
168
|
+
# This method does not accept arguments.
|
169
|
+
#
|
170
|
+
# ====Returns
|
171
|
+
# [=> String]
|
172
|
+
# An XML representing the contents of the web site.
|
137
173
|
def sitemap
|
138
174
|
template = File.read File.join( File.dirname(__FILE__), 'views', 'sitemap.haml' )
|
139
175
|
out = '<?xml version="1.0" encoding="UTF-8"?>'+"\n"
|
140
176
|
out << haml( template, :layout => false )
|
141
177
|
end
|
142
|
-
|
143
|
-
|
144
|
-
|
178
|
+
|
179
|
+
# === The breadcrumb generator
|
180
|
+
# This method generates a stylable breadcrumb based on document's directory path.
|
181
|
+
#
|
182
|
+
# ==== Accepts
|
183
|
+
# [options => Hash]
|
184
|
+
# Additional options, passed to haml interpreter
|
145
185
|
#
|
146
|
-
#
|
147
|
-
#
|
148
|
-
#
|
149
|
-
|
150
|
-
|
151
|
-
|
186
|
+
# ==== Returns
|
187
|
+
# [ => String]
|
188
|
+
# Html string containing breadcrumb path with links.
|
189
|
+
def breadcrumb options={}
|
190
|
+
template = File.read File.join( File.dirname(__FILE__), 'views', 'breadcrumb.haml' )
|
191
|
+
haml( template, options.merge!( :layout => false ) )
|
192
|
+
end
|
193
|
+
|
194
|
+
# === The atom feed generator
|
195
|
+
# This method generates an atom entry from a document.
|
152
196
|
#
|
153
|
-
|
154
|
-
#
|
155
|
-
#
|
197
|
+
# ====Accepts
|
198
|
+
# [doc => Hash]
|
199
|
+
# The document hash, read from a YAML source
|
200
|
+
# [options => hash]
|
201
|
+
# Additional options, passed to haml interpreter
|
156
202
|
#
|
157
|
-
|
158
|
-
#
|
159
|
-
#
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
file = Filereader.new
|
166
|
-
file.filename = f
|
167
|
-
if block_given?
|
168
|
-
block.call file.get_content
|
169
|
-
end
|
170
|
-
end.compact!.sort!{|b,a| a.to_a[0] <=> b.to_a[0] }
|
171
|
-
out = '<?xml version="1.0" encoding="UTF-8"?>'+"\n"
|
172
|
-
out << haml( template, :layout => false, :locals => { :page=>get_page, :feed=>output, :author=>author } )
|
203
|
+
# ====Returns
|
204
|
+
# [=> String]
|
205
|
+
# Atom feed entry.
|
206
|
+
def atom doc, options={}
|
207
|
+
template = File.read File.join( File.dirname(__FILE__), 'views', 'atom.haml' )
|
208
|
+
haml template, options.merge!( { :layout => false,
|
209
|
+
:format => :xhtml,
|
210
|
+
:locals => { :doc => doc } } )
|
173
211
|
end
|
174
212
|
|
213
|
+
# === Google ads generator method
|
214
|
+
# Returns the google ads code, according to arguments.
|
215
|
+
#
|
216
|
+
# ====Accepts
|
217
|
+
# [options => Hash]
|
218
|
+
# Hash element :locals containing the following symbols
|
219
|
+
# :client = google ads client ID
|
220
|
+
# :slot = google ads ad slot
|
221
|
+
# :width = google ads element width
|
222
|
+
# :height = google ads element height
|
223
|
+
#
|
224
|
+
# ====Returns
|
225
|
+
# [=> String]
|
226
|
+
# Html partial for the particular google ad.
|
175
227
|
def google_ads options={}
|
176
228
|
template = File.read File.join( File.dirname(__FILE__), 'views', 'google_ads.haml' )
|
177
229
|
pattern = File.join( settings.origin, "**", "*.yaml" )
|
178
230
|
haml( template, options.merge!( :layout => false ) )
|
179
231
|
end
|
180
232
|
|
233
|
+
# === Disquss helper method
|
234
|
+
# Returns the code for disqus comments.
|
235
|
+
# Calling this method without parameters generates javascript code needed
|
236
|
+
# at the end of each page containing disqus comments code.
|
237
|
+
#
|
238
|
+
# ====Accepts
|
239
|
+
# [options => Hash]
|
240
|
+
# Hash element :locals containing the following symbols
|
241
|
+
# :account = google ads client ID
|
242
|
+
#
|
243
|
+
# ====Returns
|
244
|
+
# [=> String]
|
245
|
+
# Html code that includes Disquss comments.
|
181
246
|
def disqus options={}
|
182
247
|
template = File.read File.join( File.dirname(__FILE__), 'views', 'disqus.haml' )
|
183
248
|
haml( template, options.merge!( :layout => false ) )
|
184
249
|
end
|
185
250
|
|
251
|
+
# === Google analytics helper method
|
252
|
+
# Returns the basic google analytics asynchronous tracking code.
|
253
|
+
#
|
254
|
+
# ====Accepts
|
255
|
+
# [options => Hash]
|
256
|
+
# Hash element :locals containing the following symbols
|
257
|
+
# :tracker = google analytics tracker token
|
258
|
+
#
|
259
|
+
# ====Returns
|
260
|
+
# [=> String]
|
261
|
+
# Google analytics asynchronous tracking code.
|
186
262
|
def google_analytics options={}
|
187
263
|
template = File.read File.join( File.dirname(__FILE__), 'views', 'google_analytics.haml' )
|
188
264
|
haml( template, options.merge!( :layout => false ) )
|
189
265
|
end
|
190
266
|
|
191
|
-
|
192
|
-
#
|
193
|
-
#
|
194
|
-
# underscore prepended) Sinatra's layouts directory.
|
267
|
+
# === Partial snippet generator method
|
268
|
+
# Returns a partial from ./views directory as specified in sinatra's
|
269
|
+
# manual.
|
195
270
|
#
|
196
|
-
|
197
|
-
#
|
198
|
-
#
|
271
|
+
# ====Accepts
|
272
|
+
# [snippet => Symbol]
|
273
|
+
# Symbol, representing a partial in the ./views directory (as specified by Sinatra)
|
274
|
+
# Note, that the name of the file follows a RoR convention:
|
275
|
+
# :some_file maps to ./views/_some_file.haml
|
276
|
+
# [options => hash]
|
277
|
+
# Additional options, passed to haml interpreter
|
199
278
|
#
|
200
|
-
|
201
|
-
#
|
202
|
-
#
|
203
|
-
# :locals and other variables)
|
279
|
+
# ====Returns
|
280
|
+
# [=> String]
|
281
|
+
# Html partial.
|
204
282
|
def partial(snippet, options={})
|
205
283
|
haml ('_'+snippet.to_s).to_sym, options.merge!(:layout => false)
|
206
284
|
end
|
@@ -216,7 +294,20 @@ module Sinatra
|
|
216
294
|
#
|
217
295
|
#==== url
|
218
296
|
# This string is used for 'href' in a link
|
219
|
-
|
297
|
+
|
298
|
+
# === Link tag generator method
|
299
|
+
# Generates Html <a href="#"></a> tag accordng to RoR convention.
|
300
|
+
#
|
301
|
+
# ==== Accepts
|
302
|
+
# [test => string]
|
303
|
+
# Visible content of the link (the linked text).
|
304
|
+
# [url => string]
|
305
|
+
# Url the linked text points to.
|
306
|
+
#
|
307
|
+
# ==== Returns
|
308
|
+
# [ => String]
|
309
|
+
# Html link tag.
|
310
|
+
def link_to text, url="/#{text.downcase.gsub(/\s/,'_')}"
|
220
311
|
url.gsub!(/^\//, '') if url =~ /.+:\/\//
|
221
312
|
"<a href=\"#{url}\"> #{text}</a>"
|
222
313
|
end
|
@@ -230,7 +321,18 @@ module Sinatra
|
|
230
321
|
#==== str=nil
|
231
322
|
# Obfuscates a string replacing characters with html entities.
|
232
323
|
# Useful for hiding emails and such
|
233
|
-
|
324
|
+
|
325
|
+
# === String obfuscator method
|
326
|
+
# Converts strings into a stream of html character codes.
|
327
|
+
#
|
328
|
+
# ==== Accepts
|
329
|
+
# [str => string]
|
330
|
+
# String of arbitrary length.
|
331
|
+
#
|
332
|
+
# ==== Returns
|
333
|
+
# [ => String]
|
334
|
+
# Html character string.
|
335
|
+
def obfuscate str=nil
|
234
336
|
out = []
|
235
337
|
str.each_byte {|c| out << "&##{c};" }
|
236
338
|
out.join
|
@@ -238,7 +340,7 @@ module Sinatra
|
|
238
340
|
|
239
341
|
end
|
240
342
|
|
241
|
-
def self.registered(app)
|
343
|
+
def self.registered(app) #:nodoc: all
|
242
344
|
app.helpers Soxer::Helpers
|
243
345
|
|
244
346
|
def app.settings
|
@@ -247,32 +349,52 @@ module Sinatra
|
|
247
349
|
|
248
350
|
set :origin, File.join(app.settings.root, 'content')
|
249
351
|
|
250
|
-
|
352
|
+
mime_type :otf, 'application/x-font-TrueType'
|
353
|
+
mime_type :ttf, 'application/x-font-TrueType'
|
251
354
|
|
252
|
-
app.get
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
355
|
+
app.get("/sitemap.xml") { sitemap }
|
356
|
+
|
357
|
+
app.get %r{(.*\.([^.]*))$} do
|
358
|
+
content_type "text/html", :charset => "utf-8"
|
359
|
+
url = params[:captures][0]
|
360
|
+
type = params[:captures][1]
|
361
|
+
file = File.join settings.origin, url
|
362
|
+
|
363
|
+
case type
|
364
|
+
when 'yaml' then
|
365
|
+
throw :halt, [404, "Document not found"]
|
366
|
+
|
367
|
+
when /^jpg|png|pdf|doc|docx|xls|xlsx|pdf|ttf|otf$/i then
|
368
|
+
send_file(file, :disposition => nil) if File.exist? file
|
369
|
+
throw :halt, [404, "Document not found"]if !File.exist? file
|
370
|
+
|
371
|
+
when /^css$/i then
|
372
|
+
content_type "text/css", :charset => "utf-8"
|
373
|
+
sass url.sub('.'+type, '').to_sym
|
374
|
+
|
375
|
+
when 'atom' then
|
376
|
+
content_type "application/atom+xml", :charset => "utf-8"
|
377
|
+
page = get_page url
|
378
|
+
layout = File.read File.join( File.dirname(__FILE__), 'views', 'atom_layout.haml' )
|
379
|
+
haml page['content'], :layout => layout,
|
380
|
+
:format => :xhtml,
|
381
|
+
:locals => { :page => page }
|
382
|
+
|
383
|
+
|
384
|
+
when 'rss' then
|
385
|
+
'RSS is not supported yet'
|
386
|
+
|
387
|
+
else throw :halt, [404, "Document not found"]
|
388
|
+
end
|
389
|
+
end
|
390
|
+
|
264
391
|
app.get '*/?' do
|
265
392
|
content_type "text/html", :charset => "utf-8"
|
266
|
-
|
267
|
-
if params[:splat].last =~ /\.atom$/ then
|
268
|
-
set :haml, { :format => :xhtml }
|
269
|
-
content_type "application/atom+xml", :charset => "utf-8"
|
270
|
-
end
|
271
|
-
|
272
393
|
page = get_page
|
273
394
|
page['layout'] ||= 'layout'
|
274
395
|
haml page['content'], :layout => page['layout'].to_sym, :locals => { :page => page }
|
275
396
|
end
|
397
|
+
|
276
398
|
end
|
277
399
|
end
|
278
400
|
|
@@ -1,7 +1,6 @@
|
|
1
|
-
uuid: 151af640-c35a-012d-f6b7-001e378a2988
|
2
|
-
date: 2010-10-26T20:03:43+02:00
|
3
1
|
title: Hello world!
|
4
2
|
content: |
|
5
3
|
%h1= page['title']
|
6
4
|
%h2 Congratulations!
|
7
|
-
%p You have just created your first #{link_to '
|
5
|
+
%p You have just created your first #{link_to 'Soxer', 'http://soxer.mutsu.org'} application.
|
6
|
+
|
data/lib/soxer/views/atom.haml
CHANGED
@@ -1,32 +1,18 @@
|
|
1
|
-
%
|
2
|
-
%title=
|
3
|
-
%link{:href=>
|
4
|
-
%
|
5
|
-
%
|
6
|
-
%
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
%updated= f['mtime'].xmlschema
|
20
|
-
%published= f['date'].xmlschema
|
21
|
-
- if f['summary'] and f['summary'].length > 0
|
22
|
-
- s = haml f['summary'], :layout=>false
|
23
|
-
%summary= s.gsub(%r{</?[^>]+?>}, '')
|
24
|
-
- if f['author']
|
25
|
-
%author
|
26
|
-
- if f['author']['name'] and f['author']['name'].length > 0
|
27
|
-
%name= f['author']['name']
|
28
|
-
- if f['author']['email'] and f['author']['email'].length > 0
|
29
|
-
%email= f['author']['email']
|
30
|
-
- if f['author']['uri'] and f['author']['uri'].length > 0
|
31
|
-
%uri= f['author']['uri']
|
32
|
-
|
1
|
+
%entry
|
2
|
+
%title= doc['title']
|
3
|
+
%link{:href=>doc['url']}
|
4
|
+
%id= "urn:uuid:"+doc['uuid']
|
5
|
+
%updated= doc['mtime'].xmlschema
|
6
|
+
%published= doc['date'].xmlschema
|
7
|
+
- if doc['summary'] and doc['summary'].length > 0
|
8
|
+
- s = haml doc['summary'], :layout=>false
|
9
|
+
%summary= s.gsub(%r{</?[^>]+?>}, '')
|
10
|
+
- if doc['author']
|
11
|
+
%author
|
12
|
+
- if doc['author']['name'] and doc['author']['name'].length > 0
|
13
|
+
%name= doc['author']['name']
|
14
|
+
- if doc['author']['email'] and doc['author']['email'].length > 0
|
15
|
+
%email= doc['author']['email']
|
16
|
+
- if doc['author']['uri'] and doc['author']['uri'].length > 0
|
17
|
+
%uri= doc['author']['uri']
|
18
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
%feed(xmlns="http://www.w3.org/2005/Atom")
|
2
|
+
%title= page['title']
|
3
|
+
%link{:href=>request.url.split(request.fullpath)[0].gsub(/:\d+/, '')}
|
4
|
+
%link(rel="self"){:href=>request.url.gsub(/:\d+/, '')}
|
5
|
+
%id= "urn:uuid:"+page['uuid']
|
6
|
+
%updated= page['mtime'].xmlschema
|
7
|
+
%author
|
8
|
+
%name= page['author']['name']
|
9
|
+
- if page['author']['email'] and page['author']['email'].length > 0
|
10
|
+
%email= page['author']['email']
|
11
|
+
- if page['author']['uri'] and page['author']['uri'].length > 0
|
12
|
+
%uri= page['author']['uri']
|
13
|
+
=yield
|
@@ -0,0 +1,16 @@
|
|
1
|
+
:ruby
|
2
|
+
home ||= 'home'
|
3
|
+
crumbpaths ||= []
|
4
|
+
crumbs = params[:splat].first.split('/')
|
5
|
+
crumbs.each do |crumb|
|
6
|
+
path = File.join crumbs[0..crumbs.index(crumb)]
|
7
|
+
path = '/' and crumb=home if path==''
|
8
|
+
crumbpaths << [path, crumb]
|
9
|
+
end
|
10
|
+
crumbpaths = [['/', home]] if crumbs.length==0
|
11
|
+
|
12
|
+
.breadcrumb
|
13
|
+
-crumbpaths.each do |crumbpath|
|
14
|
+
-unless crumbpaths.index(crumbpath)==0
|
15
|
+
%span ►
|
16
|
+
%a{ :href=>crumbpath[0] }= crumbpath[1]
|
@@ -2,9 +2,9 @@
|
|
2
2
|
site = env['HTTP_X_FORWARDED_HOST'] ? env['HTTP_X_FORWARDED_HOST'] : env['HTTP_HOST']
|
3
3
|
|
4
4
|
%urlset(xmlns="http://www.sitemaps.org/schemas/sitemap/0.9")
|
5
|
-
- pattern = File.join( settings.
|
5
|
+
- pattern = File.join( settings.origin, "**", "*.yaml" )
|
6
6
|
- Dir.glob(pattern).each do |file|
|
7
7
|
%url
|
8
|
-
%loc= "http://#{site}"+file.gsub(/#{settings.
|
8
|
+
%loc= "http://#{site}"+file.gsub(/#{settings.origin}(.+)\.yaml$/, "\\1" ).gsub(/(.+)\/index$/, "\\1" )
|
9
9
|
%lastmod= File.mtime( file ).xmlschema
|
10
10
|
|
data/soxer.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soxer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 43
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 8
|
10
|
+
version: 0.9.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Toni Anzlovar
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-28 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -94,8 +94,10 @@ files:
|
|
94
94
|
- lib/soxer/views/atom.haml
|
95
95
|
- lib/soxer/views/sitemap.haml
|
96
96
|
- lib/soxer/views/disqus.haml
|
97
|
+
- lib/soxer/views/atom_layout.haml
|
97
98
|
- lib/soxer/views/google_analytics.haml
|
98
99
|
- lib/soxer/views/google_ads.haml
|
100
|
+
- lib/soxer/views/breadcrumb.haml
|
99
101
|
- lib/soxer/skel/empty/content/index.yaml
|
100
102
|
- lib/soxer/skel/empty/config.yml
|
101
103
|
- lib/soxer/skel/empty/config.ru
|