mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 17:45:28 +00:00
define wrap storage
This commit is contained in:
parent
ba7a56ca7e
commit
3186ac6846
2 changed files with 16 additions and 10 deletions
|
|
@ -16,12 +16,13 @@ abstract class Markup
|
||||||
// Dependencies
|
// Dependencies
|
||||||
public Content $content;
|
public Content $content;
|
||||||
|
|
||||||
// Extras
|
|
||||||
protected ?string $_source = null;
|
|
||||||
|
|
||||||
// Defaults
|
// Defaults
|
||||||
public const WRAP = 140;
|
public const WRAP = 140;
|
||||||
|
|
||||||
|
// Extras
|
||||||
|
protected int $_wrap = self::WRAP;
|
||||||
|
protected ?string $_source = null;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Content $content
|
Content $content
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -315,15 +315,20 @@ class Gemtext extends Markup
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _wrap(
|
private function _wrap(
|
||||||
string $value
|
string $source
|
||||||
): string
|
): string
|
||||||
{
|
{
|
||||||
return wordwrap(
|
if ($wrap = $this->_wrap ? $this->_wrap : $this::WRAP)
|
||||||
$value,
|
{
|
||||||
$this::WRAP,
|
return wordwrap(
|
||||||
PHP_EOL,
|
$source,
|
||||||
false
|
$wrap,
|
||||||
);
|
PHP_EOL,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _url(
|
private function _url(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue