Skip to content

Commit

Permalink
Prevent encoding bug in pagedown extra options
Browse files Browse the repository at this point in the history
closes #40
  • Loading branch information
jberger committed Aug 13, 2016
1 parent fca9a7c commit 0dd725d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -3,6 +3,7 @@ Revision history for Perl module Galileo
0.041 2016-08-13
- Bump Mojolicious requirement to 5.54
- Fix compatibility with Mojolicious 7.0
- Prevent encoding bug in pagedown extra options

0.040 2016-01-07
- Remove jQueryUI in favor of html5sortable
Expand Down
4 changes: 1 addition & 3 deletions lib/Galileo/Page.pm
@@ -1,8 +1,6 @@
package Galileo::Page;
use Mojo::Base 'Mojolicious::Controller';

use Mojo::JSON 'j';

sub show {
my $self = shift;
my $name = $self->param('name');
Expand Down Expand Up @@ -39,7 +37,7 @@ sub edit {

$self->stash(
sanitize => $self->config->{sanitize} // 1, #/# highlight fix
pagedown_extra_options => j( $self->config->{pagedown_extra_options} ),
pagedown_extra_options => $self->config->{pagedown_extra_options},
);

$self->render;
Expand Down
4 changes: 2 additions & 2 deletions lib/Galileo/files/templates/page/edit.html.ep
@@ -1,6 +1,6 @@
% require Mojo::JSON;
% layout 'standard';
% my $sanitize = stash('sanitize') // 1 ? 'true' : 'false';
% my $pagedown_extra_options = stash('pagedown_extra_options');
% content_for header => begin
%= stylesheet '/assets/pagedown/pagedown.css'
%= javascript '/assets/pagedown/Markdown.Converter.js'
Expand All @@ -19,7 +19,7 @@ function saveButton() {
editor.save( title );
}

var extraOptions = <%== $pagedown_extra_options %>;
var extraOptions = <%== Mojo::JSON::to_json stash('pagedown_extra_options') || {} %>;

$(function () {
editor = new Editor("<%= $name =%>", "<%= url_for('storepage')->to_abs =%>", <%= $sanitize =%>, extraOptions);
Expand Down

0 comments on commit 0dd725d

Please sign in to comment.