-
Notifications
You must be signed in to change notification settings - Fork 33
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
eval is run on blog posts? #541
Comments
The content is run through the Mojo::Template template parser to allow plugins like The most direct way to fix this is to double up the Using the
That should work, but I've never tested the Perl 6 syntax highlighting before so I don't know how good it looks. This is handled by Syntax::Highlight::Engine::Kate, which is the only good backend highlighter for Perl I could find. I could extend the highlight plugin to use highlight.js or something if needed. Unfortunately, since you're doing Perl 6, I think you're going to come across this a lot. I could also come up with a way to either disable document template parsing or change what the directive leader looks like. Changing the template directive marks would be more difficult, since a lot of the good ones are taken by Markdown (#, !, = off the top of my head) or could still be confused for source code. |
Thanks for explaining the issue. Selfishly, I'd like to be able to type:
Or:
Or nothing for straight up pre:
And Statocles would produce the appropriate HTML for prettify.js or highlight.js. It does strike me as a negative that Statocles can't parse markdown in some cases because of the template/plugin system. On the other hand, I'm sure there are benefits to using embedded Perl templates and plugins, so I can't say for sure if this "should be fixed" or not. It feels like a design trade off, that you could make a case for either way. I don't know how much work it would be, but could the template/plugin system be made optional? |
I can allow the content template parsing to be disabled, yes. Likely I will make it a setting that could be added at the site level for all documents, at the application level for a single blog's documents, or at the document level (in the frontmatter) for a single document. The biggest benefit the content templates give Statocles is including files. Most of the additional template functions Statocles currently has are built around that:
Template includes are processed as templates and have their own variables, so one could make an "author bio" template and pass in the author's information from the document. (Funny enough, there's a way to disable template processing of an included file: There are the things that Markdown makes tedious. Jekyll has ways of turning data structures into content, and this is something I also needed. This gallery page is generated from a data structure. The last thing that the template stuff is used for is things that Markdown makes impossible/terrible. Images and other media is a big one. Of course, one is simply supposed to use HTML for these things, but there are other tasks one must do when preparing images for the web, including resizing, resampling, creating thumbnails, preparing different sizes for different browsers, and etc... (this plugin is described in #498). Right now, I'm pretty sure Text::Markdown does not work with the fenced code blocks ( But, so you can keep going, I can make a way to disable the template processing step which happens before the document is given to the Markdown parser. |
This attribute can be set on documents, applications, and sites to enable/disable content template processing. This isn't an ideal solution, but it is an expedient one. In the future, we might make the content templates more configurable (allowing users to set which characters introduce template directives, or which template processor to use, for example). Refs #541
Okay, v0.086 is uploaded to PAUSE, and allows you to add I'm not sure I'm fully pleased with the name or the solution, but if I come up with anything better, this will remain for backwards-compatibility (the burden of all software projects...). |
I've now also added the ability to configure the template directives, so you can completely disable the line-based code snippets, and change the tags to look like Template Toolkit tags: site:
args:
theme:
path: '::default'
tag_start: '[%'
tag_end: '%]'
line_start: "\x1F" This is probably all I'm going to be able to do to help with this. |
When we're writing blog posts about Perl, we run afoul of the template parser, a lot. The `%` that indicates a line of template is the same as the hash sigil, which often appears on the start of a line. Now, users can disable line-based processing entirely if they want, and change the template tags to look however they want (maybe to match Template Toolkit, so `[% ... %]`). Refs #541
When we're writing blog posts about Perl, we run afoul of the template parser, a lot. The `%` that indicates a line of template is the same as the hash sigil, which often appears on the start of a line. Now, users can disable line-based processing entirely if they want, and change the template tags to look however they want (maybe to match Template Toolkit, so `[% ... %]`). Refs #541
blog/2017/09/09/first-post/index.html
:Running
statocles build
:The text was updated successfully, but these errors were encountered: