Slovo
view release on metacpan or search on metacpan
lib/Slovo/Controller/Celini.pm view on Meta::CPAN
unshift @$options, ['ÐÑ Ð½Ð¸ÐºÐ¾Ñ' => 0];
return $options;
}
# ANY /<page_alias:str>/<paragraph_alias:cel>.<lang:lng>.html
# ANY /<page_alias:str>/<paragraph_alias:cel>.html
# Display a content element in a page in the site.
sub execute ($c, $page, $user, $l, $preview) {
# TODO celina breadcrumb
#my $path = [split m|/|, $c->stash->{'paragraph'}];
#my $path = $c->celini->breadcrumb($p_alias, $path, $l, $user, $preview);
my $stash = $c->stash;
my $alias = $stash->{'paragraph_alias'};
my $celina = $c->celini->find_for_display($alias, $user, $l, $preview,
{page_id => $page->{id}, box => $stash->{boxes}[0]});
unless ($celina) {
$celina = $c->celini->find_where(
{page_id => $c->not_found_id, language => $l, data_type => 'title'});
return $c->render(celina => $celina, status => $c->not_found_code);
lib/Slovo/Plugin/TagHelpers.pm view on Meta::CPAN
return $label . $/ . tag_to_html(div => (class => 'mui-checkbox') => sub {$html});
});
}
my sub _html_substr ($c, $html, $selector, $chars) {
state $html_dom = Mojo::DOM->new;
# Split on two subsequent new lines and get the first five paragraphs but
# only if the content is not HTML, (e. g. it is markdown).
return c(split m|$/$/|, $html)->head(5)->map(sub ($txt) {
$chars <= 0 && return '';
# strip potential inline markup
$txt =~ s/<[^>]+>?//g;
my $html = '<p>' . substr($txt, 0, $chars) . 'â¦</p>';
$chars -= length($txt);
return $html;
})->join('') unless $html =~ /^<\w/;
# Get the first 5 elements, matching $selector and prepare them for
t/012_cgi_hosting.t view on Meta::CPAN
like $buffer => qr|write.+/.+slovo.cgi|mx => 'cgi_script created';
my ($cgi_file) = $buffer =~ m|write.+($install_dir/slovo\.cgi)|;
ok -f $cgi_file => "$cgi_file exists";
like $buffer => qr/(?:write|exist).+\/.htaccess/ => '.htaccess created';
my ($hta_file)
= $buffer =~ m"(?:write|exist|chmod)\]\s+($ENV{SLOVO_DOCUMENT_ROOT}/.htaccess)";
ok -f $hta_file => "$hta_file exists";
};
my $dev_dom = "http://dev."
. (join '.', map { punycode_decode $_= s/xn--//r } split m'\.', $ENV{SLOVO_DOM});
note $dev_dom;
my $htaccess_default = sub {
# Very first call may fail
$t->get_ok("$dev_dom");
# DirectoryIndex
$t->get_ok("$dev_dom")->status_is(200)
->text_is('#content-wrapper h1' => 'ÐобÑе доÑли!', 'right h1')
->text_is('title' => 'ÐобÑе доÑли!', 'right title');
( run in 0.607 second using v1.01-cache-2.11-cpan-71847e10f99 )