CSS::Yamaantaka - Converts direction of Cascading Style Sheet (CSS)
use CSS::Yamaantaka; $ya = CSS::Yamaantaka->new('lr_tb' => 'tb_rl'); $css_source_vertical_rl = $ya->transform($css_source);
As Yamāntaka has many legs, texts can run in various directions: left to right and right to left horizontally; vertically with lines extending right to left and left to right.
CSS::Yamaantaka replaces things directed to "left" or "horizontal-tb" in a Cascading Style Sheet (CSS) file such as float, padding, margin with values directed to "right" or "vertical-rl", and so on.
'adaptor'
Creates new CSS::Yamaantaka object.
In first form, SRC and DEST are the original and resulting directions. Available directions are 'lr_tb', 'rl_tb', 'tb_lr' and 'tb_rl'. Their synonyms are 'ltr', 'rtl', 'vertical-lr' and 'vertical-rl', respectively.
'lr_tb'
'rl_tb'
'tb_lr'
'tb_rl'
'ltr'
'rtl'
'vertical-lr'
'vertical-rl'
Following options are available.
Fixes background positions properties. Default is 1, will fix.
1
Fixes positions "n"/"e"/"s"/"w" and so on within cursor properties. Default is 1, will fix.
Fixes "top"/"right"/"bottom"/"left" string within URLs. Default is 0, won't fix.
0
Ignores unmirrorable background-position values. Default is 1, WILL ignore and won't croak it.
Fixes "ltr"/"rtl" string within URLs, if needed. Default is 0, won't fix.
In second form, ADAPTOR is a name of package or an object. package will be automatically loaded. See "Adaptors" about standard adaptors.
Get direction property or dir attribute of body element thought to be appropriate. Returns 'ltr', 'rtl' or undef (unknown).
Get text-orientation property of texts assumed. Returns 'sideways-left' or undef (upright or sideways-right is assumed).
'sideways-left'
Runs the fixing functions against CSS source.
$lines is a string. Following options are available.
Overrides these flags if params are set.
Returns same lines directions are changed.
Get writing-mode property of texts thought to be appropriate. Returns 'horizontal-tb', 'vertical-lr', 'vertical-rl' or undef (unknown).
'horizontal-tb'
This module supports four directions of documents:
The direction specified by { direction: ltr; writing-mode: horizontal-tb; }. For example, most Western writing systems employ it.
{ direction: ltr; writing-mode: horizontal-tb; }
The direction specified by { direction: rtl; writing-mode: horizontal-tb; }. For example, some Middle Eastern writing systems employ it.
{ direction: rtl; writing-mode: horizontal-tb; }
The direction specified by { writing-mode: vertical-lr; }. For example, several North Asian writing systems employ it.
{ writing-mode: vertical-lr; }
The direction specified by { writing-mode: vertical-rl; }. East Asian writing systems with vertical layout employ it.
{ writing-mode: vertical-rl; }
This module chooses adaptors by source & resulting directions:
table 1. Choosing adaptors +-----------+-------------+-------------+-------------+--------------+ | from \ to | lr-tb : rl-tb : tb-lr : tb-rl | +-----------+-------------+-------------+-------------+--------------+ | lr-tb | - : MirrorH : MirrorTL_BR : RotateR | | rl-tb | MirrorH : - : RotateL* : MirrorTR_BL* | | tb-lr | MirrorTL_BR : RotateR : - : MirrorV | | tb-rl | RotateL : MirrorTR_BL : MirrorV : - | +-----------+-------------+-------------+-------------+--------------+ * Assumed text-orientation: sideways-left. n.b.: Prefixing "CSS::Yamaantaka::" are omitted.
Each adaptor will or won't change following "directions" of CSS properties.
"right" / "left" of text-align, float and clear. "top" / "bottom" of vertical-align.
"top" / "right" / "bottom" / "left".
Directions specified by body element, "ltr" / "rtl".
Horizontal and vertical orientation.
table 2. Feature of adaptors +-------------+-----------+-------------------------+---------+------+ | | line-rel. | box directions : global : h/v | +-------------+-----------+-------------------------+---------+------+ | MirrorH | reverse h.: reverse horizontally : reverse : - | | MirrorV | - : reverse horizontally : reverse : - | | RotateR | - : rotate clockwise : reverse : swap | | RotateL | - : rotate counter-clockwise: reverse : swap | | MirrorTL_BR | - : reverse with tl-br axis : - : swap | | MirrorTR_BL | - : reverse with tr-bl axis : - : swap | +-------------+-----------+-------------------------+---------+------+
Any adaptors listed above won't fix line-relative text directions ("rtl" / "ltr").
Consult $VERSION variable.
$VERSION
CSS::Janus
Extended CSSJanus supporting vertical-rl writing-mode: http://www.epubcafe.jp/download
cssflip(1)
Hatuka*nezumi - IKEDA Soji <hatuka(at)nezumi.nu>.
Copyright (C) 2013 Hatuka*nezumi - IKEDA Soji.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install CSS::Janus, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CSS::Janus
CPAN shell
perl -MCPAN -e shell install CSS::Janus
For more information on module installation, please visit the detailed CPAN module installation guide.