App-WRT

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

v4.2.1 2017-11-18

  - Change url_root default to /
  - Add url_root to topic link generator

v4.2.0 2017-11-18

  - Improved documentation in shell utilities
  - Make a copy of %default before blessing
  - Document MethodSpit
  - Document the overlay option, add an accessor method for it
  - Use a logging callback to WRT::Renderer::render()
  - Miscellaneous test cleanup
  - Add publish_dir to example wrt.json
  - Improve documentation
  - Add $wrt->feed_alias and a .xml copy of same

v4.1.0  2017-11-15

  - Add wrt-init for creating a skeleton project directory
  - Die on missing template file

lib/App/WRT.pm  view on Meta::CPAN

      content        => undef,       # place to stash content for templates
      default_entry  => 'new',       # what to display if no entry specified
      cache_includes => 0,           # should included files be cached in memory?

      # A license string for site content:
      license        => 'public domain',

      # A string value to replace all pages with (useful for occasional
      # situations where every page of a site should serve some other
      # content in-place, like Net Neutrality protest blackouts):
      overlay        => undef,

      # We'll show links for these, but not display them inline:
      binfile_expr   => qr/[.](tgz|zip|tar[.]gz|gz|txt|pdf)$/,
    );

=cut

my %default = (
  root_dir       => '.',         # dir for wrt repository
  root_dir_abs   => undef,       # for stashing absolute path to wrt repo

lib/App/WRT.pm  view on Meta::CPAN

  content        => undef,       # place to stash content for templates
  default_entry  => 'new',       # what to display if no entry specified
  cache_includes => 0,           # should included files be cached in memory?

  # A license string for site content:
  license        => 'public domain',

  # A string value to replace all pages with (useful for occasional
  # situations where every page of a site should serve some other
  # content in-place, like Net Neutrality protest blackouts):
  overlay        => undef,

  # We'll show links for these, but not display them inline:
  binfile_expr   => qr/[.](tgz|zip|tar[.]gz|gz|txt|pdf)$/,
);

=item $default{entry_descriptions}

A hashref which contains a map of entry titles to entry descriptions.

=cut

lib/App/WRT.pm  view on Meta::CPAN


=item display($entry1, $entry2, ...)

Return a string containing the given entries, which are in the form of
date/entry strings. If no parameters are given, default to C<default_entry>.

display() expands aliases ("new" and "all", for example) as necessary, collects
entry content and metadata from the pre-rendered HTML caches, and wraps
everything up in the template.

If C<overlay> is set, will return the value of overlay regardless of options.
(This is useful for hackily replacing every page in a site with a single blob
of HTML, for example if you're participating in some sort of blackout or
something.)

=cut

sub display {
  my $self = shift;
  my (@entries) = @_;

  return $self->{overlay} if defined $self->{overlay};

  # If no entries are defined, either...
  if ($self->{entries}->is_extant('index')) {
    # Fall back to the existing index file:
    $entries[0] = 'index';
  } else {
    # Or use the default:
    $entries[0] //= $self->{default_entry};
  }



( run in 0.607 second using v1.01-cache-2.11-cpan-49f99fa48dc )