Newcomen

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

Index


NAME ^

Newcomen::Plugin::Blog::Source - Sets some initial data for blog sources.

DESCRIPTION ^

This plugin will set the content and some meta data for all Newcomen::Source instances with the crawler ID 'Blog::Crawler'.

Some of the meta data set will be extracted from both the file content and the file name, with meta data from the content overriding the data from the file name if required. Newcomen::Util::File's parse_file() function is used to parse the files, see there for details on the file format. See the OPTIONS below for details on the file name parsing.

Additionally to these user defined information, the file's stat() information will be included in the source item's meta data. See the Sources section below for details.

Note: This plugin expects two keys to be present in the meta data, both are set by the blog's default crawler (Newcomen::Plugin::Blog::Crawler). The keys are path/source/absolute and path/source/root. These keys should not be modified or removed by other plugins, if any of these doesn't exist or is invalid for some reason, this plugin will die() or not work as expected.

OPTIONS ^

{
   'blog'                => {
      'source'           => {
         'filename_meta' => undef,
      },
   },
}

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

blog/source/filename_meta must be set to a string which is used in a regular expression to be matched against the file name of the source file relative to the project's root directory. This regular expression may contain named capture groups (see perlre), and if one of these groups matches anything, it will be added to the Newcomen::Source instance's meta data (the capture group's name will be the key, the matching part of the file name will be the value). If this is not set (the default), or the regular expression doesn't match, no data will be added.

META DATA ^

Sources

{
   'stat'       => {
      'dev'     => $dev,
      'ino'     => $ino,
      'mode'    => $mode,
      'nlink'   => $nlink,
      'uid'     => $uid,
      'gid'     => $gid,
      'rdev'    => $rdev,
      'size'    => $size,
      'atime'   => $atime,
      'mtime'   => $mtime,
      'ctime'   => $ctime,
      'blksize' => $blksize,
      'blocks'  => $blocks,
   },
}

stat contains the stat() information of the source file, see Newcomen::Util::File's stat_hash() function for details.

Additionally, all meta data extracted from the file name (as described above) and all meta data from the file content will be set by this plugin.

HOOKS ^

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

SEE ALSO ^

Newcomen::Plugin::Blog::Crawler, Newcomen::Source, Newcomen::Util::File

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/>.