Update website
This commit is contained in:
parent
4413528994
commit
1d90fbf296
6865 changed files with 1091082 additions and 0 deletions
45
vendor/doctrine/rst-parser/lib/LaTeX/Directives/Image.php
vendored
Normal file
45
vendor/doctrine/rst-parser/lib/LaTeX/Directives/Image.php
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\RST\LaTeX\Directives;
|
||||
|
||||
use Doctrine\RST\Directives\Directive;
|
||||
use Doctrine\RST\Nodes\Node;
|
||||
use Doctrine\RST\Parser;
|
||||
use Exception;
|
||||
|
||||
use function sprintf;
|
||||
|
||||
/**
|
||||
* Renders an image, example :
|
||||
*
|
||||
* .. image:: image.jpg
|
||||
* :width: 100
|
||||
* :title: An image
|
||||
*/
|
||||
final class Image extends Directive
|
||||
{
|
||||
public function getName(): string
|
||||
{
|
||||
return 'image';
|
||||
}
|
||||
|
||||
/** @param string[] $options */
|
||||
public function processNode(
|
||||
Parser $parser,
|
||||
string $variable,
|
||||
string $data,
|
||||
array $options
|
||||
): ?Node {
|
||||
$environment = $parser->getEnvironment();
|
||||
|
||||
$url = $environment->relativeUrl($data);
|
||||
|
||||
if ($url === null) {
|
||||
throw new Exception(sprintf('Could not build relative url for %s', $data));
|
||||
}
|
||||
|
||||
return $parser->getNodeFactory()->createImageNode($url, $options);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue