框架本地无法运行,修复尝试

This commit is contained in:
wangjinlei
2026-06-04 13:33:13 +08:00
parent bbd690ca0f
commit 0ee7c38000
359 changed files with 2767 additions and 3114 deletions

View File

@@ -10,7 +10,6 @@ use PhpOffice\Math\Element;
use PhpOffice\Math\Exception\InvalidInputException;
use PhpOffice\Math\Exception\NotImplementedException;
use PhpOffice\Math\Math;
use PhpOffice\Math\Reader\Security\XmlScanner;
class MathML implements ReaderInterface
{
@@ -23,17 +22,8 @@ class MathML implements ReaderInterface
/** @var DOMXPath */
private $xpath;
/** @var XmlScanner */
private $xmlScanner;
public function __construct()
{
$this->xmlScanner = XmlScanner::getInstance();
}
public function read(string $content): ?Math
{
$content = $this->xmlScanner->scan($content);
$content = str_replace(
[
'⁢',
@@ -45,7 +35,7 @@ class MathML implements ReaderInterface
);
$this->dom = new DOMDocument();
$this->dom->loadXML($content);
$this->dom->loadXML($content, LIBXML_DTDLOAD);
$this->math = new Math();
$this->parseNode(null, $this->math);

View File

@@ -40,26 +40,6 @@ class MathML implements WriterInterface
{
$tagName = $this->getElementTagName($element);
// Element\AbstractGroupElement
if ($element instanceof Element\Semantics) {
$this->output->startElement($tagName);
// Write elements
foreach ($element->getElements() as $childElement) {
$this->writeElementItem($childElement);
}
// Write annotations
foreach ($element->getAnnotations() as $encoding => $annotation) {
$this->output->startElement('annotation');
$this->output->writeAttribute('encoding', $encoding);
$this->output->text($annotation);
$this->output->endElement();
}
$this->output->endElement();
return;
}
// Element\AbstractGroupElement
if ($element instanceof Element\AbstractGroupElement) {
$this->output->startElement($tagName);
@@ -141,9 +121,6 @@ class MathML implements WriterInterface
if ($element instanceof Element\Operator) {
return 'mo';
}
if ($element instanceof Element\Semantics) {
return 'semantics';
}
throw new NotImplementedException(sprintf(
'%s : The element of the class `%s` has no tag name',