Newcomen

Description A static content generator.
Newcomen > Perl Modules > Newcomen::Plugin::Blog::Source::Time
Source

Index


NAME ^

Newcomen::Plugin::Blog::Source::Time - Sets time information for blog sources.

DESCRIPTION ^

This plugin will add time information to the Newcomen::Source instances with the creator ID 'Blog::Crawler'.

Information about the publication and modification time will be included. Please see OPTIONS and META DATA below for details.

OPTIONS ^

{
   'blog'                   => {
      'source'              => {
         'time'             => {
            'input_format'  => undef,
            'output_format' => undef,
         },
      },
   },
}

These are the default options set by this plugin. They may be overridden by user configuration.

The blog/source/time/input_format must be set to the time format specification that should be used to parse the published/modified time set in the source's meta data.

blog/source/time/output_format must be set to another (or the same) time format specification. The parsed time will be reformatted using this format and the result will be included in the meta data.

If one of these options is set to undef (the default) or any other false value, the default value '%Y-%m-%d %H:%M' will be used.

The function parse_time() (package Newcomen::Util::Time) is used to do the parsing, see there for more details.

META DATA ^

Sources

{

   'published'         => $published,
   'modified'          => $modified,

   'time'              => {
      'published'      => {
         'year'        => $pub_year,
         'month'       => $pub_month,
         'day'         => $pub_day,
         'hour'        => $pub_hour,
         'minute'      => $pub_minute,
         'second'      => $pub_second,
         'day_of_week' => $pub_dow,
         'day_of_year' => $pub_doy,
         'week'        => $pub_week,
         'month_short' => $pub_m_short,
         'month_name'  => $pub_m_name,
         'day_short'   => $pub_d_short,
         'day_name',   => $pub_d_name,
         'is_dst'      => $pub_is_dst,
         'epoch'       => $pub_epoch,
         'iso'         => $pub_iso,
         'offset'      => $pub_offset,
         'Month'       => $pub_Month,
         'Day'         => $pub_Day,
         'Hour'        => $pub_Hour,
         'Minute'      => $pub_Minute,
         'Second'      => $pub_Second,
         'string'      => $pub_string,
      },
      'modified'       => {
         'year'        => $mod_year,
         'month'       => $mod_month,
         'day'         => $mod_day,
         'hour'        => $mod_hour,
         'minute'      => $mod_minute,
         'second'      => $mod_second,
         'day_of_week' => $mod_dow,
         'day_of_year' => $mod_doy,
         'week'        => $mod_week,
         'month_short' => $mod_m_short,
         'month_name'  => $mod_m_name,
         'day_short'   => $mod_d_short,
         'day_name',   => $mod_d_name,
         'is_dst'      => $mod_is_dst,
         'epoch'       => $mod_epoch,
         'iso'         => $mod_iso,
         'offset'      => $mod_offset,
         'Month'       => $mod_Month,
         'Day'         => $mod_Day,
         'Hour'        => $mod_Hour,
         'Minute'      => $mod_Minute,
         'Second'      => $mod_Second,
         'string'      => $mod_string,
      },
   },

}

This is the source item meta data used and/or set by this plugin.

The keys published and modified will be used as initial data for the publication and modification time of the source item. If set, these keys must be in the format specified by the blog/source/time/input_format configuration option. If only one of these is set, the other one will automatically be set to the same value. If none of these keys are set, the source item's stat/mtime value (provided by Newcomen::Plugin::Blog::Source) will be used to determine both publication and modification times. In that case both keys will be set to the reformatted value according to the blog/source/time/output_format configuration option. Note that if neither published, modified or stat/mtime exists, this plugin will die().

The two hashrefs time/published and time/modified will contain the parsed information from the two aforementioned values. These hashrefs are provided by Newcomen::Util::Time's parse_time() function, see there for details. Note that any existing time key in the meta data will be overridden.

GLOBAL DATA ^

{
   'blog'           => {
      'oldest_item' => $oldest_item,
      'latest_item' => $latest_item,
   },
}

This is the global data (see Newcomen::Core) set by this plugin. blog/oldest_item and blog/latest_item will be set to the oldest and newest blog source items (according to their publication time), respectively.

HOOKS ^

This plugin implements the hook hook_process_source() (default priority).

SEE ALSO ^

Newcomen::Core, Newcomen::Plugin::Blog::Source, Newcomen::Source, Newcomen::Util::Time

VERSION ^

This is version 2014052501.

AUTHOR ^

Stefan Goebel - newcomen {at} subtype {dot} de

COPYRIGHT AND LICENSE ^

Copyright 2013-2014 Stefan Goebel.

This file is part of Newcomen.

Newcomen is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the license, or (at your option) any later version.

Newcomen is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Newcomen. If not, see <http://www.gnu.org/licenses/>.