zenweb 3.3.1 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6bd20644944f1186966e3dff500be7f0e2e46d40
4
- data.tar.gz: 55674396df72215b8f8fe41ff27f01835c694996
3
+ metadata.gz: 1f1ce6d301a838ed6be4b2bc6a0565a373955c87
4
+ data.tar.gz: 6e5283bf5788568ec6f6c13bcb74c07eed25f201
5
5
  SHA512:
6
- metadata.gz: d9eff21dec0065095156fa6f5f10a816a39464211aa56694b8c756873b1f15a552c0d664e4f421382ce4a063c90fd58092036d71e93b0fc1f79896118bdcae70
7
- data.tar.gz: 8b19d0c35bee6eb6fad00f22493aa2fce07ae32d2cb3fa79b6695a3f0d19fff136e8c5a98a989f9c680253ae960aeaea043f915f2d46d7d5dfb60179f301831e
6
+ metadata.gz: 3a4f65e5649314d122693b83e7e0a9ef78730501cebb524c2a622a680e573efb02c083588485df81a6176a625f98273eb95d3b3721396d9f11b1d0fb9757ac5b
7
+ data.tar.gz: 3d89f8b69e6b8df948a25d901334ec5da1db9ab25d03acfca70a4545648f7155f70f4a2aef4097c627e2abd45cb02e4719c69c242c89df05766094432914ae3b
checksums.yaml.gz.sig CHANGED
Binary file
data/History.txt CHANGED
@@ -1,3 +1,12 @@
1
+ === 3.4.0 / 2014-03-24
2
+
3
+ * 4 minor enhancements:
4
+
5
+ * Added FakePage to make synthesizing pages easier.
6
+ * Added task :virtual_pages and called during scan phase. Add virtual pages in your Rakefile!
7
+ * Markdown sitemap can now toggle it's subsection's dated titles.
8
+ * Modified config to be more resilient to non-file pages. Grabs content directly from page when passed one.
9
+
1
10
  === 3.3.1 / 2013-12-13
2
11
 
3
12
  * 1 bug fix:
data/lib/zenweb/config.rb CHANGED
@@ -62,14 +62,19 @@ module Zenweb
62
62
  # split("index.html.md") => [config, content]
63
63
 
64
64
  def self.split path
65
- body = File.binread path
65
+ body, yaml_file = nil, false
66
+ if String === path and File.file? path
67
+ body = File.binread path
66
68
 
67
- raise ArgumentError, "UTF BOM not supported: #{path}" if
68
- body.start_with? UTF_BOM
69
+ raise ArgumentError, "UTF BOM not supported: #{path}" if
70
+ body.start_with? UTF_BOM
69
71
 
70
- yaml_file = File.extname(path) == ".yml"
72
+ yaml_file = File.extname(path) == ".yml"
71
73
 
72
- body.force_encoding "utf-8" if File::RUBY19
74
+ body.force_encoding "utf-8" if File::RUBY19
75
+ else
76
+ body = path.content
77
+ end
73
78
 
74
79
  if yaml_file then
75
80
  [body, nil]
@@ -83,7 +88,8 @@ module Zenweb
83
88
 
84
89
  def h # :nodoc:
85
90
  @h ||= begin
86
- config, _ = self.class.split path
91
+ thing = File.file?(path) ? path : site.pages[path]
92
+ config, _ = self.class.split thing
87
93
  config && YAML.load(config) || {}
88
94
  end
89
95
  end
data/lib/zenweb/page.rb CHANGED
@@ -77,7 +77,8 @@ module Zenweb
77
77
  def body
78
78
  # TODO: add a test for something with --- without a yaml header.
79
79
  @body ||= begin
80
- _, body = Zenweb::Config.split path
80
+ thing = File.file?(path) ? path : self
81
+ _, body = Zenweb::Config.split thing
81
82
  body.strip
82
83
  end
83
84
  end
@@ -432,4 +433,15 @@ module Zenweb
432
433
  end
433
434
  end
434
435
  end # class Page
436
+
437
+ ##
438
+ # A page not rooted in an actual file. This lets you synthesize
439
+ # pages directly in rake tasks. Initialize it with a destination
440
+ # path as normal, but then you must set the date and content
441
+ # yourself.
442
+
443
+ class FakePage < Page
444
+ attr_accessor :content
445
+ attr_accessor :date
446
+ end
435
447
  end
@@ -49,17 +49,21 @@ class Zenweb::Page
49
49
  # whether the pages are ordered (dated) or not or a combination of
50
50
  # the two.
51
51
 
52
- def sitemap
52
+ def sitemap title_dated = true
53
53
  self.all_subpages.deep_each.chunk { |n, p| n }.map { |depth, a|
54
54
  level = (depth-1)/2
55
+ level = 0 if level < 0
56
+
55
57
  dated, normal = a.map(&:last).partition(&:dated?)
56
58
 
57
59
  normal = normal.sort_by(&:url).map { |p| page_sitemap_url p, level }
58
60
 
59
61
  dated = dated_map(dated) { |month, ps2|
60
- date_sorted_map(ps2) { |p|
62
+ x = date_sorted_map(ps2) { |p|
61
63
  page_sitemap_url p, level + 1
62
- }.unshift "#{" " * level}* #{month}:"
64
+ }
65
+ x.unshift "#{" " * level}* #{month}:" if title_dated
66
+ x
63
67
  }
64
68
 
65
69
  normal + dated
data/lib/zenweb/site.rb CHANGED
@@ -180,6 +180,9 @@ module Zenweb
180
180
  end
181
181
  end
182
182
 
183
+ $website = self # HACK
184
+ task(:virtual_pages).invoke
185
+
183
186
  t = Time.now
184
187
  @pages.reject! { |path, page| page.date && page.date > t } unless
185
188
  ENV["ALL"]
data/lib/zenweb.rb CHANGED
@@ -6,7 +6,7 @@ require "time"
6
6
 
7
7
  module Zenweb
8
8
  # duh
9
- VERSION = "3.3.1"
9
+ VERSION = "3.4.0"
10
10
  end
11
11
 
12
12
  require "zenweb/site"
@@ -83,6 +83,7 @@ class TestZenwebConfig < Minitest::Test
83
83
 
84
84
  assert_tasks do
85
85
  assert_task "_config.yml"
86
+ assert_task "virtual_pages", nil, Rake::Task
86
87
  assert_task "blog/_config.yml", %w[_config.yml]
87
88
  assert_task config.path, %w[blog/_config.yml]
88
89
  end
@@ -22,7 +22,7 @@ class TestZenwebPage < Minitest::Test
22
22
  Rake.application = Rake::Application.new
23
23
  site.scan
24
24
 
25
- assert_empty Rake.application.tasks
25
+ assert_empty Rake.application.tasks.map(&:name) - ["virtual_pages"]
26
26
 
27
27
  p1 = site.pages["blog/2012-01-02-page1.html.md"]
28
28
  p2 = site.pages["blog/2012-01-03-page2.html.md"]
@@ -81,6 +81,7 @@ class TestZenwebPage < Minitest::Test
81
81
  p1.depends_on p2
82
82
 
83
83
  assert_tasks do
84
+ assert_task "virtual_pages", nil, Rake::Task
84
85
  assert_task p1.url_path, [p2.url_path]
85
86
  end
86
87
  end
@@ -92,6 +93,7 @@ class TestZenwebPage < Minitest::Test
92
93
 
93
94
  # TODO: double check that this should be p1.path and not p1.url_path
94
95
  assert_tasks do
96
+ assert_task "virtual_pages", nil, Rake::Task
95
97
  assert_task p1.path, ["somethingelse"]
96
98
  end
97
99
  end
@@ -358,6 +360,8 @@ class TestZenwebPage < Minitest::Test
358
360
  page.wire
359
361
 
360
362
  assert_tasks do
363
+ assert_task "virtual_pages", nil, Rake::Task
364
+
361
365
  # dirs
362
366
  assert_task ".site"
363
367
  assert_task ".site/blog"
@@ -194,6 +194,8 @@ class TestZenwebSite < Minitest::Test
194
194
  site.wire
195
195
 
196
196
  assert_tasks do
197
+ assert_task "virtual_pages", nil, Rake::Task
198
+
197
199
  assert_task ".site"
198
200
  assert_task ".site/about"
199
201
  assert_task ".site/blog"
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zenweb
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.1
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -29,7 +29,7 @@ cert_chain:
29
29
  Y4evBVezr3SjXz08vPqRO5YRdO3zfeMT8gBjRqZjWJGMZ2lD4XNfrs7eky74CyZw
30
30
  xx3n58i0lQkBE1EpKE0lFu/y
31
31
  -----END CERTIFICATE-----
32
- date: 2013-12-14 00:00:00.000000000 Z
32
+ date: 2014-03-25 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: rake
@@ -113,14 +113,14 @@ dependencies:
113
113
  requirements:
114
114
  - - ~>
115
115
  - !ruby/object:Gem::Version
116
- version: '5.2'
116
+ version: '5.3'
117
117
  type: :development
118
118
  prerelease: false
119
119
  version_requirements: !ruby/object:Gem::Requirement
120
120
  requirements:
121
121
  - - ~>
122
122
  - !ruby/object:Gem::Version
123
- version: '5.2'
123
+ version: '5.3'
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: rdoc
126
126
  requirement: !ruby/object:Gem::Requirement
@@ -141,14 +141,14 @@ dependencies:
141
141
  requirements:
142
142
  - - ~>
143
143
  - !ruby/object:Gem::Version
144
- version: '3.7'
144
+ version: '3.9'
145
145
  type: :development
146
146
  prerelease: false
147
147
  version_requirements: !ruby/object:Gem::Requirement
148
148
  requirements:
149
149
  - - ~>
150
150
  - !ruby/object:Gem::Version
151
- version: '3.7'
151
+ version: '3.9'
152
152
  description: |-
153
153
  Zenweb is a set of classes/tools for organizing and formating a
154
154
  website. It is website oriented rather than webpage oriented, unlike
@@ -178,6 +178,7 @@ extra_rdoc_files:
178
178
  - example-site/pages/nonblogpage.html.md
179
179
  files:
180
180
  - .autotest
181
+ - .gemtest
181
182
  - History.txt
182
183
  - Manifest.txt
183
184
  - README.txt
@@ -236,7 +237,6 @@ files:
236
237
  - test/test_zenweb_plugins_less.rb
237
238
  - test/test_zenweb_plugins_markdown.rb
238
239
  - test/test_zenweb_site.rb
239
- - .gemtest
240
240
  homepage: https://github.com/seattlerb/zenweb
241
241
  licenses:
242
242
  - MIT
@@ -259,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
259
259
  version: '0'
260
260
  requirements: []
261
261
  rubyforge_project: zenweb
262
- rubygems_version: 2.1.10
262
+ rubygems_version: 2.2.1
263
263
  signing_key:
264
264
  specification_version: 4
265
265
  summary: Zenweb is a set of classes/tools for organizing and formating a website
metadata.gz.sig CHANGED
Binary file