mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 17:45:28 +00:00
fix preformatted markup
This commit is contained in:
parent
6d37944c04
commit
5b7ff6974e
1 changed files with 125 additions and 65 deletions
|
|
@ -160,6 +160,17 @@ class Data
|
|||
|
||||
case $entity instanceof \Yggverse\Gemtext\Entity\Header:
|
||||
|
||||
if ($preformatted)
|
||||
{
|
||||
$line[] = htmlspecialchars(
|
||||
$this->_wrap(
|
||||
$entity->toString()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
switch ($entity->getLevel())
|
||||
{
|
||||
case 1: // #
|
||||
|
|
@ -210,11 +221,23 @@ class Data
|
|||
|
||||
throw new \Exception;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case $entity instanceof \Yggverse\Gemtext\Entity\Link:
|
||||
|
||||
if ($preformatted)
|
||||
{
|
||||
$line[] = htmlspecialchars(
|
||||
$this->_wrap(
|
||||
$entity->toString()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$line[] = sprintf(
|
||||
'<a href="%s" title="%s">%s</a>',
|
||||
$this->_url(
|
||||
|
|
@ -230,11 +253,23 @@ class Data
|
|||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case $entity instanceof \Yggverse\Gemtext\Entity\Listing:
|
||||
|
||||
if ($preformatted)
|
||||
{
|
||||
$line[] = htmlspecialchars(
|
||||
$this->_wrap(
|
||||
$entity->toString()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$line[] = sprintf(
|
||||
'* %s',
|
||||
htmlspecialchars(
|
||||
|
|
@ -243,11 +278,23 @@ class Data
|
|||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case $entity instanceof \Yggverse\Gemtext\Entity\Quote:
|
||||
|
||||
if ($preformatted)
|
||||
{
|
||||
$line[] = htmlspecialchars(
|
||||
$this->_wrap(
|
||||
$entity->toString()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$line[] = sprintf(
|
||||
'<i>%s</i>',
|
||||
htmlspecialchars(
|
||||
|
|
@ -256,16 +303,29 @@ class Data
|
|||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case $entity instanceof \Yggverse\Gemtext\Entity\Text:
|
||||
|
||||
if ($preformatted)
|
||||
{
|
||||
$line[] = htmlspecialchars(
|
||||
$this->_wrap(
|
||||
$entity->toString()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$line[] = htmlspecialchars(
|
||||
$this->_wrap(
|
||||
$entity->getData()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue