From e21b6d7ce266ebdb1dc5bd2203b5aebed74c0cf5 Mon Sep 17 00:00:00 2001 From: Ryan Burgoyne Date: Wed, 20 Feb 2013 16:49:39 -0700 Subject: [PATCH] Check that meta values are not empty before applying them. --- pandoc.pm | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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; } -- 2.39.2