denshoch / harusame
为立式-并排-垂直添加特殊的HTML类。
2.1.3
2020-11-02 01:42 UTC
Requires (Dev)
- phpunit/phpunit: >=6.5.13
README
将数字序列(默认为两位数)和感叹号(问号)序列用span.tcy
包裹(见立式-并排-垂直)。
将直立字符方向用span.upright
包裹,并将侧向字符方向用span.sideways
包裹(见UTR50)。
预期的CSS;
.tcy { text-combine-upright: all; } .upright { text-orientation: upright; } .sideways { text-orientation: sideways; }
安装
composer install
用法
$harusame = new Denshoch\Harusame(); $harusame.transform('平成20年!?'); // => 平成<span class="tcy">20</span>年<span class="tcy">!?</span> $harusame.transform('<html><head><title>平成20年!?</title></head><body>平成20年!?</body></html>'); // You can pass HTML string. Only text nodes within the body tag are transformed. // => <html><head><title>平成20年!?</title></head><body>平成<span class="tcy">20</span>年<span class="tcy">!?</span></body></html> $harusame.transform('⓵☂÷∴'); // => <span class="upright">⓵</span><span class="upright">☂</span><span class="sideways">÷</span><span class="sideways">∴</span>
选项
$options = array("tcyDigit" => 3); $harusame = new Denshoch\Harusame($options); $harusame.transform('10円玉と100円玉がある。'); // => <span class="tcy">10</span>円玉と<span class="tcy">100</span>円玉がある。 // or $harusame = new Denshoch\Harusame(); $harusame.tcyDigit = 3; $harusame.transform('10円玉と100円玉がある。'); // => <span class="tcy">10</span>円玉と<span class="tcy">100</span>円玉がある。
测试
$ verdor/bin/phpunit