1414 """ ),
1515
1616 'source/generate.py' : dedent ("""\
17- from flourish import helpers
18- from flourish.generators import (
17+ from flourish.generators.base import (
1918 IndexGenerator,
20- PageGenerator ,
19+ SourceGenerator ,
2120 )
2221
2322
@@ -28,32 +27,29 @@ class Homepage(IndexGenerator):
2827
2928 def global_context(self):
3029 return {
31- 'dates': helpers.all_valid_dates( self.flourish) ,
30+ 'dates': self.publication_dates ,
3231 }
3332
34- GLOBAL_CONTEXT = global_context
3533
34+ GLOBAL_CONTEXT = global_context
3635
37- SOURCE_URL = (
38- '/#slug',
39- PageGenerator.as_generator(),
40- )
4136
42- URLS = (
43- (
44- '/',
45- 'homepage',
46- Homepage.as_generator()
37+ PATHS = (
38+ SourceGenerator(
39+ path='/#slug',
40+ name='source'
41+ ),
42+ Homepage(
43+ path='/',
44+ name='homepage'
4745 ),
48- (
49- '/#year/',
50- 'year-index',
51- IndexGenerator.as_generator()
46+ IndexGenerator(
47+ path='/#year/',
48+ name='year-index'
5249 ),
53- (
54- '/#year/#month',
55- 'month-index',
56- IndexGenerator.as_generator()
50+ IndexGenerator(
51+ path='/#year/#month',
52+ name='month-index'
5753 ),
5854 )
5955 """ ),
@@ -248,10 +244,10 @@ def global_context(self):
248244 <ul>
249245 {% for year in global.dates %}
250246 <li>
251- <a href='/{{ year.year}}/ '>{{year.year}}</a>:
247+ <a href='{{ path(" year-index", year=year .year.year) }} '>{{year. year.year}}</a>:
252248 <ul>
253249 {% for month in year.months %}
254- <li><a href='/{{ year.year}}/{{ month.month}}'>{{month.month}}</a></li>
250+ <li><a href='{{ path("month-index", year=year .year.year, month=month .month.month) }}'>{{month.month.strftime("%m") }}</a></li>
255251 {% endfor %}
256252 </ul>
257253 </li>
@@ -297,7 +293,7 @@ def global_context(self):
297293 {{page.published.strftime('%A %B %d, %Y')}}
298294 </time>
299295 {% endif %}
300- <a href='{{page.url }}'>{{page.title}}</a>
296+ <a href='{{page.path }}'>{{page.title}}</a>
301297 </li>
302298 {% endfor %}
303299 </ul>
0 commit comments