cg 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +21 -0
- data/README.rdoc +65 -0
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/bin/cg +8 -0
- data/cg.gemspec +84 -0
- data/lib/cg/convert.rb +87 -0
- data/lib/cg/rebuild.rb +26 -0
- data/lib/cg/scratch.rb +39 -0
- data/lib/contents_generator.rb +33 -0
- data/skel/images/please_puts_image_here +0 -0
- data/skel/markdown/index.mkd +8 -0
- data/skel/scripts/create-elements.js +7 -0
- data/skel/scripts/disqus.js +10 -0
- data/skel/styles/cg.css +220 -0
- data/skel/styles/default.css +41 -0
- data/skel/styles/fonts-min.css +8 -0
- data/skel/styles/iphone.css +111 -0
- data/skel/styles/reset-min.css +8 -0
- data/skel/templates/disqus.rb +22 -0
- data/skel/templates/html.rb +36 -0
- data/spec/cg_spec.rb +7 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +9 -0
- metadata +158 -0
data/.document
ADDED
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2010 Tomohiro, TAIRA
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
= cg
|
2
|
+
|
3
|
+
== Description
|
4
|
+
|
5
|
+
cg is A Ruby based HTML "contents generator".
|
6
|
+
|
7
|
+
|
8
|
+
== Required RubyGems
|
9
|
+
|
10
|
+
* rake
|
11
|
+
* jeweler
|
12
|
+
* tilt
|
13
|
+
* erubis
|
14
|
+
* rdiscount
|
15
|
+
|
16
|
+
|
17
|
+
== Install
|
18
|
+
|
19
|
+
- RubyGems.org
|
20
|
+
|
21
|
+
$ sudo gem install cg
|
22
|
+
|
23
|
+
- GitHub
|
24
|
+
|
25
|
+
$ git clone http://github.com/Tomohiro/cg.git
|
26
|
+
$ rake build
|
27
|
+
$ sudo rake install
|
28
|
+
|
29
|
+
|
30
|
+
== Usage
|
31
|
+
|
32
|
+
1. First Step
|
33
|
+
|
34
|
+
$ cg scratch cg.example.com
|
35
|
+
|
36
|
+
2. All Rebuild
|
37
|
+
|
38
|
+
$ cd cg.example.com
|
39
|
+
$ cg rebuild
|
40
|
+
|
41
|
+
3. Convert
|
42
|
+
|
43
|
+
$ cd cg.example.com/markdown/
|
44
|
+
$ cg convert markdown_file
|
45
|
+
|
46
|
+
|
47
|
+
== Note on Patches/Pull Requests
|
48
|
+
|
49
|
+
* Fork the project.
|
50
|
+
* Make your feature addition or bug fix.
|
51
|
+
* Add tests for it. This is important so I don't break it in a
|
52
|
+
future version unintentionally.
|
53
|
+
* Commit, do not mess with rakefile, version, or history.
|
54
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
55
|
+
* Send me a pull request. Bonus points for topic branches.
|
56
|
+
|
57
|
+
|
58
|
+
== Copyright
|
59
|
+
|
60
|
+
Copyright (c) 2010 Tomohiro, TAIRA.
|
61
|
+
|
62
|
+
|
63
|
+
== Licence
|
64
|
+
|
65
|
+
The MIT License. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = 'cg'
|
8
|
+
gem.summary = 'HTML Contents Generator'
|
9
|
+
gem.description = 'cg is A Ruby based contents generator'
|
10
|
+
gem.email = "tomohiro.t+github@gmail.com"
|
11
|
+
gem.homepage = "http://github.com/Tomohiro/cg"
|
12
|
+
gem.authors = ["Tomohiro, TAIRA"]
|
13
|
+
gem.add_dependency 'tilt', '>= 0.9'
|
14
|
+
gem.add_dependency 'erubis', '>= 2.6.5'
|
15
|
+
gem.add_dependency 'nokogiri', '>= 1.4.1'
|
16
|
+
gem.add_dependency 'rdiscount', '>= 1.6.3.1'
|
17
|
+
gem.add_development_dependency "rspec", ">= 1.2.9"
|
18
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
19
|
+
end
|
20
|
+
Jeweler::GemcutterTasks.new
|
21
|
+
rescue LoadError
|
22
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
23
|
+
end
|
24
|
+
|
25
|
+
require 'spec/rake/spectask'
|
26
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
27
|
+
spec.libs << 'lib' << 'spec'
|
28
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
29
|
+
end
|
30
|
+
|
31
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
32
|
+
spec.libs << 'lib' << 'spec'
|
33
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
34
|
+
spec.rcov = true
|
35
|
+
end
|
36
|
+
|
37
|
+
task :spec => :check_dependencies
|
38
|
+
|
39
|
+
task :default => :spec
|
40
|
+
|
41
|
+
require 'rake/rdoctask'
|
42
|
+
Rake::RDocTask.new do |rdoc|
|
43
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
44
|
+
|
45
|
+
rdoc.rdoc_dir = 'rdoc'
|
46
|
+
rdoc.title = "cg #{version}"
|
47
|
+
rdoc.rdoc_files.include('README*')
|
48
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
49
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/bin/cg
ADDED
data/cg.gemspec
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{cg}
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Tomohiro, TAIRA"]
|
12
|
+
s.date = %q{2010-04-26}
|
13
|
+
s.default_executable = %q{cg}
|
14
|
+
s.description = %q{cg is A Ruby based contents generator}
|
15
|
+
s.email = %q{tomohiro.t+github@gmail.com}
|
16
|
+
s.executables = ["cg"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE",
|
19
|
+
"README.rdoc"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".document",
|
23
|
+
".gitignore",
|
24
|
+
"LICENSE",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"bin/cg",
|
29
|
+
"cg.gemspec",
|
30
|
+
"lib/cg/convert.rb",
|
31
|
+
"lib/cg/rebuild.rb",
|
32
|
+
"lib/cg/scratch.rb",
|
33
|
+
"lib/contents_generator.rb",
|
34
|
+
"skel/images/please_puts_image_here",
|
35
|
+
"skel/markdown/index.mkd",
|
36
|
+
"skel/scripts/create-elements.js",
|
37
|
+
"skel/scripts/disqus.js",
|
38
|
+
"skel/styles/cg.css",
|
39
|
+
"skel/styles/default.css",
|
40
|
+
"skel/styles/fonts-min.css",
|
41
|
+
"skel/styles/iphone.css",
|
42
|
+
"skel/styles/reset-min.css",
|
43
|
+
"skel/templates/disqus.rb",
|
44
|
+
"skel/templates/html.rb",
|
45
|
+
"spec/cg_spec.rb",
|
46
|
+
"spec/spec.opts",
|
47
|
+
"spec/spec_helper.rb"
|
48
|
+
]
|
49
|
+
s.homepage = %q{http://github.com/Tomohiro/cg}
|
50
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
51
|
+
s.require_paths = ["lib"]
|
52
|
+
s.rubygems_version = %q{1.3.6}
|
53
|
+
s.summary = %q{HTML Contents Generator}
|
54
|
+
s.test_files = [
|
55
|
+
"spec/cg_spec.rb",
|
56
|
+
"spec/spec_helper.rb"
|
57
|
+
]
|
58
|
+
|
59
|
+
if s.respond_to? :specification_version then
|
60
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
61
|
+
s.specification_version = 3
|
62
|
+
|
63
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
64
|
+
s.add_runtime_dependency(%q<tilt>, [">= 0.9"])
|
65
|
+
s.add_runtime_dependency(%q<erubis>, [">= 2.6.5"])
|
66
|
+
s.add_runtime_dependency(%q<nokogiri>, [">= 1.4.1"])
|
67
|
+
s.add_runtime_dependency(%q<rdiscount>, [">= 1.6.3.1"])
|
68
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
69
|
+
else
|
70
|
+
s.add_dependency(%q<tilt>, [">= 0.9"])
|
71
|
+
s.add_dependency(%q<erubis>, [">= 2.6.5"])
|
72
|
+
s.add_dependency(%q<nokogiri>, [">= 1.4.1"])
|
73
|
+
s.add_dependency(%q<rdiscount>, [">= 1.6.3.1"])
|
74
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
75
|
+
end
|
76
|
+
else
|
77
|
+
s.add_dependency(%q<tilt>, [">= 0.9"])
|
78
|
+
s.add_dependency(%q<erubis>, [">= 2.6.5"])
|
79
|
+
s.add_dependency(%q<nokogiri>, [">= 1.4.1"])
|
80
|
+
s.add_dependency(%q<rdiscount>, [">= 1.6.3.1"])
|
81
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
data/lib/cg/convert.rb
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
require 'rubygems'
|
6
|
+
require 'tilt'
|
7
|
+
require 'erubis'
|
8
|
+
require 'rdiscount'
|
9
|
+
require 'nokogiri'
|
10
|
+
|
11
|
+
module CG
|
12
|
+
class Convert
|
13
|
+
include FileUtils
|
14
|
+
|
15
|
+
def initialize(source)
|
16
|
+
@source = source || ARGV.first
|
17
|
+
@site_base_path = File.expand_path(File.dirname(@source)).gsub('markdown', '')
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.start!(source = nil)
|
21
|
+
new(source).start
|
22
|
+
end
|
23
|
+
|
24
|
+
def start
|
25
|
+
dir_path, html_name = gen_output_path(@source)
|
26
|
+
|
27
|
+
template = load_template
|
28
|
+
@article = article_rendering(load_markdown(@source))
|
29
|
+
@relative = relative_path(dir_path)
|
30
|
+
|
31
|
+
mkdir_p dir_path
|
32
|
+
|
33
|
+
open(File.join(dir_path, html_name), 'w') do |f|
|
34
|
+
f.write page_build(template)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def gen_output_path(source)
|
39
|
+
markdown_base = File.dirname(source)
|
40
|
+
expand_path = source.gsub(/-|\+/, '/')
|
41
|
+
|
42
|
+
dir_path = File.expand_path("#{@site_base_path}/#{File.dirname(expand_path).gsub(markdown_base, '')}")
|
43
|
+
html_name = File.basename(expand_path).gsub('.mkd', '.html')
|
44
|
+
|
45
|
+
[dir_path, html_name]
|
46
|
+
end
|
47
|
+
|
48
|
+
def relative_path(dir_path)
|
49
|
+
point = dir_path.gsub(@site_base_path, '').split('/').count
|
50
|
+
'../' * point
|
51
|
+
end
|
52
|
+
|
53
|
+
def load_template(template_name = 'html.rb')
|
54
|
+
Tilt::ErubisTemplate.new do
|
55
|
+
File.read("#{@site_base_path}/templates/#{template_name}")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def load_markdown(source)
|
60
|
+
Tilt::RDiscountTemplate.new { File.read(source) }
|
61
|
+
end
|
62
|
+
|
63
|
+
def article_rendering(markdown)
|
64
|
+
@disqus_subdomain = @site_base_path.split('/').last.gsub('.', '-')
|
65
|
+
@disqus = disqus_template
|
66
|
+
|
67
|
+
article = Tilt::ErubisTemplate.new { markdown.render }
|
68
|
+
article.render(self)
|
69
|
+
end
|
70
|
+
|
71
|
+
def page_build(page)
|
72
|
+
@title = [(Nokogiri::HTML(@article)/'h2').text, (Nokogiri::HTML(@article)/'h1').text].join(' - ')
|
73
|
+
|
74
|
+
page.render(self)
|
75
|
+
end
|
76
|
+
|
77
|
+
def disqus_template
|
78
|
+
return unless File.exist? "#{@site_base_path}/templates/disqus.rb"
|
79
|
+
disqus = Tilt::ErubisTemplate.new { File.read("#{@site_base_path}/templates/disqus.rb") }
|
80
|
+
disqus.render(self)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
if __FILE__ == $0
|
86
|
+
CG::Convert.start!
|
87
|
+
end
|
data/lib/cg/rebuild.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$: << File.expand_path(File.dirname(__FILE__))
|
4
|
+
|
5
|
+
require 'convert'
|
6
|
+
|
7
|
+
module CG
|
8
|
+
class Rebuild
|
9
|
+
def initialize
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.start!
|
13
|
+
new.start
|
14
|
+
end
|
15
|
+
|
16
|
+
def start
|
17
|
+
Dir.glob('markdown/*.mkd').each do |file|
|
18
|
+
CG::Convert.start! file
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
if __FILE__ == $0
|
25
|
+
CG::Rebuild.start!
|
26
|
+
end
|
data/lib/cg/scratch.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
SKEL_PATH = File.expand_path('../../skel', File.dirname(__FILE__))
|
6
|
+
|
7
|
+
module CG
|
8
|
+
class Scratch
|
9
|
+
include FileUtils
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
@site = ARGV.first || 'example'
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.start!
|
16
|
+
new.start
|
17
|
+
end
|
18
|
+
|
19
|
+
def start
|
20
|
+
mkdir(@site) unless dir_exists?(@site)
|
21
|
+
cd(@site) do |dir|
|
22
|
+
cp_r(Dir.glob(SKEL_PATH + '/*'), './')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def dir_exists?(name)
|
27
|
+
begin
|
28
|
+
cd(name) { }
|
29
|
+
true
|
30
|
+
rescue Errno::ENOENT
|
31
|
+
false
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
if __FILE__ == $0
|
38
|
+
CG::Scratch.start!
|
39
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
CG_LIB = "#{CG_ROOT}/lib/cg"
|
4
|
+
|
5
|
+
require 'optparse'
|
6
|
+
|
7
|
+
class ContentsGenerator
|
8
|
+
def initialize
|
9
|
+
@command = ARGV.shift
|
10
|
+
@argv = ARGV
|
11
|
+
@commands = get_commands
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.boot
|
15
|
+
new.switch
|
16
|
+
end
|
17
|
+
|
18
|
+
def switch
|
19
|
+
if @commands.include? @command
|
20
|
+
exec("ruby #{CG_LIB}/#{@command}.rb #{@argv.join(' ')}")
|
21
|
+
else
|
22
|
+
puts OptionParser.new("Usage: cg [#{@commands.join('|')}]").help
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_commands
|
27
|
+
commands = []
|
28
|
+
Dir.entries(CG_LIB).each do |file|
|
29
|
+
commands << file.gsub!('.rb', '') if file =~ /rb/
|
30
|
+
end
|
31
|
+
commands
|
32
|
+
end
|
33
|
+
end
|
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
(function() {
|
2
|
+
var links = document.getElementsByTagName('a');
|
3
|
+
var query = '?';
|
4
|
+
for(var i = 0; i < links.length; i++) {
|
5
|
+
if(links[i].href.indexOf('#disqus_thread') >= 0) {
|
6
|
+
query += 'url' + i + '=' + encodeURIComponent(links[i].href) + '&';
|
7
|
+
}
|
8
|
+
}
|
9
|
+
document.write('<script charset="utf-8" type="text/javascript" src="http://disqus.com/forums/tomohiro-github-com/get_num_replies.js' + query + '"></' + 'script>');
|
10
|
+
})();
|
data/skel/styles/cg.css
ADDED
@@ -0,0 +1,220 @@
|
|
1
|
+
@charset 'utf-8';
|
2
|
+
/* 自由に編集可 */
|
3
|
+
|
4
|
+
body {
|
5
|
+
font-family: Times, 'Times New Roman', 'メイリオ', 'FreeSerif', serif;
|
6
|
+
text-align: center;
|
7
|
+
width: 800px;
|
8
|
+
text-align: left;
|
9
|
+
margin: 0 auto;
|
10
|
+
}
|
11
|
+
|
12
|
+
header, nav, footer, article, section, aside {
|
13
|
+
display: block;
|
14
|
+
}
|
15
|
+
|
16
|
+
body em {
|
17
|
+
font-weight: bold;
|
18
|
+
}
|
19
|
+
|
20
|
+
h1, h3, h5 {
|
21
|
+
font-family: Times, 'Times New Roman', 'メイリオ', 'FreeSerif', sans-serif;
|
22
|
+
}
|
23
|
+
|
24
|
+
h2 {
|
25
|
+
font-family: Helvetica, Verdana, 'メイリオ', 'FreeSans', sans-serif;
|
26
|
+
}
|
27
|
+
|
28
|
+
h1 {
|
29
|
+
margin: 30px 0 40px 0;
|
30
|
+
padding: 2px 30px;
|
31
|
+
width: 30px;
|
32
|
+
background-color: #000;
|
33
|
+
color: #fff;
|
34
|
+
-moz-border-radius: 12px;
|
35
|
+
-webkit-border-radius: 12px;
|
36
|
+
font-size: 240%;
|
37
|
+
}
|
38
|
+
|
39
|
+
h2 {
|
40
|
+
margin: 20px 0;
|
41
|
+
margin-top: 60px;
|
42
|
+
font-size: 165%;
|
43
|
+
line-height: 150%;
|
44
|
+
border-bottom: 2px solid #000;
|
45
|
+
}
|
46
|
+
|
47
|
+
h3 {
|
48
|
+
margin: 10px 0;
|
49
|
+
margin-top: 20px;
|
50
|
+
font-size: 140%;
|
51
|
+
line-height: 150%;
|
52
|
+
border-bottom: 1px solid #6d6d6d;
|
53
|
+
}
|
54
|
+
|
55
|
+
h4 {
|
56
|
+
margin: 10px 0;
|
57
|
+
margin-top: 20px;
|
58
|
+
font-weight: bold;
|
59
|
+
font-family: Helvetica, Verdana, 'FreeSans', sans-serif;
|
60
|
+
}
|
61
|
+
|
62
|
+
form {
|
63
|
+
color: #585858;
|
64
|
+
background-color: #f5f5f5;
|
65
|
+
border-top: 1px dashed #d3d3d3;
|
66
|
+
}
|
67
|
+
|
68
|
+
form input, form select {
|
69
|
+
padding: 3px;
|
70
|
+
background-color: #fff;
|
71
|
+
border: 1px solid #c6c6c6;
|
72
|
+
font-weight: bold;
|
73
|
+
}
|
74
|
+
|
75
|
+
a {
|
76
|
+
text-decoration: none;
|
77
|
+
color: #06b;
|
78
|
+
}
|
79
|
+
|
80
|
+
p {
|
81
|
+
padding: 10px 0;
|
82
|
+
}
|
83
|
+
|
84
|
+
code {
|
85
|
+
padding: 3px;
|
86
|
+
border: 1px solid #d3d3d3;
|
87
|
+
border-radius: 0.5em;
|
88
|
+
-moz-border-radius: 0.5em;
|
89
|
+
-webkit-border-radius: 0.5em;
|
90
|
+
background-color: #f5f5f5;
|
91
|
+
font-family: Consolas, Courier, Monaco, 'FreeMono', monospace;
|
92
|
+
letter-spacing: 1px;
|
93
|
+
}
|
94
|
+
|
95
|
+
pre {
|
96
|
+
margin: 6px 0;
|
97
|
+
border: 1px solid #d3d3d3;
|
98
|
+
border-radius: 0.4em;
|
99
|
+
-moz-border-radius: 0.4em;
|
100
|
+
-webkit-border-radius: 0.4em;
|
101
|
+
background-color: #f5f5f5;
|
102
|
+
}
|
103
|
+
|
104
|
+
pre code {
|
105
|
+
display: block;
|
106
|
+
padding: 8px;
|
107
|
+
border: none;
|
108
|
+
line-height: 1.5em;
|
109
|
+
}
|
110
|
+
|
111
|
+
ol, ul {
|
112
|
+
padding-top: 5px;
|
113
|
+
padding-left: 30px;
|
114
|
+
}
|
115
|
+
|
116
|
+
ul li {
|
117
|
+
padding: 5px;
|
118
|
+
}
|
119
|
+
|
120
|
+
ol li {
|
121
|
+
padding: 3px;
|
122
|
+
}
|
123
|
+
|
124
|
+
dl dt {
|
125
|
+
font-family: Helvetica, Verdana, 'FreeSans', sans-serif;
|
126
|
+
}
|
127
|
+
|
128
|
+
hr {
|
129
|
+
color: #fff;
|
130
|
+
border-width: 0px;
|
131
|
+
padding: 10px;
|
132
|
+
}
|
133
|
+
|
134
|
+
blockquote {
|
135
|
+
margin-top: 1em;
|
136
|
+
border-radius: 0.4em;
|
137
|
+
-moz-border-radius: 0.4em;
|
138
|
+
-webkit-border-radius: 0.4em;
|
139
|
+
background-color: #ddd;
|
140
|
+
}
|
141
|
+
|
142
|
+
blockquote p {
|
143
|
+
margin-left: 20px;
|
144
|
+
line-height: 2em;
|
145
|
+
text-align: left;
|
146
|
+
}
|
147
|
+
|
148
|
+
blockquote pre {
|
149
|
+
background-color: #000;
|
150
|
+
border: none;
|
151
|
+
}
|
152
|
+
|
153
|
+
blockquote pre code {
|
154
|
+
background: none;
|
155
|
+
font-weight: bold;
|
156
|
+
color: #fff;
|
157
|
+
}
|
158
|
+
|
159
|
+
table {
|
160
|
+
margin-bottom: 2em;
|
161
|
+
}
|
162
|
+
|
163
|
+
tr, th, td {
|
164
|
+
padding: 3px;
|
165
|
+
border: 1px solid #ccc;
|
166
|
+
font-family: Helvetica, Verdana, 'FreeSans', sans-serif;
|
167
|
+
border-top-left-radius: 0.4em;
|
168
|
+
-moz-border-top-left-radius: 0.4em;
|
169
|
+
-webkit-border-top-left-radius 0.4em;
|
170
|
+
}
|
171
|
+
|
172
|
+
th {
|
173
|
+
background-color: #ccc;
|
174
|
+
text-align: center;
|
175
|
+
}
|
176
|
+
|
177
|
+
nav {
|
178
|
+
overflow: hidden;
|
179
|
+
position: absolute;
|
180
|
+
top: 0px;
|
181
|
+
width: 800px;
|
182
|
+
}
|
183
|
+
|
184
|
+
nav ul {
|
185
|
+
float: right;
|
186
|
+
padding: 0;
|
187
|
+
padding-top: 5px;
|
188
|
+
}
|
189
|
+
|
190
|
+
nav li {
|
191
|
+
display: block;
|
192
|
+
float: left;
|
193
|
+
padding: 0;
|
194
|
+
}
|
195
|
+
|
196
|
+
nav li a {
|
197
|
+
display: block;
|
198
|
+
padding: 10px;
|
199
|
+
padding-top: 5px;
|
200
|
+
border: none;
|
201
|
+
letter-spacing: 1px;
|
202
|
+
}
|
203
|
+
|
204
|
+
nav li.current a {
|
205
|
+
border-top: 3px solid;
|
206
|
+
padding-top: 2px;
|
207
|
+
}
|
208
|
+
|
209
|
+
footer {
|
210
|
+
font-size: 95%;
|
211
|
+
color: #999;
|
212
|
+
margin: 50px 0;
|
213
|
+
font-family: Tahoma, sans-serif;
|
214
|
+
letter-spacing: 1px;
|
215
|
+
text-align: center;
|
216
|
+
}
|
217
|
+
|
218
|
+
footer p {
|
219
|
+
padding: 5px 0;
|
220
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
@charset 'utf-8';
|
2
|
+
|
3
|
+
body {
|
4
|
+
width: 100%;
|
5
|
+
font-family: Times, 'Times New Roman', 'FreeSerif', serif;
|
6
|
+
margin-bottom: 0px;
|
7
|
+
}
|
8
|
+
|
9
|
+
section, article, header, footer, aside {
|
10
|
+
display: block;
|
11
|
+
}
|
12
|
+
|
13
|
+
h1 {
|
14
|
+
margin-bottom: 0px;
|
15
|
+
font-weight: normal;
|
16
|
+
color: #1A1A1A;
|
17
|
+
}
|
18
|
+
|
19
|
+
h2 {
|
20
|
+
font-size: 200%;
|
21
|
+
font-weight: normal;
|
22
|
+
color: #1A1A1A;
|
23
|
+
}
|
24
|
+
|
25
|
+
h3 {
|
26
|
+
font-size: medium;
|
27
|
+
font-weight: normal;
|
28
|
+
}
|
29
|
+
|
30
|
+
p {
|
31
|
+
font-size: small;
|
32
|
+
}
|
33
|
+
|
34
|
+
a {
|
35
|
+
text-decoration: none;
|
36
|
+
color: #06b;
|
37
|
+
}
|
38
|
+
|
39
|
+
a img {
|
40
|
+
border: none;
|
41
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
|
3
|
+
Code licensed under the BSD License:
|
4
|
+
http://developer.yahoo.net/yui/license.txt
|
5
|
+
version: 3.0.0
|
6
|
+
build: 1549
|
7
|
+
*/
|
8
|
+
body{font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}select,input,button,textarea{font:99% arial,helvetica,clean,sans-serif;}table{font-size:inherit;font:100%;}pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;}
|
@@ -0,0 +1,111 @@
|
|
1
|
+
@charset "utf-8";
|
2
|
+
|
3
|
+
/* base style
|
4
|
+
===========================*/
|
5
|
+
body {
|
6
|
+
margin: 0;
|
7
|
+
padding: 0;
|
8
|
+
font-family: Times, serif;
|
9
|
+
width: 320px;
|
10
|
+
}
|
11
|
+
|
12
|
+
a {
|
13
|
+
text-decoration: none;
|
14
|
+
color: #06b;
|
15
|
+
border-bottom: 1px dotted;
|
16
|
+
}
|
17
|
+
|
18
|
+
h1 {
|
19
|
+
margin: 0;
|
20
|
+
padding: 45px 0 10px !important;
|
21
|
+
border-bottom: 3px solid #000;
|
22
|
+
text-align: center;
|
23
|
+
font-size: 20px;
|
24
|
+
font-family: Times, sans-serif;
|
25
|
+
}
|
26
|
+
|
27
|
+
h2 {
|
28
|
+
margin: 20px 10px 10px;
|
29
|
+
padding: 5px 0 !important;
|
30
|
+
border-bottom: 1px solid #000;
|
31
|
+
font-size: 18px;
|
32
|
+
font-family: Helvetica, Verdana, Arial, sans-serif;
|
33
|
+
}
|
34
|
+
|
35
|
+
em {
|
36
|
+
font-weight: bold;
|
37
|
+
}
|
38
|
+
|
39
|
+
ul li {
|
40
|
+
list-style-type: circle;
|
41
|
+
padding: 5px;
|
42
|
+
}
|
43
|
+
|
44
|
+
pre {
|
45
|
+
border: 1px solid #d3d3d3;
|
46
|
+
background-color: #f5f5f5;
|
47
|
+
margin: 5px 10px;
|
48
|
+
word-wrap: break-word;
|
49
|
+
}
|
50
|
+
|
51
|
+
pre code {
|
52
|
+
display: block;
|
53
|
+
padding: 5px;
|
54
|
+
font-family: Consolas, Monaco, "Courier New", monospace;
|
55
|
+
letter-spacing: 1px;
|
56
|
+
font-size: 13px;
|
57
|
+
}
|
58
|
+
|
59
|
+
div#container > * {
|
60
|
+
padding: 0 10px;
|
61
|
+
}
|
62
|
+
|
63
|
+
div#container ul {
|
64
|
+
padding: 5px 30px;
|
65
|
+
}
|
66
|
+
|
67
|
+
|
68
|
+
/* menu
|
69
|
+
===========================*/
|
70
|
+
nav {
|
71
|
+
position: absolute;
|
72
|
+
top: 0;
|
73
|
+
text-transform: lowercase;
|
74
|
+
background: #EFEFEF;
|
75
|
+
width: 320px;
|
76
|
+
padding: 0 !important;
|
77
|
+
font-size: 14px;
|
78
|
+
}
|
79
|
+
|
80
|
+
nav ul {
|
81
|
+
padding: 0px 10px 5px;
|
82
|
+
margin: 0;
|
83
|
+
list-style: none;
|
84
|
+
text-align: right;
|
85
|
+
}
|
86
|
+
|
87
|
+
nav ul li {
|
88
|
+
display: inline-block;
|
89
|
+
}
|
90
|
+
|
91
|
+
nav li.current a {
|
92
|
+
border-top: 3px solid;
|
93
|
+
padding-top: 2px;
|
94
|
+
}
|
95
|
+
|
96
|
+
|
97
|
+
/* footer
|
98
|
+
===========================*/
|
99
|
+
footer {
|
100
|
+
border-top: 1px solid #000;
|
101
|
+
text-align: center;
|
102
|
+
background: #EFEFEF;
|
103
|
+
font-size: 12px;
|
104
|
+
padding: 10px 0 !important;
|
105
|
+
margin-top: 30px;
|
106
|
+
}
|
107
|
+
|
108
|
+
footer p {
|
109
|
+
padding: 0;
|
110
|
+
margin: 10px 0;
|
111
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
|
3
|
+
Code licensed under the BSD License:
|
4
|
+
http://developer.yahoo.net/yui/license.txt
|
5
|
+
version: 3.0.0
|
6
|
+
build: 1549
|
7
|
+
*/
|
8
|
+
html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<script>
|
2
|
+
(function() {
|
3
|
+
var links = document.getElementsByTagName('a');
|
4
|
+
var query = '?';
|
5
|
+
for(var i = 0; i < links.length; i++) {
|
6
|
+
if(links[i].href.indexOf('#disqus_thread') >= 0) {
|
7
|
+
query += 'url' + i + '=' + encodeURIComponent(links[i].href) + '&';
|
8
|
+
}
|
9
|
+
}
|
10
|
+
document.write('<script charset="utf-8" type="text/javascript" src="http://disqus.com/forums/<%= @disqus_subdomain %>/get_num_replies.js' + query + '"></' + 'script>');
|
11
|
+
})();
|
12
|
+
</script>
|
13
|
+
<section id="disqus_thread"></section>
|
14
|
+
<script type="text/javascript">
|
15
|
+
(function() {
|
16
|
+
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
|
17
|
+
dsq.src = 'http://<%= @disqus_subdomain %>.disqus.com/embed.js';
|
18
|
+
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
19
|
+
})();
|
20
|
+
</script>
|
21
|
+
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript=<%= @disqus_subdomain %>">comments powered by Disqus.</a></noscript>
|
22
|
+
<a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta name="viewport" content="width=320">
|
6
|
+
<link rel="stylesheet" media="screen, print" href="<%= @relative %>styles/reset-min.css">
|
7
|
+
<link rel="stylesheet" media="screen, print" href="<%= @relative %>styles/fonts-min.css">
|
8
|
+
<link rel="stylesheet" media="screen and (min-device-width: 481px), print" href="<%= @relative %>styles/cg.css">
|
9
|
+
<link rel="stylesheet" media="only screen and (max-device-width: 480px)" href="<%= @relative %>styles/iphone.css">
|
10
|
+
<!--[if IE]><link rel="stylesheet" media="screen, projection" href="<%= @relative %>styles/cg.css"><![endif]-->
|
11
|
+
<!--[if lte IE 8]><script src="<%= @relative %>scripts/create-elements.js" type="text/javascript"></script><![endif]-->
|
12
|
+
<title><%= @title %></title>
|
13
|
+
</head>
|
14
|
+
<body>
|
15
|
+
<nav>
|
16
|
+
<ul>
|
17
|
+
<li><a href="index.html">Index</a></li>
|
18
|
+
</ul>
|
19
|
+
</nav>
|
20
|
+
|
21
|
+
<article>
|
22
|
+
|
23
|
+
<!-- Auto generated start -->
|
24
|
+
|
25
|
+
<%= @article %>
|
26
|
+
|
27
|
+
<!-- Auto generated end -->
|
28
|
+
|
29
|
+
</article>
|
30
|
+
|
31
|
+
<footer>
|
32
|
+
<p>Copyright © <%= Date.today.year %> <a href="mailto:tomohiro.t+github@gmail.com">Tomohiro</a> All rights reserved.</p>
|
33
|
+
<p>Powerd by <a href="http://github.com/Tomohiro/cg" title="cg - A Ruby based ContentsGenerator">cg - A Ruby based contents generator</a></p>
|
34
|
+
</footer>
|
35
|
+
</body>
|
36
|
+
</html>
|
data/spec/cg_spec.rb
ADDED
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cg
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Tomohiro, TAIRA
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-04-26 00:00:00 +09:00
|
18
|
+
default_executable: cg
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: tilt
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
- 9
|
30
|
+
version: "0.9"
|
31
|
+
type: :runtime
|
32
|
+
version_requirements: *id001
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: erubis
|
35
|
+
prerelease: false
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
segments:
|
41
|
+
- 2
|
42
|
+
- 6
|
43
|
+
- 5
|
44
|
+
version: 2.6.5
|
45
|
+
type: :runtime
|
46
|
+
version_requirements: *id002
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: nokogiri
|
49
|
+
prerelease: false
|
50
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
segments:
|
55
|
+
- 1
|
56
|
+
- 4
|
57
|
+
- 1
|
58
|
+
version: 1.4.1
|
59
|
+
type: :runtime
|
60
|
+
version_requirements: *id003
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rdiscount
|
63
|
+
prerelease: false
|
64
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
segments:
|
69
|
+
- 1
|
70
|
+
- 6
|
71
|
+
- 3
|
72
|
+
- 1
|
73
|
+
version: 1.6.3.1
|
74
|
+
type: :runtime
|
75
|
+
version_requirements: *id004
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: rspec
|
78
|
+
prerelease: false
|
79
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
segments:
|
84
|
+
- 1
|
85
|
+
- 2
|
86
|
+
- 9
|
87
|
+
version: 1.2.9
|
88
|
+
type: :development
|
89
|
+
version_requirements: *id005
|
90
|
+
description: cg is A Ruby based contents generator
|
91
|
+
email: tomohiro.t+github@gmail.com
|
92
|
+
executables:
|
93
|
+
- cg
|
94
|
+
extensions: []
|
95
|
+
|
96
|
+
extra_rdoc_files:
|
97
|
+
- LICENSE
|
98
|
+
- README.rdoc
|
99
|
+
files:
|
100
|
+
- .document
|
101
|
+
- .gitignore
|
102
|
+
- LICENSE
|
103
|
+
- README.rdoc
|
104
|
+
- Rakefile
|
105
|
+
- VERSION
|
106
|
+
- bin/cg
|
107
|
+
- cg.gemspec
|
108
|
+
- lib/cg/convert.rb
|
109
|
+
- lib/cg/rebuild.rb
|
110
|
+
- lib/cg/scratch.rb
|
111
|
+
- lib/contents_generator.rb
|
112
|
+
- skel/images/please_puts_image_here
|
113
|
+
- skel/markdown/index.mkd
|
114
|
+
- skel/scripts/create-elements.js
|
115
|
+
- skel/scripts/disqus.js
|
116
|
+
- skel/styles/cg.css
|
117
|
+
- skel/styles/default.css
|
118
|
+
- skel/styles/fonts-min.css
|
119
|
+
- skel/styles/iphone.css
|
120
|
+
- skel/styles/reset-min.css
|
121
|
+
- skel/templates/disqus.rb
|
122
|
+
- skel/templates/html.rb
|
123
|
+
- spec/cg_spec.rb
|
124
|
+
- spec/spec.opts
|
125
|
+
- spec/spec_helper.rb
|
126
|
+
has_rdoc: true
|
127
|
+
homepage: http://github.com/Tomohiro/cg
|
128
|
+
licenses: []
|
129
|
+
|
130
|
+
post_install_message:
|
131
|
+
rdoc_options:
|
132
|
+
- --charset=UTF-8
|
133
|
+
require_paths:
|
134
|
+
- lib
|
135
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
segments:
|
140
|
+
- 0
|
141
|
+
version: "0"
|
142
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
segments:
|
147
|
+
- 0
|
148
|
+
version: "0"
|
149
|
+
requirements: []
|
150
|
+
|
151
|
+
rubyforge_project:
|
152
|
+
rubygems_version: 1.3.6
|
153
|
+
signing_key:
|
154
|
+
specification_version: 3
|
155
|
+
summary: HTML Contents Generator
|
156
|
+
test_files:
|
157
|
+
- spec/cg_spec.rb
|
158
|
+
- spec/spec_helper.rb
|