Skip to content

Commit

Permalink
Merge pull request #36 from the-turk/analysis-16kD25
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
the-turk committed Aug 4, 2022
2 parents ffe67be + 099d8fe commit 831a65c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
11 changes: 6 additions & 5 deletions extend.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/

namespace TheTurk\MathRen;

use Flarum\Api\Serializer\ForumSerializer;
use Flarum\Extend;

return [
(new Extend\Frontend('forum'))
->css(__DIR__ . '/less/forum.less')
->js(__DIR__ . '/js/dist/forum.js'),
->css(__DIR__.'/less/forum.less')
->js(__DIR__.'/js/dist/forum.js'),

(new Extend\Frontend('admin'))
->css(__DIR__ . '/less/admin.less')
->js(__DIR__ . '/js/dist/admin.js'),
->css(__DIR__.'/less/admin.less')
->js(__DIR__.'/js/dist/admin.js'),

(new Extend\Locales(__DIR__ . '/locale')),
(new Extend\Locales(__DIR__.'/locale')),

(new Extend\ApiSerializer(ForumSerializer::class))
->attributes(LoadSettings::class),
Expand Down
21 changes: 11 additions & 10 deletions src/ConfigureTextFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/

namespace TheTurk\MathRen;

use Illuminate\Support\Arr;
Expand Down Expand Up @@ -69,24 +70,24 @@ public function __invoke(Configurator $config)

// add custom BBCode
$config->BBCodes->addCustom(
$delimiter['left'] . '{TEXT}' . $delimiter['right'],
$delimiter['left'].'{TEXT}'.$delimiter['right'],
'<span>
<xsl:attribute name="class">' . $classes[$className] . '</xsl:attribute>
<xsl:attribute name="data-s9e-livepreview-onupdate">if(typeof katex!==\'undefined\')katex.render((typeof ascii2tex!==\'undefined\') ? ascii2tex.parse(this.innerText) : this.innerText, this, ' . $options . ')</xsl:attribute>
<xsl:apply-templates/>' .
<xsl:attribute name="class">'.$classes[$className].'</xsl:attribute>
<xsl:attribute name="data-s9e-livepreview-onupdate">if(typeof katex!==\'undefined\')katex.render((typeof ascii2tex!==\'undefined\') ? ascii2tex.parse(this.innerText) : this.innerText, this, '.$options.')</xsl:attribute>
<xsl:apply-templates/>'.
(\boolval($this->util->get('allow_asciimath')) ? '
<script defer="" crossorigin="anonymous">
<xsl:attribute name="data-s9e-livepreview-onrender">if(typeof ascii2tex!==\'undefined\')this.parentNode.removeChild(this)</xsl:attribute>
<xsl:attribute name="integrity">' . $this->util->get('sri_asciimath2tex') . '</xsl:attribute>
<xsl:attribute name="integrity">'.$this->util->get('sri_asciimath2tex').'</xsl:attribute>
<xsl:attribute name="onload">window.ascii2tex=new AsciiMathParser()</xsl:attribute>
<xsl:attribute name="src">' . $this->util->get('cdn_asciimath2tex') . '</xsl:attribute>
<xsl:attribute name="src">'.$this->util->get('cdn_asciimath2tex').'</xsl:attribute>
</script>
' : '') .
' : '').
'<script defer="" crossorigin="anonymous">
<xsl:attribute name="data-s9e-livepreview-onrender">if(typeof katex!==\'undefined\')this.parentNode.removeChild(this)</xsl:attribute>
<xsl:attribute name="integrity">' . $this->util->get('sri_katex') . '</xsl:attribute>
<xsl:attribute name="onload">katex.render((typeof ascii2tex!==\'undefined\') ? ascii2tex.parse(this.parentNode.innerText) : this.parentNode.innerText, this.parentNode, ' . $options . ')</xsl:attribute>
<xsl:attribute name="src">' . $this->util->get('cdn_katex') . '</xsl:attribute>
<xsl:attribute name="integrity">'.$this->util->get('sri_katex').'</xsl:attribute>
<xsl:attribute name="onload">katex.render((typeof ascii2tex!==\'undefined\') ? ascii2tex.parse(this.parentNode.innerText) : this.parentNode.innerText, this.parentNode, '.$options.')</xsl:attribute>
<xsl:attribute name="src">'.$this->util->get('cdn_katex').'</xsl:attribute>
</script>
</span>'
);
Expand Down

0 comments on commit 831a65c

Please sign in to comment.