allegro 0.0.0pre → 0.0.0pre1

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/lib/allegro.rb CHANGED
@@ -10,6 +10,8 @@ require 'open-uri'
10
10
  require 'rdiscount'
11
11
  require 'builder'
12
12
  require 'fileutils'
13
+ require 'coderay'
14
+ require 'rack/codehighlighter'
13
15
 
14
16
  require 'allegro/ext/ext'
15
17
  require 'allegro/version'
@@ -20,6 +22,8 @@ require 'allegro/context'
20
22
  require 'allegro/archives'
21
23
  require 'allegro/article'
22
24
  require 'allegro/server'
25
+ require 'allegro/config'
26
+
23
27
 
24
28
  module Allegro
25
29
  Paths = {
@@ -64,40 +64,4 @@ module Allegro
64
64
  alias :to_s to_html
65
65
  end
66
66
 
67
- class Config < Hash
68
- Defaults = {
69
- :author => ENV['USER'], # blog author
70
- :title => Dir.pwd.split('/').last, # site title
71
- :root => "index", # site index
72
- :url => "http://127.0.0.1", # root URL of the site
73
- :prefix => "", # common path prefix for the blog
74
- :date => lambda {|now| now.strftime("%d/%m/%Y") }, # date function
75
- :markdown => :smart, # use markdown
76
- :disqus => false, # disqus name
77
- :summary => {:max => 150, :delim => /~\n/}, # length of summary and delimiter
78
- :ext => 'txt', # extension for articles
79
- :cache => 28800, # cache duration (seconds)
80
- :github => {:user => "", :repos => [], :ext => 'md'}, # Github username and list of repos
81
- :to_html => lambda {|path, page, ctx| # returns an html, from a path & context
82
- ERB.new(File.read("#{path}/#{page}.rhtml")).result(ctx)
83
- },
84
- :error => lambda {|code| # The HTML for your error page
85
- "<font style='font-size:300%'>allegro, we're not in Kansas anymore (#{code})</font>"
86
- }
87
- }
88
- def initialize obj
89
- self.update Defaults
90
- self.update obj
91
- end
92
-
93
- def set key, val = nil, &blk
94
- if val.is_a? Hash
95
- self[key].update val
96
- else
97
- self[key] = block_given?? blk : val
98
- end
99
- end
100
- end
101
-
102
67
  end
103
-
@@ -0,0 +1,36 @@
1
+ module Allegro
2
+
3
+ class Config < Hash
4
+ Defaults = {
5
+ :author => ENV['USER'], # blog author
6
+ :title => Dir.pwd.split('/').last, # site title
7
+ :root => "index", # site index
8
+ :url => "http://127.0.0.1", # root URL of the site
9
+ :prefix => "", # common path prefix for the blog
10
+ :date => lambda {|now| now.strftime("%d/%m/%Y") }, # date function
11
+ :markdown => :smart, # use markdown
12
+ :disqus => false, # disqus name
13
+ :summary => {:max => 150, :delim => /~\n/}, # length of summary and delimiter
14
+ :ext => 'txt', # extension for articles
15
+ :cache => 28800, # cache duration (seconds)
16
+ :github => {:user => "", :repos => [], :ext => 'md'}, # Github username and list of repos
17
+ :to_html => lambda {|path, page, ctx| # returns an html, from a path & context
18
+ ERB.new(File.read("#{path}/#{page}.rhtml")).result(ctx)
19
+ },
20
+ :error => lambda {|code| # The HTML for your error page
21
+ "<font style='font-size:300%'>allegro, we're not in Kansas anymore (#{code})</font>"
22
+ }
23
+ }
24
+ def initialize obj
25
+ self.update Defaults
26
+ self.update obj
27
+ end
28
+
29
+ def set key, val = nil, &blk
30
+ if val.is_a? Hash
31
+ self[key].update val
32
+ else
33
+ self[key] = block_given?? blk : val
34
+ end
35
+ end
36
+ end
@@ -1,3 +1,3 @@
1
1
  module Allegro
2
- Version = VERSION = '0.0.0pre'
2
+ Version = VERSION = '0.0.0pre1'
3
3
  end
@@ -5,3 +5,11 @@ date: 1900/05/17
5
5
  Dorothy lived in the midst of the great Kansas prairies, with Uncle Henry,
6
6
  who was a farmer, and Aunt Em, who was the farmer's wife.
7
7
 
8
+ Tasty test:
9
+
10
+ :::ruby
11
+ # it's 4 spaces indentation, don't forget that
12
+ def test
13
+ puts "test !" if super(nil)
14
+ end
15
+
@@ -1,9 +1,10 @@
1
-
2
1
  require 'allegro'
3
2
 
4
3
  # Rack config
5
4
  use Rack::Static, :urls => ['/css', '/js', '/images', '/favicon.ico'], :root => 'public'
6
5
  use Rack::CommonLogger
6
+ use Rack::Codehighlighter, :coderay, :markdown => true, :element => "pre>code", :pattern => /\A:::(\w+)\s*(\n|&#x000A;)/i, :logging => true
7
+
7
8
 
8
9
  if ENV['RACK_ENV'] == 'development'
9
10
  use Rack::ShowExceptions
@@ -0,0 +1,130 @@
1
+ .CodeRay {
2
+ background-color: #f8f8f8;
3
+ border: 1px solid silver;
4
+ font-family: 'Courier New', 'Terminal', monospace;
5
+ color: #000;
6
+ }
7
+ .CodeRay pre { margin: 0px }
8
+
9
+ div.CodeRay { }
10
+
11
+ span.CodeRay { white-space: pre; border: 0px; padding: 2px }
12
+
13
+ table.CodeRay { border-collapse: collapse; width: 100%; padding: 2px }
14
+ table.CodeRay td { padding: 2px 4px; vertical-align: top }
15
+
16
+ .CodeRay .line_numbers, .CodeRay .no {
17
+ background-color: #def;
18
+ color: gray;
19
+ text-align: right;
20
+ }
21
+ .CodeRay .line_numbers tt { font-weight: bold }
22
+ .CodeRay .line_numbers .highlighted { color: red }
23
+ .CodeRay .no { padding: 0px 4px }
24
+ .CodeRay .code { width: 100% }
25
+
26
+ ol.CodeRay { font-size: 10pt }
27
+ ol.CodeRay li { white-space: pre }
28
+
29
+ .CodeRay .code pre { overflow: auto }
30
+
31
+ .CodeRay .debug { color:white ! important; background:blue ! important; }
32
+
33
+ .CodeRay .af { color:#00C }
34
+ .CodeRay .an { color:#007 }
35
+ .CodeRay .at { color:#f08 }
36
+ .CodeRay .av { color:#700 }
37
+ .CodeRay .aw { color:#C00 }
38
+ .CodeRay .bi { color:#509; font-weight:bold }
39
+ .CodeRay .c { color:#888; }
40
+
41
+ .CodeRay .ch { color:#04D }
42
+ .CodeRay .ch .k { color:#04D }
43
+ .CodeRay .ch .dl { color:#039 }
44
+
45
+ .CodeRay .cl { color:#B06; font-weight:bold }
46
+ .CodeRay .cm { color:#A08; font-weight:bold }
47
+ .CodeRay .co { color:#036; font-weight:bold }
48
+ .CodeRay .cr { color:#0A0 }
49
+ .CodeRay .cv { color:#369 }
50
+ .CodeRay .de { color:#B0B; }
51
+ .CodeRay .df { color:#099; font-weight:bold }
52
+ .CodeRay .di { color:#088; font-weight:bold }
53
+ .CodeRay .dl { color:black }
54
+ .CodeRay .do { color:#970 }
55
+ .CodeRay .dt { color:#34b }
56
+ .CodeRay .ds { color:#D42; font-weight:bold }
57
+ .CodeRay .e { color:#666; font-weight:bold }
58
+ .CodeRay .en { color:#800; font-weight:bold }
59
+ .CodeRay .er { color:#F00; background-color:#FAA }
60
+ .CodeRay .ex { color:#C00; font-weight:bold }
61
+ .CodeRay .fl { color:#60E; font-weight:bold }
62
+ .CodeRay .fu { color:#06B; font-weight:bold }
63
+ .CodeRay .gv { color:#d70; font-weight:bold }
64
+ .CodeRay .hx { color:#058; font-weight:bold }
65
+ .CodeRay .i { color:#00D; font-weight:bold }
66
+ .CodeRay .ic { color:#B44; font-weight:bold }
67
+
68
+ .CodeRay .il { background: #ddd; color: black }
69
+ .CodeRay .il .il { background: #ccc }
70
+ .CodeRay .il .il .il { background: #bbb }
71
+ .CodeRay .il .idl { background: #ddd; font-weight: bold; color: #666 }
72
+ .CodeRay .idl { background-color: #bbb; font-weight: bold; color: #666; }
73
+
74
+ .CodeRay .im { color:#f00; }
75
+ .CodeRay .in { color:#B2B; font-weight:bold }
76
+ .CodeRay .iv { color:#33B }
77
+ .CodeRay .la { color:#970; font-weight:bold }
78
+ .CodeRay .lv { color:#963 }
79
+ .CodeRay .oc { color:#40E; font-weight:bold }
80
+ .CodeRay .of { color:#000; font-weight:bold }
81
+ .CodeRay .op { }
82
+ .CodeRay .pc { color:#038; font-weight:bold }
83
+ .CodeRay .pd { color:#369; font-weight:bold }
84
+ .CodeRay .pp { color:#579; }
85
+ .CodeRay .ps { color:#00C; font-weight:bold }
86
+ .CodeRay .pt { color:#074; font-weight:bold }
87
+ .CodeRay .r, .kw { color:#080; font-weight:bold }
88
+
89
+ .CodeRay .ke { color: #808; }
90
+ .CodeRay .ke .dl { color: #606; }
91
+ .CodeRay .ke .ch { color: #80f; }
92
+ .CodeRay .vl { color: #088; }
93
+
94
+ .CodeRay .rx { background-color:#fff0ff }
95
+ .CodeRay .rx .k { color:#808 }
96
+ .CodeRay .rx .dl { color:#404 }
97
+ .CodeRay .rx .mod { color:#C2C }
98
+ .CodeRay .rx .fu { color:#404; font-weight: bold }
99
+
100
+ .CodeRay .s { background-color:#fff0f0; color: #D20; }
101
+ .CodeRay .s .s { background-color:#ffe0e0 }
102
+ .CodeRay .s .s .s { background-color:#ffd0d0 }
103
+ .CodeRay .s .k { }
104
+ .CodeRay .s .ch { color: #b0b; }
105
+ .CodeRay .s .dl { color: #710; }
106
+
107
+ .CodeRay .sh { background-color:#f0fff0; color:#2B2 }
108
+ .CodeRay .sh .k { }
109
+ .CodeRay .sh .dl { color:#161 }
110
+
111
+ .CodeRay .sy { color:#A60 }
112
+ .CodeRay .sy .k { color:#A60 }
113
+ .CodeRay .sy .dl { color:#630 }
114
+
115
+ .CodeRay .ta { color:#070 }
116
+ .CodeRay .tf { color:#070; font-weight:bold }
117
+ .CodeRay .ts { color:#D70; font-weight:bold }
118
+ .CodeRay .ty { color:#339; font-weight:bold }
119
+ .CodeRay .v { color:#036 }
120
+ .CodeRay .xt { color:#444 }
121
+
122
+ .CodeRay .ins { background: #afa; }
123
+ .CodeRay .del { background: #faa; }
124
+ .CodeRay .chg { color: #aaf; background: #007; }
125
+ .CodeRay .head { color: #f8f; background: #505 }
126
+
127
+ .CodeRay .ins .ins { color: #080; font-weight:bold }
128
+ .CodeRay .del .del { color: #800; font-weight:bold }
129
+ .CodeRay .chg .chg { color: #66f; }
130
+ .CodeRay .head .head { color: #f4f; }
@@ -3,6 +3,7 @@
3
3
  <head>
4
4
  <link rel="stylesheet" type="text/css" href="/css/main.css">
5
5
  <link rel="alternate" type="application/atom+xml" title="<%= title %> - feed" href="/index.xml" />
6
+ <link rel="stylesheet" type="text/css" href="/css/coderay.css">
6
7
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
7
8
  <title><%= title %></title>
8
9
  </head>
metadata CHANGED
@@ -5,19 +5,83 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 0pre
9
- version: 0.0.0pre
8
+ - 0pre1
9
+ version: 0.0.0pre1
10
10
  platform: ruby
11
11
  authors:
12
- - Ermenegildo Fiorito
12
+ - Ermenegildo Fiorito (fyskij)
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-09-23 00:00:00 +02:00
17
+ date: 2010-09-24 00:00:00 +02:00
18
18
  default_executable:
19
- dependencies: []
20
-
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: builder
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ type: :runtime
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: rack-codehighlighter
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ version: "0"
44
+ type: :runtime
45
+ version_requirements: *id002
46
+ - !ruby/object:Gem::Dependency
47
+ name: coderay
48
+ prerelease: false
49
+ requirement: &id003 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ segments:
55
+ - 0
56
+ version: "0"
57
+ type: :runtime
58
+ version_requirements: *id003
59
+ - !ruby/object:Gem::Dependency
60
+ name: rack
61
+ prerelease: false
62
+ requirement: &id004 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ segments:
68
+ - 0
69
+ version: "0"
70
+ type: :runtime
71
+ version_requirements: *id004
72
+ - !ruby/object:Gem::Dependency
73
+ name: rdiscount
74
+ prerelease: false
75
+ requirement: &id005 !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ segments:
81
+ - 0
82
+ version: "0"
83
+ type: :runtime
84
+ version_requirements: *id005
21
85
  description: a pure ruby blog system based on cloudhead's toto
22
86
  email: fiorito.g@gmail.com
23
87
  executables:
@@ -29,6 +93,7 @@ extra_rdoc_files: []
29
93
  files:
30
94
  - README.md
31
95
  - lib/template/public/css/main.css
96
+ - lib/template/public/css/coderay.css
32
97
  - lib/template/Rakefile
33
98
  - lib/template/articles/1900-05-17-the-wonderful-wizard-of-oz.txt
34
99
  - lib/template/templates/pages/article.rhtml
@@ -42,6 +107,7 @@ files:
42
107
  - lib/allegro.rb
43
108
  - lib/allegro/version.rb
44
109
  - lib/allegro/template.rb
110
+ - lib/allegro/config.rb
45
111
  - lib/allegro/site.rb
46
112
  - lib/allegro/ext/ext.rb
47
113
  - lib/allegro/context.rb
@@ -54,7 +120,7 @@ has_rdoc: true
54
120
  homepage: http://github.com/fyskij/allegro
55
121
  licenses: []
56
122
 
57
- post_install_message: " \n \n ...of this astounding life down here\n and of the strange clowns in control of it\n\n -L. F.\n \n \n"
123
+ post_install_message: "\n\n ...of this astounding life down here\n and of the strange clowns in control of it\n\n -L. F.\n\n\n"
58
124
  rdoc_options: []
59
125
 
60
126
  require_paths:
@@ -83,6 +149,6 @@ rubyforge_project:
83
149
  rubygems_version: 1.3.7
84
150
  signing_key:
85
151
  specification_version: 3
86
- summary: enjoy blogging
152
+ summary: a pure ruby blog system based on cloudhead's toto
87
153
  test_files: []
88
154