|
NAMEBorderStyle - Border styles SPECIFICATION VERSION3 VERSIONThis document describes version 3.0.3 of BorderStyle (from Perl distribution BorderStyle), released on 2023-07-14. DESCRIPTIONThis document specifies a way to create and use border styles GLOSSARYborder style classborder style structureSPECIFICATIONBorder style classBorder style class must be put under "BorderStyle::*". Application-specific border styles should be put under "BorderStyle::MODULE::NAME::*" or "BorderStyle::APP::NAME::*". Border style class must also provide these methods:
Character names. Names of known border characters are given below: rd_t h_t hd_t ld_t
| ____| | |
vv v v
┏━━━━━━━━━━━┳━━━━━┳━━━━━┓
v_l -->┃ v_i -->┃ hv_i┃ ┃<-- v_r
┃ ┃ \┃ ┃
┃ rv_i -->┣━━━━━╋━━━━━┫<-- lv_r
┃ ┃ ┃ ┃
┃ ┣━━━━━┻━━━━━┫
┃h_i hd_i ┃ ^ ┃
┃| | ┃ | ┃
┃v v ┃ hu_i ┃
rv_l -->┣━━━━━┳━━━━━┫<-- lv_i ┃
┃ ┃ ┃ ┃
ru_l -->┗━━━━━┻━━━━━┻━━━━━━━━━━━┛
^ ^ ^
| | |
h_b hu_b lu_b
no border character name description
-- --------------------- -----------
1 h_b horizontal for top border
2 h_i horizontal for top border
3 h_t horizontal line, for top border
4 hd_t horizontal down line, for top border
5 hd_i horizontal down line, for inside border
6 hu_b horizontal up line, for bottom border
7 hu_i horizontal up line, for inside border
8 hv_i horizontal vertical line, for inside border
9 ld_t left down line, for top border
10 lu_b left up line, for bottom border
11 lv_i left vertical, for inside border
12 lv_r left vertical, for right border
13 rd_t right down line, for top border
14 ru_b right up line, for bottom border
15 rv_i right vertical line, for inside border
16 rv_l right vertical line, for left border
17 v_i vertical line, for inside border
18 v_l vertical line, for left border
19 v_r vertical line, for right border
The arguments to get_border_char() will also be passed to border character that is coderef, or to be interpreted by the class' get_border_char() to vary the character. Border style structureBorder style structure is a DefHash containing these keys:
Border style structure must be put in the %BORDER package variable. Border style characterA border style character can be a single-character string, or a coderef to allow border style that is context-sensitive. If border style character is a coderef, it must return a single-character string and not another coderef. The coderef will be called with the same arguments passed to "get_border_char". HOMEPAGEPlease visit the project's homepage at <https://metacpan.org/release/BorderStyle>. SOURCESource repository is at <https://github.com/perlancar/perl-BorderStyle>. SEE ALSOSomewhat related: ColorTheme specification, because they are often used together in an application. HISTORYv3Incompatible change. Remove "chars" in border style structure and abstract it through get_border_char() to be more flexible, e.g. to allow for footer area, vertical header (header columns), and so on. Replace the positional arguments in get_border_char() with named arguments to be more flexible. Replace the "x" and "y" arguments that refer to character with character "name", to be more readable. v2The first version of BorderStyle. Border::StyleBorder::Style is an older specification, superseded by this document. The older specification defines border style as just the border style structure, not the class and thus lacks methods like get_struct(), get_args(), and get_border_char(). AUTHORperlancar <perlancar@cpan.org> CONTRIBUTINGTo contribute, you can send patches by email/via RT, or send pull requests on GitHub. Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via: % prove -l If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond that are considered a bug and can be reported to me. COPYRIGHT AND LICENSEThis software is copyright (c) 2023, 2022, 2021, 2020 by perlancar <perlancar@cpan.org>. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. BUGSPlease report any bugs or feature requests on the bugtracker website <https://rt.cpan.org/Public/Dist/Display.html?Name=BorderStyle> When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
|