preaction / Statocles

Static website CMS
http://preaction.me/statocles
Other
84 stars 33 forks source link

Syntax highlight error #600

Closed ology closed 10 months ago

ology commented 3 years ago

When I install Syntax::Highlight::Engine::Kate and follow the instructions in Statocles::Plugin::Highlight, this error is barfed-up on statocles deploy:

https://gist.github.com/ology/e79044409cff1b1872dd6fa594de0543

This gist includes the site.yml, the index.markdown and the error output text.

The site.yml is exactly what statocles create www.example.com makes (but with comments removed for brevity), plus the added bits from the Statocles::Plugin::Highlight documentation.

Maybe I'm doing something wrong or missing a step? Or is this a genuine bug?

(Btw, I have tried both % end and %= end and that results in the same error.)

preaction commented 3 years ago

It's definitely possible this is broken: The highlighting never really worked great. But, I can't reproduce on the Statocles site using Statocles v0.098, Mojolicious 8.66, Perl 5.28.0. What Mojolicious do you have installed? Use mojo version to see.

ology commented 3 years ago
> mojo version
CORE
  Perl        (v5.30.2, darwin)
  Mojolicious (8.54, Supervillain)

OPTIONAL
  Cpanel::JSON::XS 4.09+   (4.19)
  EV 4.32+                 (n/a)
  IO::Socket::Socks 0.64+  (n/a)
  IO::Socket::SSL 2.009+   (2.067)
  Net::DNS::Native 0.15+   (n/a)
  Role::Tiny 2.000001+     (2.001004)
  Future::AsyncAwait 0.36+ (n/a)

I will definitely be upgrading mojo...

ology commented 3 years ago

Same error after upgrading.

Also I get the same error on my virtualbox 18.04.1-Ubuntu with:

> mojo version
CORE
  Perl        (v5.28.2, linux)
  Mojolicious (8.66, Supervillain)

OPTIONAL
  Cpanel::JSON::XS 4.09+   (4.25)
  EV 4.32+                 (n/a)
  IO::Socket::Socks 0.64+  (n/a)
  IO::Socket::SSL 2.009+   (n/a)
  Net::DNS::Native 0.15+   (n/a)
  Role::Tiny 2.000001+     (2.001004)
  Future::AsyncAwait 0.36+ (n/a)

:\

voegelas commented 10 months ago

As the gist is gone, I cannot see the error message. But Statocles interprets Mojo::Template tags in begin...end blocks before the text is passed to the highlight plugin. It's safer to include code with %= highlight Perl => include -raw => 'test.pl'. The option -raw disables the template tags.

I recently wrote Statocles::Plugin::Highlight::Kamelon, which suffers from the same problem. My plugin uses Syntax::Kamelon, which isn't perfect either but supports more programming languages than Syntax::Highlight::Engine::Kate.

ology commented 10 months ago

Huh. It works now. Not sure what I did right, or screwed up before. But it works now! Closing this possibly unnecessary issue now. Thanks again for your help!