Just use markdown() for the XML escaping ya dingus

This commit is contained in:
swagg boi 2023-04-28 11:51:22 -05:00
parent fd60b45af3
commit 2838f73840
6 changed files with 5 additions and 1302 deletions

View file

@ -58,7 +58,6 @@ Run the tests locally (against development environment):
## TODOs
1. `xml_escape()` the body when rendered rather than saving XML escaped
1. Rules/about page
1. CSS
1. "All new posts flagged" mode (require approval for new posts)

View file

@ -8,3 +8,4 @@ requires 'Perl::Critic::Community';
requires 'Date::Format';
requires 'XML::RSS';
requires 'CSS::Minifier::XS';
requires 'Text::Markdown';

View file

@ -5,12 +5,12 @@ package PostText;
use Mojo::Base 'Mojolicious', -signatures;
use Mojo::Pg;
use Crypt::Passphrase;
use Text::Markdown qw{markdown};
# The local libs
use PostText::Model::Thread;
use PostText::Model::Remark;
use PostText::Model::Moderator;
use PostText::Markdown;
sub startup($self) {
$self->plugin('Config');
@ -64,7 +64,7 @@ sub startup($self) {
});
$self->helper(markdown => sub ($c, $input_text) {
Markdown($input_text)
markdown($input_text, {empty_element_suffix => '>'})
});
# Finish configuring some things

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,6 @@
package PostText::Model::Remark;
use Mojo::Base -base, -signatures;
use Mojo::Util qw{xml_escape};
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) {
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);
INSERT INTO remarks (

View file

@ -1,7 +1,6 @@
package PostText::Model::Thread;
use Mojo::Base -base, -signatures;
use Mojo::Util qw{xml_escape};
has 'pg';
@ -10,7 +9,7 @@ has per_page => 5;
has date_format => 'Dy, FMDD Mon YYYY HH24:MI:SS TZ';
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'};
INSERT INTO threads (