Let once_ macros see page contents

Issue #2 resolved
Justin Forest
created an issue

Macros aren't currently able to generate RSS with page contents. This is because the Markdown syntax is processed after the macros are executed.

I propose a patch which processes the contents after building the list of pages, but before calling the macros. This way when a page is being transformed to HTML, we already have the list of pages (in case some inline python code needs it). The HTML code is stored in the page list, so when the once_ macros are called afterwards, they have access to it.

Comments (5)

  1. Oben Sonne repo owner
    • changed status to open

    Yes, I see your point. On the other hand one might explicitly favor the current behavior. For instance in one of my Poole projects I use the once macros to edit and set page attributes which are used by inlined Python code. That would fail if the once macros are processed after inlined Python code.

    To meet both requirements, we need different types of once macros: pre and post. Current once macros actually are pre macros, yours are post macros.

  2. Oben Sonne repo owner

    Looks good. I've taken your changes and did some polish. Please see the attached patch. If you agree, I'll apply it to the main branch. I did not yet tested it, so if you could do that .. great, thanks!

  3. Log in to comment