Skip to content

Commit 5913e02

Browse files
davorgbook
authored andcommitted
The title is Markdown - fix that
1 parent 25a606b commit 5913e02

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/PPC.pm

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ class PPC;
44

55
use builtin 'trim';
66

7+
use Pandoc;
8+
79
field $author :param = '';
810
field $id :param;
911
field $slug :param;
@@ -51,7 +53,7 @@ sub new_from_file($class, $ppc_file) {
5153
$ppc{slug} =~ s|\.md$||;
5254

5355
while (<$ppc_fh>) {
54-
$. == 1 and m|#\s+(.*)| and $ppc{title} = $1;
56+
!$ppc{title} and m|^#\s+(.*)| and $ppc{title} = md2text($_);
5557

5658
$is_preamble and /## abstract/i and last;
5759

@@ -77,4 +79,8 @@ sub new_from_file($class, $ppc_file) {
7779
return $class->new(%ppc);
7880
}
7981

82+
sub md2text($md_string) {
83+
return pandoc->convert( markdown => 'plain', $md_string);
84+
}
85+
8086
1;

0 commit comments

Comments
 (0)