'
',
'CODE' => [
'attributes' => [
'lang' => [
'filterChain' => ['#simpletext'],
'required' => \false
]
],
'template' =>
'
language-
'
],
'DEL' => '',
'EM' => '',
'H1' => '
',
'H2' => '
',
'H3' => '
',
'H4' => '
',
'H5' => '
',
'H6' => '
',
'HR' => '
',
'IMG' => [
'attributes' => [
'alt' => ['required' => \false ],
'src' => ['filterChain' => ['#url']],
'title' => ['required' => \false ]
],
'template' => '
'
],
'LI' => '',
'LIST' => [
'attributes' => [
'start' => [
'filterChain' => ['#uint'],
'required' => \false
],
'type' => [
'filterChain' => ['#simpletext'],
'required' => \false
]
],
'template' =>
'
'
],
'QUOTE' => '
',
'STRONG' => '',
'SUB' => '',
'SUP' => '',
'URL' => [
'attributes' => [
'title' => ['required' => \false ],
'url' => ['filterChain' => ['#url']]
],
'template' => ''
]
];
protected function setUp()
{
$this->configurator->rulesGenerator->append('ManageParagraphs');
foreach ($this->tags as $tagName => $tagConfig)
{
if (isset($this->configurator->tags[$tagName]))
continue;
if (\is_string($tagConfig))
$tagConfig = ['template' => $tagConfig];
$this->configurator->tags->add($tagName, $tagConfig);
}
}
public function asConfig()
{
return ['decodeHtmlEntities' => (bool) $this->decodeHtmlEntities];
}
public function getJSHints()
{
return ['LITEDOWN_DECODE_HTML_ENTITIES' => (int) $this->decodeHtmlEntities];
}
public function getJSParser()
{
$js = \file_get_contents(__DIR__ . '/Parser/ParsedText.js') . "\n"
. \file_get_contents(__DIR__ . '/Parser/Passes/AbstractScript.js') . "\n"
. \file_get_contents(__DIR__ . '/Parser/LinkAttributesSetter.js');
$passes = [
'Blocks',
'LinkReferences',
'InlineCode',
'Images',
'Links',
'Strikethrough',
'Subscript',
'Superscript',
'Emphasis',
'ForcedLineBreaks'
];
foreach ($passes as $pass)
$js .= "\n(function(){\n"
. \file_get_contents(__DIR__ . '/Parser/Passes/' . $pass . '.js') . "\nparse();\n})();";
return $js;
}
}