# $Id: hr_section.pl,v 1.2 2003/03/04 18:42:20 akosut Exp $ # by Alexei Kosut # # Use hr_section="n" to limit output of a template tag to the nth # section, as delimited by
(or
). # # For example, if an entry excerpt is "red
white
blue", then # <$MTEntryExcerpt hr_section="1"$> outputs "white" use MT; use MT::Template::Context; use strict; use warnings; MT::Template::Context->add_global_filter(hr_section => sub { my ($s, $i) = @_; my @sections = split(/\s*\s*/, $s); return $sections[$i] || ""; });