Navigation Menu

Skip to content
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

Is it possible to use variables in _Template? #1603

Closed
tevino opened this issue Aug 1, 2020 · 3 comments · Fixed by #1818
Closed

Is it possible to use variables in _Template? #1603

tevino opened this issue Aug 1, 2020 · 3 comments · Fixed by #1818

Comments

@tevino
Copy link
Contributor

tevino commented Aug 1, 2020

For example:

_Template.md

Date: {{YYYY-MM-DD}}

# {{page_name}}

Body

...
@dometto
Copy link
Member

dometto commented Aug 3, 2020

Hi! No, this is not possible at the moment. But you could perhaps define a Macro to achieve both ends:

  • a Date() macro that outputs the current date using ruby's built in date functions
  • a CurrentPage() macro that uses Gollum's Macro class new active_page method

If you end up implementing these Macro's, please open a PR at gollum-lib -- we would be very interested!

@dometto dometto closed this as completed Aug 3, 2020
@tevino
Copy link
Contributor Author

tevino commented Aug 4, 2020

@dometto Thanks for the info, I don't know ruby, but I'll give it a try.

@tevino
Copy link
Contributor Author

tevino commented Aug 4, 2020

It seems that Macro is expanded at rendering time, in that case, a Date() macro outputs the current date is not very useful.

What I wanted is a macro expanded in edit mode, so that what's written in the result markdown files is the expanded content instead of the macro markup. Is there anything like that? @dometto

@bartkamphorst bartkamphorst reopened this Aug 4, 2020
dometto pushed a commit that referenced this issue Apr 25, 2022
* Add a test for template filter
* Add a test for template filter with page parameter
* Passing page as a parameter to template filter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants