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

Allow parse content using Twig (.html files). #110

Closed
wants to merge 4 commits into from

Conversation

msosvi
Copy link

@msosvi msosvi commented Nov 9, 2013

No description provided.

@sharpmachine
Copy link

👍 it would be awesome if this was accepted upstream...

@sharpmachine
Copy link

This fork works with getting Twig functioning, but plugins don't appear to work 😦

@PhrozenByte
Copy link
Collaborator

I was recently thinking about this idea while working on Pico 2.0 (#334) and thinking about Pico 3.0 (#317), but came to the decision, that we shouldn't explicitly allow replacing Markdown with other "content processors" (like Twig).

If you want to use Twig for some "more complex" pages you can already do that. Simply create a content/my_complex_page.md with

---
Template: my_complex_page
---

and a matching themes/my_theme/my_complex_page.twig. Add your contents to the Twig template and you're ready to go.

If you want to create a larger number of such "complex" pages and don't want to create both a (basically empty) .md file and a .twig template, you can also write a plugin that searches for .twig files in e.g. the themes/my_theme/complex_content/ directory, adds them to Pico's pages array (onPagesLoaded event) and intervenes appropriately when a "complex" page is requested (basically hook into the onRequestUrl event to detect the request and change the $templateName argument of the onPageRendering event). However, I don't think that this feature is widely needed, thus this isn't going to make it into Pico's core.

If you rather want to extend the Markdown processor (i.e. the Parsedown class) with some custom features (like #318), you can do this starting with Pico 2.0. There's a new onParsedownRegistered event that passes Pico's $parsedown object as reference, allowing you to replace it with another object (however, the object's class must extend the Parsedown class, otherwise you'll break Pico).

If you want to completely replace Markdown, YAML and/or Twig with something different, you can extend Pico's class and replace the respective methods as you want (Pico is open source). We obviously will neither officially support this nor will this work with all existing plugins or themes out there, but you definitely can do this if you want to.

Thank you for your feedback anyway! 👍

@PhrozenByte PhrozenByte removed this from the Backlog milestone May 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants