From: Ryan Burgoyne Date: Wed, 20 Feb 2013 23:49:39 +0000 (-0700) Subject: Check that meta values are not empty before applying them. X-Git-Url: https://git.g-eek.se/?a=commitdiff_plain;h=e21b6d7ce266ebdb1dc5bd2203b5aebed74c0cf5;p=ikiwiki-pandoc.git Check that meta values are not empty before applying them. --- diff --git a/pandoc.pm b/pandoc.pm index 0c98b98..ed95c11 100644 --- a/pandoc.pm +++ b/pandoc.pm @@ -244,9 +244,19 @@ sub htmlize ($@) { return join " ", @string_without_spaces; } - $pagestate{$page}{meta}{title} = compile_string @doc_title; - $pagestate{$page}{meta}{author} = compile_string @primary_author; - $pagestate{$page}{meta}{date} = compile_string @doc_date; + my $title = compile_string @doc_title; + my $author = compile_string @primary_author; + my $date = compile_string @doc_date; + + if ($title) { + $pagestate{$page}{meta}{title} = $title; + } + if ($author) { + $pagestate{$page}{meta}{author} = $author; + } + if ($date) { + $pagestate{$page}{meta}{date} = $date; + } return $content; }