zzot-semi-static 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +63 -0
- data/VERSION.yml +2 -2
- data/lib/semi-static.rb +68 -1
- data/lib/semi-static/base.rb +3 -4
- data/lib/semi-static/convertable.rb +19 -6
- data/lib/semi-static/index.rb +19 -1
- data/lib/semi-static/layout.rb +9 -0
- data/lib/semi-static/post.rb +0 -21
- data/lib/semi-static/posts.rb +51 -3
- data/lib/semi-static/pygmentize.rb +11 -4
- data/lib/semi-static/site.rb +72 -7
- data/lib/semi-static/snippet.rb +7 -0
- data/lib/semi-static/statistics.rb +13 -0
- data/lib/semi-static/tags.rb +121 -0
- data/test/ref/test_layout/default_layout.html +43 -1
- data/test/ref/test_layout/post_layout.html +42 -0
- data/test/ref/test_page/about.html +42 -0
- data/test/ref/test_page/colophon.html +42 -0
- data/test/ref/test_post/impressions.html +48 -0
- data/test/ref/test_post/lighting-up.html +48 -0
- data/test/ref/test_post/the-working-mans-typeface.html +92 -45
- data/test/source/layouts/default.haml +4 -1
- data/test/source/layouts/post.erb +7 -3
- data/test/source/posts/2005-03-27-a-bash-script-to-mess-with-the-containing-terminalapp-window.markdown +2 -1
- data/test/source/posts/2008-11-24-lighting-up.markdown +0 -1
- data/test/source/posts/2008-11-26-impressions.md +0 -1
- data/test/source/posts/2008-12-04-the-working-mans-typeface.html +1 -1
- data/test/source/snippets/tags-widget.haml +6 -0
- data/test/test_layout.rb +2 -1
- data/test/test_post.rb +17 -14
- metadata +5 -4
- data/README.markdown +0 -84
- data/lib/semi-static/categories.rb +0 -74
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zzot-semi-static
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Dady
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-03-01 00:00:00 -08:00
|
13
13
|
default_executable: semi
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -43,12 +43,11 @@ extra_rdoc_files: []
|
|
43
43
|
files:
|
44
44
|
- History.txt
|
45
45
|
- Manifest.txt
|
46
|
-
- README.
|
46
|
+
- README.rdoc
|
47
47
|
- VERSION.yml
|
48
48
|
- bin/semi
|
49
49
|
- lib/semi-static
|
50
50
|
- lib/semi-static/base.rb
|
51
|
-
- lib/semi-static/categories.rb
|
52
51
|
- lib/semi-static/cli.rb
|
53
52
|
- lib/semi-static/convertable.rb
|
54
53
|
- lib/semi-static/core_ext
|
@@ -63,6 +62,7 @@ files:
|
|
63
62
|
- lib/semi-static/snippet.rb
|
64
63
|
- lib/semi-static/statistics.rb
|
65
64
|
- lib/semi-static/stylesheet.rb
|
65
|
+
- lib/semi-static/tags.rb
|
66
66
|
- lib/semi-static.rb
|
67
67
|
- test/helper.rb
|
68
68
|
- test/output
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- test/source/snippets
|
143
143
|
- test/source/snippets/comment-links.html
|
144
144
|
- test/source/snippets/comments.html
|
145
|
+
- test/source/snippets/tags-widget.haml
|
145
146
|
- test/source/stylesheets
|
146
147
|
- test/source/stylesheets/layout.sass
|
147
148
|
- test/source/stylesheets/post.sass
|
data/README.markdown
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
Semi-Static
|
2
|
-
===========
|
3
|
-
|
4
|
-
Semi-Static is yet another static site generator. I've been playing around
|
5
|
-
with similar systems off and on for years, but its [Jekyll][] that finally
|
6
|
-
convinced me to build (and finish) one. The main idea that I take from
|
7
|
-
Jekyll is using [Git][] as the “database”. The idea from Jekyll that I'm
|
8
|
-
ignoring completely is avoiding [Ruby][] code evaluation at all costs — I'm
|
9
|
-
not running the thing on a server like [GitHub][] [Pages][], and it
|
10
|
-
eliminates a few libraries that I want to use.
|
11
|
-
|
12
|
-
At some point Semi-Static had a sister project, Semi-Live, that would serve
|
13
|
-
up data from the data source dynamically, probably via [Rails][]. I stopped
|
14
|
-
working on it not long after I first started, so don't expect to see it
|
15
|
-
following its sister off to my [projects][] page.
|
16
|
-
|
17
|
-
Features
|
18
|
-
--------
|
19
|
-
|
20
|
-
* Layouts can be [Haml][] or [ERB][] — but not [Liquid][].
|
21
|
-
* Stylesheets can be [Sass][] or raw CSS.
|
22
|
-
* Pages and posts can be [Maruku][] or raw HTML.
|
23
|
-
* Code highlighting by [Pygments][].
|
24
|
-
|
25
|
-
Installation
|
26
|
-
------------
|
27
|
-
|
28
|
-
The easiest way to install Semi-Static is via [RubyGems][]:
|
29
|
-
|
30
|
-
$ sudo gem install zzot-semi-static -s http://gems.github.com/
|
31
|
-
|
32
|
-
Semi-Static requires the \`Haml\` and \`Maruku\` gems and the \`Pygments\`
|
33
|
-
library to be installed.
|
34
|
-
|
35
|
-
Usage
|
36
|
-
-----
|
37
|
-
|
38
|
-
$ semi source-path \[output-path\]
|
39
|
-
|
40
|
-
License
|
41
|
-
-------
|
42
|
-
|
43
|
-
(The MIT License)
|
44
|
-
|
45
|
-
Copyright (c) 2009 Josh Dady
|
46
|
-
|
47
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
48
|
-
a copy of this software and associated documentation files (the
|
49
|
-
'Software'), to deal in the Software without restriction, including
|
50
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
51
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
52
|
-
permit persons to whom the Software is furnished to do so, subject to
|
53
|
-
the following conditions:
|
54
|
-
|
55
|
-
The above copyright notice and this permission notice shall be
|
56
|
-
included in all copies or substantial portions of the Software.
|
57
|
-
|
58
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
59
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
60
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
61
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
62
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
63
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
64
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
65
|
-
|
66
|
-
[*CMS]: Content Management System
|
67
|
-
[*CSS]: Cascading Style Sheets
|
68
|
-
[*HTML]: HyperText Markup Language
|
69
|
-
|
70
|
-
[semi-static]: http://github.com/zzot/semi-static
|
71
|
-
[jekyll]: http://github.com/mojombo/jekyll
|
72
|
-
[git]: http://git-scm.com/
|
73
|
-
[github]: http://github.com/
|
74
|
-
[pages]: http://pages.github.com
|
75
|
-
[rails]: http://rubyonrails.org/
|
76
|
-
[projects]: http://github.com/zzot
|
77
|
-
[haml]: http://haml.hamptoncatlin.com/
|
78
|
-
[sass]: http://haml.hamptoncatlin.com/
|
79
|
-
[erb]: http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/
|
80
|
-
[liquid]: http://www.liquidmarkup.org/
|
81
|
-
[maruku]: http://maruku.rubyforge.org/
|
82
|
-
[pygments]: http://pygments.org/
|
83
|
-
[rubygems]: http://www.rubygems.org/
|
84
|
-
[ruby]: http://ruby-lang.org/
|
@@ -1,74 +0,0 @@
|
|
1
|
-
module SemiStatic
|
2
|
-
class Categories < Hash
|
3
|
-
def self.slugize(name)
|
4
|
-
name.to_s.gsub(/ /, '-').downcase.to_sym
|
5
|
-
end
|
6
|
-
|
7
|
-
class Category < Array
|
8
|
-
attr_reader :slug, :name
|
9
|
-
|
10
|
-
def initialize(name, slug)
|
11
|
-
@name, @slug = name, slug
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
# def initialize
|
16
|
-
# super { |hash,key| hash[key] = Category.new(key) }
|
17
|
-
# end
|
18
|
-
|
19
|
-
def [](name)
|
20
|
-
slug = Categories.slugize name
|
21
|
-
category = super(slug)
|
22
|
-
if category.nil?
|
23
|
-
category = Category.new name.to_s, slug
|
24
|
-
self[slug] = category
|
25
|
-
end
|
26
|
-
return category
|
27
|
-
end
|
28
|
-
|
29
|
-
def slugs
|
30
|
-
keys.sort { |l,r| l.to_s <=> r.to_s }
|
31
|
-
end
|
32
|
-
|
33
|
-
def names
|
34
|
-
values.collect { |c| c.name }.sort { |l,r| l.to_s <=> r.to_s }
|
35
|
-
end
|
36
|
-
|
37
|
-
def nested_values
|
38
|
-
result = Hash.new { |hash,key| hash[key] = Hash.new }
|
39
|
-
values.each do |item|
|
40
|
-
parent, child = item.slug.to_s.split '/'
|
41
|
-
if child.nil?
|
42
|
-
result[parent.to_sym][nil] = item
|
43
|
-
else
|
44
|
-
result[parent.to_sym][child.to_sym] = item
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
result.collect do |parent_slug,items|
|
49
|
-
parent = items.delete(nil)
|
50
|
-
children = items.values.sort { |l,r| l.name.casecmp r.name }
|
51
|
-
|
52
|
-
class << parent
|
53
|
-
attr_accessor :slug, :children
|
54
|
-
end
|
55
|
-
parent.children = children
|
56
|
-
parent
|
57
|
-
end.sort { |l,r| l.name.casecmp r.name }
|
58
|
-
end
|
59
|
-
|
60
|
-
def each(options={}, &block)
|
61
|
-
list = case options[:order]
|
62
|
-
when :name, nil
|
63
|
-
values.sort { |l,r| l.name.casecmp r.name }
|
64
|
-
when :count
|
65
|
-
values.sort { |l,r| r.count <=> l.count }
|
66
|
-
when :tree
|
67
|
-
nested_values
|
68
|
-
else
|
69
|
-
raise ArgumentError, "Unknown order: #{options[:order]}"
|
70
|
-
end
|
71
|
-
list.each(&block)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|