Just use markdown() for the XML escaping ya dingus
This commit is contained in:
parent
fd60b45af3
commit
2838f73840
|
@ -58,7 +58,6 @@ Run the tests locally (against development environment):
|
||||||
|
|
||||||
## TODOs
|
## TODOs
|
||||||
|
|
||||||
1. `xml_escape()` the body when rendered rather than saving XML escaped
|
|
||||||
1. Rules/about page
|
1. Rules/about page
|
||||||
1. CSS
|
1. CSS
|
||||||
1. "All new posts flagged" mode (require approval for new posts)
|
1. "All new posts flagged" mode (require approval for new posts)
|
||||||
|
|
1
cpanfile
1
cpanfile
|
@ -8,3 +8,4 @@ requires 'Perl::Critic::Community';
|
||||||
requires 'Date::Format';
|
requires 'Date::Format';
|
||||||
requires 'XML::RSS';
|
requires 'XML::RSS';
|
||||||
requires 'CSS::Minifier::XS';
|
requires 'CSS::Minifier::XS';
|
||||||
|
requires 'Text::Markdown';
|
||||||
|
|
|
@ -5,12 +5,12 @@ package PostText;
|
||||||
use Mojo::Base 'Mojolicious', -signatures;
|
use Mojo::Base 'Mojolicious', -signatures;
|
||||||
use Mojo::Pg;
|
use Mojo::Pg;
|
||||||
use Crypt::Passphrase;
|
use Crypt::Passphrase;
|
||||||
|
use Text::Markdown qw{markdown};
|
||||||
|
|
||||||
# The local libs
|
# The local libs
|
||||||
use PostText::Model::Thread;
|
use PostText::Model::Thread;
|
||||||
use PostText::Model::Remark;
|
use PostText::Model::Remark;
|
||||||
use PostText::Model::Moderator;
|
use PostText::Model::Moderator;
|
||||||
use PostText::Markdown;
|
|
||||||
|
|
||||||
sub startup($self) {
|
sub startup($self) {
|
||||||
$self->plugin('Config');
|
$self->plugin('Config');
|
||||||
|
@ -64,7 +64,7 @@ sub startup($self) {
|
||||||
});
|
});
|
||||||
|
|
||||||
$self->helper(markdown => sub ($c, $input_text) {
|
$self->helper(markdown => sub ($c, $input_text) {
|
||||||
Markdown($input_text)
|
markdown($input_text, {empty_element_suffix => '>'})
|
||||||
});
|
});
|
||||||
|
|
||||||
# Finish configuring some things
|
# Finish configuring some things
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,6 @@
|
||||||
package PostText::Model::Remark;
|
package PostText::Model::Remark;
|
||||||
|
|
||||||
use Mojo::Base -base, -signatures;
|
use Mojo::Base -base, -signatures;
|
||||||
use Mojo::Util qw{xml_escape};
|
|
||||||
|
|
||||||
has 'pg';
|
has 'pg';
|
||||||
|
|
||||||
|
@ -29,7 +28,7 @@ sub by_page_for($self, $thread_id, $this_page = 1) {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub create($self, $thread_id, $author, $body, $hidden = 0, $flagged = 0) {
|
sub create($self, $thread_id, $author, $body, $hidden = 0, $flagged = 0) {
|
||||||
my @data = ($thread_id, $author, xml_escape($body), $hidden, $flagged);
|
my @data = ($thread_id, $author, $body, $hidden, $flagged);
|
||||||
|
|
||||||
$self->pg->db->query(<<~'END_SQL', @data);
|
$self->pg->db->query(<<~'END_SQL', @data);
|
||||||
INSERT INTO remarks (
|
INSERT INTO remarks (
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package PostText::Model::Thread;
|
package PostText::Model::Thread;
|
||||||
|
|
||||||
use Mojo::Base -base, -signatures;
|
use Mojo::Base -base, -signatures;
|
||||||
use Mojo::Util qw{xml_escape};
|
|
||||||
|
|
||||||
has 'pg';
|
has 'pg';
|
||||||
|
|
||||||
|
@ -10,7 +9,7 @@ has per_page => 5;
|
||||||
has date_format => 'Dy, FMDD Mon YYYY HH24:MI:SS TZ';
|
has date_format => 'Dy, FMDD Mon YYYY HH24:MI:SS TZ';
|
||||||
|
|
||||||
sub create($self, $author, $title, $body, $hidden = 0, $flagged = 0) {
|
sub create($self, $author, $title, $body, $hidden = 0, $flagged = 0) {
|
||||||
my @data = ($author, $title, xml_escape($body), $hidden, $flagged);
|
my @data = ($author, $title, $body, $hidden, $flagged);
|
||||||
|
|
||||||
$self->pg->db->query(<<~'END_SQL', @data)->hash->{'thread_id'};
|
$self->pg->db->query(<<~'END_SQL', @data)->hash->{'thread_id'};
|
||||||
INSERT INTO threads (
|
INSERT INTO threads (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user