App-Mowyw
view release on metacpan or search on metacpan
script/mowyw view on Meta::CPAN
#!/usr/bin/perl
# mowyw - mowyw writes your websites - Copyright (C) 2006 Moritz Lenz,
# https://perlgeek.de/
# For documentation please see the README file
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the Artistic License 2 as published by The Perl
# Foundation.
#
# This program 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.
use warnings;
use strict;
require 5.008001;
use App::Mowyw qw(get_config process_file process_dir parse_all_in_dir);
use Getopt::Long;
$App::Mowyw::config{make_behaviour} = undef;
my $result = GetOptions(
"make" => \$App::Mowyw::config{make_behaviour},
"postfix=s" => \$App::Mowyw::config{default}{postfix},
"includes-prefix=s" => \$App::Mowyw::config{default}{include},
"menu-prefix=s" => \$App::Mowyw::config{default}{menu},
"destination-prefix=s" => \$App::Mowyw::config{default}{online},
"source-prefix=s" => \$App::Mowyw::config{default}{source},
"encoding=s" => \$App::Mowyw::config{encoding},
"quiet" => \$App::Mowyw::config{quiet},
);
($App::Mowyw::config{per_fn}, $App::Mowyw::config{file_filter}) = get_config();
#use Data::Dumper;
#print Dumper $App::Mowyw::config{file_filter};
parse_all_in_dir($App::Mowyw::config{default}{source});
__END__
=head1 NAME
mowyw - Macro processor and Offline Content Management System
=head1 SYNOPSIS
$ mowyw
$ mowyw --make --source-prefix sp --destination-prefix dp --menu-prefix mp
--includes-prefix=ip --postifx=.html --quiet
=head1 DESCRIPTION
mowyw is a text processor for building static websites. It supports includes,
menus, external datasources (like XML files or databases) and syntax
hilighting.
To use mowyw you need three directories called B<source>, B<online> and
B<includes>. C<source> holds the source files that are to be interpreted by
mowyw. When you run mowyw, it will walk (recursively) through the source dir,
and for each file it either copies it verbatimely to C<online>, or, if the file
looks like HTML (ends on .html, .shtml, .htm etc.) it is processed by mowyw,
and the output is written into the online dir.
In C<includes/> are include files (how surprising), header, footer, global
include files, and optionally data source files.
You should always execute mowyw from the parent directory of these three
directories.
The name of these three directories can be overridden with command line
options.
=head1 COMMAND LINE OPTIONS
=over
=item --make
Only process files with a newer timestamp than the corresponding C<online/>
file. Note that this does not account for dependencies on include files and menu
files.
=item --quiet
Don't produce diagnostics or progress output
=item --postfix
Append the given postfix to the filename of all included file names (and
menu files). Defaults to the empty string.
=item --includes-prefix
Change the search path for include files. Defaults to C<includes/>.
=item --menu-prefix
Change the search for menu files. Defaults to C<includes/menu->.
=item --destination-prefix
Change the path for the output files. Defaults to C<online/>.
=item --source-prefix
Change the search path for source files. Defaults to C<source/>. Must be a
directory.
=item --encoding
Interpret all input files to have that encoding. Defaults to UTF-8.
(Conjecture: should default to the current locale... what to do?).
=back
All options except C<--make> can be specified in a config file, with more
customization options.
=head1 PROCESSING ORDER
mowyw processes files in several steps:
( run in 1.808 second using v1.01-cache-2.11-cpan-f56aa216473 )