mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
enshort const names
This commit is contained in:
parent
13eb358d93
commit
c05107078f
3 changed files with 23 additions and 23 deletions
|
|
@ -13,7 +13,7 @@ class Markup implements \Yggverse\Yoda\Interface\Model\Gtk\Pango\Markup
|
|||
): string
|
||||
{
|
||||
return sprintf(
|
||||
self::TAG_CODE,
|
||||
self::CODE,
|
||||
self::_escape(
|
||||
$value
|
||||
)
|
||||
|
|
@ -26,7 +26,7 @@ class Markup implements \Yggverse\Yoda\Interface\Model\Gtk\Pango\Markup
|
|||
): string
|
||||
{
|
||||
return self::_wrap(
|
||||
self::TAG_H1,
|
||||
self::H1,
|
||||
$value,
|
||||
$width
|
||||
);
|
||||
|
|
@ -38,7 +38,7 @@ class Markup implements \Yggverse\Yoda\Interface\Model\Gtk\Pango\Markup
|
|||
): string
|
||||
{
|
||||
return self::_wrap(
|
||||
self::TAG_H2,
|
||||
self::H2,
|
||||
$value,
|
||||
$width
|
||||
);
|
||||
|
|
@ -50,7 +50,7 @@ class Markup implements \Yggverse\Yoda\Interface\Model\Gtk\Pango\Markup
|
|||
): string
|
||||
{
|
||||
return self::_wrap(
|
||||
self::TAG_H3,
|
||||
self::H3,
|
||||
$value,
|
||||
$width
|
||||
);
|
||||
|
|
@ -63,7 +63,7 @@ class Markup implements \Yggverse\Yoda\Interface\Model\Gtk\Pango\Markup
|
|||
): string
|
||||
{
|
||||
return sprintf(
|
||||
self::TAG_LINK,
|
||||
self::LINK,
|
||||
self::_escape(
|
||||
$href
|
||||
),
|
||||
|
|
@ -82,7 +82,7 @@ class Markup implements \Yggverse\Yoda\Interface\Model\Gtk\Pango\Markup
|
|||
): string
|
||||
{
|
||||
return self::_wrap(
|
||||
self::TAG_LIST,
|
||||
self::LIST,
|
||||
sprintf(
|
||||
'* %s',
|
||||
$value
|
||||
|
|
@ -97,7 +97,7 @@ class Markup implements \Yggverse\Yoda\Interface\Model\Gtk\Pango\Markup
|
|||
): string
|
||||
{
|
||||
return self::_wrap(
|
||||
self::TAG_QUOTE,
|
||||
self::QUOTE,
|
||||
$value,
|
||||
$width
|
||||
);
|
||||
|
|
@ -109,7 +109,7 @@ class Markup implements \Yggverse\Yoda\Interface\Model\Gtk\Pango\Markup
|
|||
): string
|
||||
{
|
||||
return self::_wrap(
|
||||
self::TAG_TEXT,
|
||||
self::TEXT,
|
||||
$value,
|
||||
$width
|
||||
);
|
||||
|
|
@ -137,7 +137,7 @@ class Markup implements \Yggverse\Yoda\Interface\Model\Gtk\Pango\Markup
|
|||
|
||||
// @TODO optimization wanted, wordwrap / set_line_wrap not solution
|
||||
protected static function _wrap(
|
||||
string $tag, // const
|
||||
string $format, // const
|
||||
string $value, // unescaped
|
||||
int $width = self::WRAP_WIDTH,
|
||||
string $break = self::WRAP_BREAK,
|
||||
|
|
@ -158,7 +158,7 @@ class Markup implements \Yggverse\Yoda\Interface\Model\Gtk\Pango\Markup
|
|||
{
|
||||
$label->set_markup(
|
||||
sprintf(
|
||||
$tag,
|
||||
$format,
|
||||
self::_escape(
|
||||
implode(
|
||||
' ' , $words[$line]
|
||||
|
|
@ -187,7 +187,7 @@ class Markup implements \Yggverse\Yoda\Interface\Model\Gtk\Pango\Markup
|
|||
$label->destroy();
|
||||
|
||||
return sprintf(
|
||||
$tag,
|
||||
$format,
|
||||
self::_escape(
|
||||
implode(
|
||||
$break,
|
||||
|
|
|
|||
|
|
@ -10,17 +10,17 @@ namespace Yggverse\Yoda\Interface\Model\Gtk\Pango;
|
|||
*/
|
||||
interface Markup
|
||||
{
|
||||
public const TAG_CODE = '<tt>%s</tt>';
|
||||
public const TAG_CODE_CLOSE = '</tt>';
|
||||
public const TAG_CODE_OPEN = '<tt>';
|
||||
public const CODE = '<tt>%s</tt>';
|
||||
public const H1 = '<span size="xx-large">%s</span>';
|
||||
public const H2 = '<span size="x-large">%s</span>';
|
||||
public const H3 = '<span size="large">%s</span>';
|
||||
public const LINK = '<a href="%s" title="%s"><span underline="none">%s</span></a>';
|
||||
public const LIST = '<span>%s</span>';
|
||||
public const QUOTE = '<i>%s</i>';
|
||||
public const TEXT = '<span>%s</span>';
|
||||
|
||||
public const TAG_H1 = '<span size="xx-large">%s</span>';
|
||||
public const TAG_H2 = '<span size="x-large">%s</span>';
|
||||
public const TAG_H3 = '<span size="large">%s</span>';
|
||||
public const TAG_LINK = '<a href="%s" title="%s"><span underline="none">%s</span></a>';
|
||||
public const TAG_LIST = '<span>%s</span>';
|
||||
public const TAG_QUOTE = '<i>%s</i>';
|
||||
public const TAG_TEXT = '<span>%s</span>';
|
||||
public const CODE_BEGIN = '<tt>';
|
||||
public const CODE_CLOSE = '</tt>';
|
||||
|
||||
public const LINK_PREFIX_INTERNAL = ''; // | ⇒
|
||||
public const LINK_PREFIX_EXTERNAL = '⇗';
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ class Gemtext extends \Yggverse\Yoda\Abstract\Model\Gtk\Pango\Markup
|
|||
|
||||
else
|
||||
{
|
||||
$line[] = $preformatted ? self::TAG_CODE_CLOSE
|
||||
: self::TAG_CODE_OPEN;
|
||||
$line[] = $preformatted ? self::CODE_CLOSE
|
||||
: self::CODE_BEGIN;
|
||||
|
||||
$preformatted = !($preformatted); // toggle
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue