mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 01:25:27 +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:
|
case $entity instanceof \Yggverse\Gemtext\Entity\Header:
|
||||||
|
|
||||||
|
if ($preformatted)
|
||||||
|
{
|
||||||
|
$line[] = htmlspecialchars(
|
||||||
|
$this->_wrap(
|
||||||
|
$entity->toString()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
switch ($entity->getLevel())
|
switch ($entity->getLevel())
|
||||||
{
|
{
|
||||||
case 1: // #
|
case 1: // #
|
||||||
|
|
@ -210,11 +221,23 @@ class Data
|
||||||
|
|
||||||
throw new \Exception;
|
throw new \Exception;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case $entity instanceof \Yggverse\Gemtext\Entity\Link:
|
case $entity instanceof \Yggverse\Gemtext\Entity\Link:
|
||||||
|
|
||||||
|
if ($preformatted)
|
||||||
|
{
|
||||||
|
$line[] = htmlspecialchars(
|
||||||
|
$this->_wrap(
|
||||||
|
$entity->toString()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
$line[] = sprintf(
|
$line[] = sprintf(
|
||||||
'<a href="%s" title="%s">%s</a>',
|
'<a href="%s" title="%s">%s</a>',
|
||||||
$this->_url(
|
$this->_url(
|
||||||
|
|
@ -230,11 +253,23 @@ class Data
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case $entity instanceof \Yggverse\Gemtext\Entity\Listing:
|
case $entity instanceof \Yggverse\Gemtext\Entity\Listing:
|
||||||
|
|
||||||
|
if ($preformatted)
|
||||||
|
{
|
||||||
|
$line[] = htmlspecialchars(
|
||||||
|
$this->_wrap(
|
||||||
|
$entity->toString()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
$line[] = sprintf(
|
$line[] = sprintf(
|
||||||
'* %s',
|
'* %s',
|
||||||
htmlspecialchars(
|
htmlspecialchars(
|
||||||
|
|
@ -243,11 +278,23 @@ class Data
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case $entity instanceof \Yggverse\Gemtext\Entity\Quote:
|
case $entity instanceof \Yggverse\Gemtext\Entity\Quote:
|
||||||
|
|
||||||
|
if ($preformatted)
|
||||||
|
{
|
||||||
|
$line[] = htmlspecialchars(
|
||||||
|
$this->_wrap(
|
||||||
|
$entity->toString()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
$line[] = sprintf(
|
$line[] = sprintf(
|
||||||
'<i>%s</i>',
|
'<i>%s</i>',
|
||||||
htmlspecialchars(
|
htmlspecialchars(
|
||||||
|
|
@ -256,16 +303,29 @@ class Data
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case $entity instanceof \Yggverse\Gemtext\Entity\Text:
|
case $entity instanceof \Yggverse\Gemtext\Entity\Text:
|
||||||
|
|
||||||
|
if ($preformatted)
|
||||||
|
{
|
||||||
|
$line[] = htmlspecialchars(
|
||||||
|
$this->_wrap(
|
||||||
|
$entity->toString()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
$line[] = htmlspecialchars(
|
$line[] = htmlspecialchars(
|
||||||
$this->_wrap(
|
$this->_wrap(
|
||||||
$entity->getData()
|
$entity->getData()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue