Aion-Format

 view release on metacpan or  search on metacpan

t/aion/format/html.t  view on Meta::CPAN

use common::sense; use open qw/:std :utf8/;  use Carp qw//; use Cwd qw//; use File::Basename qw//; use File::Find qw//; use File::Slurper qw//; use File::Spec qw//; use File::Path qw//; use Scalar::Util qw//;  use Test::More 0.98;  use String::Diff q...
# # NAME
# 
# Aion::Format::Html - библиотека для форматирования HTML
# 
# # SYNOPSIS
# 
subtest 'SYNOPSIS' => sub { 
use Aion::Format::Html;

local ($::_g0 = do {from_html "<b>&excl;</b>"}, $::_e0 = "!"); ::ok $::_g0 eq $::_e0, 'from_html "<b>&excl;</b>" # => !' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {to_html "<a>"}, $::_e0 = "&lt;a&gt;"); ::ok $::_g0 eq $::_e0, 'to_html "<a>"             # => &lt;a&gt;' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;

# 
# # DESCRIPION
# 
# Библиотека для форматирования HTML-документов.
# 
# # SUBROUTINES
# 
# ## from_html ($html)
# 
# Преобразует HTML в текст.
# 
::done_testing; }; subtest 'from_html ($html)' => sub { 
local ($::_g0 = do {from_html "Basic is <b>superlanguage</b>!<br>"}, $::_e0 = "Basic is superlanguage!\n"); ::ok $::_g0 eq $::_e0, 'from_html "Basic is <b>superlanguage</b>!<br>"  # => Basic is superlanguage!\n' or ::diag ::_string_diff($::_g0, $::_e...

# 
# ## to_html ($html)
# 
# Экранирует символы HTML.
# 
# ## safe_html ($html)
# 
# Обрезает опасные и неизвестные теги HTML, а также неизвестные атрибуты из известных тегов.
# 
::done_testing; }; subtest 'safe_html ($html)' => sub { 
local ($::_g0 = do {safe_html "-<em>-</em><br>-"}, $::_e0 = "-<em>-</em><br>-"); ::ok $::_g0 eq $::_e0, 'safe_html "-<em>-</em><br>-" # => -<em>-</em><br>-' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {safe_html "-<em onclick='  '>-</em><br onmouseout=1>-"}, $::_e0 = "-<em>-</em><br>-"); ::ok $::_g0 eq $::_e0, 'safe_html "-<em onclick=\'  \'>-</em><br onmouseout=1>-" # => -<em>-</em><br>-' or ::diag ::_string_diff($::_g0, $::_e0...
local ($::_g0 = do {safe_html "-<xx24>-</xx24>"}, $::_e0 = "--"); ::ok $::_g0 eq $::_e0, 'safe_html "-<xx24>-</xx24>" # => --' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {safe_html "-< applet >-</ applet >"}, $::_e0 = "-< applet >-"); ::ok $::_g0 eq $::_e0, 'safe_html "-< applet >-</ applet >" # => -< applet >-' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;

# 
# ## split_on_pages ($html, $symbols_on_page, $by)
# 
# Разбивает текст на страницы с учетом html-тегов.
# 
::done_testing; }; subtest 'split_on_pages ($html, $symbols_on_page, $by)' => sub { 
local ($::_g0 = do {[split_on_pages "Alice in wonderland. This is book", 17]}, $::_e0 = do {["Alice in wonderland. ", "This is book"]}); ::is_deeply $::_g0, $::_e0, '[split_on_pages "Alice in wonderland. This is book", 17]  # --> ["Alice in wonderlan...

# 
# # AUTHOR
# 
# Yaroslav O. Kosmina <darviarush@mail.ru>
# 
# # LICENSE
# 
# âš– **GPLv3**
# 
# # COPYRIGHT
# 



( run in 1.609 second using v1.01-cache-2.11-cpan-39bf76dae61 )