BorderStyle

 view release on metacpan or  search on metacpan

lib/BorderStyleRole/Source/ASCIIArt.pm  view on Meta::CPAN

    $orig->(@_);
};

1;
# ABSTRACT: Get border characters from ASCII art

__END__

=pod

=encoding UTF-8

=head1 NAME

BorderStyleRole::Source::ASCIIArt - Get border characters from ASCII art

=head1 VERSION

This document describes version 3.0.3 of BorderStyleRole::Source::ASCIIArt (from Perl distribution BorderStyle), released on 2023-07-14.

=head1 SYNOPSIS

 package BorderStyle::YourStyle;
 use strict;
 use warnings;
 use utf8;
 use Role::Tiny::With;
 with 'BorderStyleRole::Source::ASCIIArt';

 our $PICTURE = <<'_';
 ┌───────┬───┬───┐'
 │ ..... │ . │ . │'
 │ ..... ├───┼───┤'
 │ ..... │ . │ . │'
 │ ..... ├───┴───┤'
 │ ..... │ ..... │'
 ├───┬───┤ ..... │'
 │ . │ . │ ..... │'
 └───┴───┴───────┘'
 _

 our %BORDER = (
     v => 3,
     summary => 'Summary of your style',
     utf8 => 1,
 );
 1;

=head1 DESCRIPTION

To define border characters, you declare C<$PICTURE> package variable in your
border style class, using a specific ASCII art as shown in the Synopsis. You
then modify the border characters (the lines, not the spaces and the dots)
according to your actual style. This is a convenient way to define border styles
instead of declaring the characters specifically using a hash. Note that empty
border characters are not supported by this role.

For more complex border styles, you define C<@PICTURES> instead, with each
element being a hash:

 # this style is single bold line for header rows, single line for data rows.
 our @PICTURES = (
     {
         # imagine every line is a header-row separator line (theoretically, the
         # top and bottom lines won't ever be used as separator though)
         for_header_data_separator => 1,
         picture => <<'_',
 ┍━━━━━━━┯━━━┯━━━┑'
 â•¿ ..... â•¿ , â•¿ . â•¿'
 ╿ ..... ┡━━━╇━━━┫'
 â•¿ ..... â•¿ . â•¿ . â•¿'
 ╿ ..... ┡━━━┻━━━┫'
 â•¿ ..... â•¿ ..... â•¿'
 ┡━━━┯━━━┩ ..... ╿'
 â•¿ . â•¿ . â•¿ ..... â•¿'
 ┗━━━┻━━━┻━━━━━━━┛'
 _
     },
     {
         for_header_row => 1,
         picture => <<'_',
 ┏━━━━━━━┳━━━┳━━━┓'
 ┃ ..... ┃ , ┃ . ┃'
 ┃ ..... ┣━━━╋━━━┫'
 ┃ ..... ┃ . ┃ . ┃'
 ┃ ..... ┣━━━┻━━━┫'
 ┃ ..... ┃ ..... ┃'
 ┣━━━┳━━━┫ ..... ┃'
 ┃ . ┃ . ┃ ..... ┃'
 ┗━━━┻━━━┻━━━━━━━┛'
 _
     },
     {
         picture => <<'_',
 ┌───────┬───┬───┐'
 │ ..... │ . │ . │'
 │ ..... ├───┼───┤'
 │ ..... │ . │ . │'
 │ ..... ├───┴───┤'
 │ ..... │ ..... │'
 ├───┬───┤ ..... │'
 │ . │ . │ ..... │'
 └───┴───┴───────┘'
 _
     },
 );

Internally, some characters from the ASCII art will be taken and put into
C<%CHARS> or C<@MULTI_CHARS> and this role's C<get_border_char()> will pass to
L<BorderStyleRole::Source::Hash>'s.

=for Pod::Coverage ^(.+)$

=head1 HOMEPAGE

Please visit the project's homepage at L<https://metacpan.org/release/BorderStyle>.

=head1 SOURCE

Source repository is at L<https://github.com/perlancar/perl-BorderStyle>.



( run in 0.585 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )