+ # Metadata collection that needs to happen during the scan pass.
+ if ($key eq 'title') {
+ $pagestate{$page}{meta}{title}=HTML::Entities::encode_numeric($value);
+ # fallthrough
+ }
+ elsif ($key eq 'description') {
+ $pagestate{$page}{meta}{description}=HTML::Entities::encode_numeric($value);
+ # fallthrough
+ }
+ elsif ($key eq 'guid') {
+ $pagestate{$page}{meta}{guid}=HTML::Entities::encode_numeric($value);
+ # fallthrough
+ }
+ elsif ($key eq 'license') {
+ push @{$metaheaders{$page}}, '<link rel="license" href="#page_license" />';
+ $pagestate{$page}{meta}{license}=$value;
+ return "";
+ }
+ elsif ($key eq 'copyright') {
+ push @{$metaheaders{$page}}, '<link rel="copyright" href="#page_copyright" />';
+ $pagestate{$page}{meta}{copyright}=$value;
+ return "";
+ }
+ elsif ($key eq 'link' && ! %params) {
+ # hidden WikiLink
+ push @{$links{$page}}, $value;
+ return "";
+ }
+ elsif ($key eq 'author') {
+ $pagestate{$page}{meta}{author}=$value;
+ # fallthorough
+ }
+ elsif ($key eq 'authorurl') {
+ $pagestate{$page}{meta}{authorurl}=$value if safeurl($value);
+ # fallthrough
+ }
+
+ if (! defined wantarray) {
+ # avoid collecting duplicate data during scan pass
+ return;
+ }
+
+ # Metadata collection that happens only during preprocessing pass.
+ if ($key eq 'date') {
+ eval q{use Date::Parse};
+ if (! $@) {
+ my $time = str2time($value);
+ $IkiWiki::pagectime{$page}=$time if defined $time;