-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Page context #140
Page context #140
Conversation
@@ -65,26 +66,27 @@ def full_build_path(self): | |||
return os.path.join(self.site.build_path, self.build_path) | |||
|
|||
def data(self): | |||
if not hasattr(self, "_data"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather you set _data
to None
(either in __init__
or in the class
definition) and check for None
. Functionally equivalent an plays much better with with refactoring tools.
Hi @jammon, and thanks for taking the time to contribute, I commented on the times themselves, but here are more generic comments:
Note that we might not want to risk breaking compatibility with existing sites. Cheers, |
|
Thanks, I'll look into those changes into more detail over the weekend (don't have more time right now unfortunately). Regarding the behavior change to the context system. Unfortunately there may be users relying on the old system, and I'm not big on just breaking backwards compatibility like this. I understand your expectations might differ (and I'd personally share your POV here), and that the Python Markdown extension processes metadata differently, but that doesn't mean Cactus has to do so as well (we don't really use Python Markdown for starters). I think the right approach here would be to break this system out of Thoughts? |
The specs of markdown2 metadata extra look even different. Putting the metadata / page context into a plugin is probably the right way. |
I'll close this PR since you're working on #141 instead. Thanks! |
This changes the behavior of
Site
andPage
in several subtle aspects.Site
builds the list of pages only whenSite._build_page_list
is called and not wheneverSite.pages()
is accessed.Page
reads the page file only once and not wheneverPage.data()
is accessed.Page
and is no more passed around as an argument.Page.parse_context
is changed to work more like I expected: The context data starts at the top of the file and the content starts after the first blank line or with the first line, that doesn't contain a colon.