From 12808c5d5e9f0c1ed988ff53c8e9729f17f8e2ac Mon Sep 17 00:00:00 2001 From: Ramiro Morales Date: Sun, 21 Nov 2021 14:33:51 -0300 Subject: [PATCH 1/2] Fix command line processing in example action --- flourish/command_line.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/flourish/command_line.py b/flourish/command_line.py index 608553a..b233287 100644 --- a/flourish/command_line.py +++ b/flourish/command_line.py @@ -359,9 +359,12 @@ def create_example(args): generate(argparse.Namespace( source='source', templates='templates', + fragments=None, output='output', action='generate', verbose=True, + include_future=True, + exclude_future=False, path=[], )) print('Example site created: run "flourish preview --generate"') From ecadd4da6421bd2f85e0abdb4f96b00a78b100ac Mon Sep 17 00:00:00 2001 From: Ramiro Morales Date: Sun, 21 Nov 2021 14:34:53 -0300 Subject: [PATCH 2/2] Update example `source/generate.py` to new generators API --- flourish/examples.py | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/flourish/examples.py b/flourish/examples.py index a925de3..f06012c 100644 --- a/flourish/examples.py +++ b/flourish/examples.py @@ -14,10 +14,9 @@ """), 'source/generate.py': dedent("""\ - from flourish import helpers - from flourish.generators import ( + from flourish.generators.base import ( IndexGenerator, - PageGenerator, + SourceGenerator, ) @@ -28,32 +27,27 @@ class Homepage(IndexGenerator): def global_context(self): return { - 'dates': helpers.all_valid_dates(self.flourish), + 'dates': self.publication_dates, } GLOBAL_CONTEXT = global_context - - SOURCE_URL = ( - '/#slug', - PageGenerator.as_generator(), - ) - - URLS = ( - ( - '/', - 'homepage', - Homepage.as_generator() + PATHS = ( + SourceGenerator( + path='/#slug', + name='source' + ), + Homepage( + path='/', + name='homepage' ), - ( - '/#year/', - 'year-index', - IndexGenerator.as_generator() + IndexGenerator( + path='/#year/', + name='year-index' ), - ( - '/#year/#month', - 'month-index', - IndexGenerator.as_generator() + IndexGenerator( + path='/#year/#month', + name='month-index' ), ) """),