1
This commit is contained in:
@@ -11,10 +11,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
### MkDocs
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v2
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.x
|
||||
- name: Install Python Dependencies
|
||||
@@ -25,7 +25,7 @@ jobs:
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 7.2
|
||||
php-version: 8.1
|
||||
extensions: dom, xml
|
||||
coverage: xdebug
|
||||
- name: Create directory public/coverage
|
||||
@@ -38,14 +38,13 @@ jobs:
|
||||
- name: Create directory public/docs
|
||||
run: mkdir ./public/docs
|
||||
- name: Install PhpDocumentor
|
||||
## Support PHP 7.2
|
||||
run: wget https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.0.0/phpDocumentor.phar && chmod +x phpDocumentor.phar
|
||||
run: wget https://phpdoc.org/phpDocumentor.phar && chmod +x phpDocumentor.phar
|
||||
- name: Build Documentation
|
||||
run: ./phpDocumentor.phar run -d ./src -t ./public/docs
|
||||
|
||||
### Deploy
|
||||
- name: Deploy
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
uses: peaceiris/actions-gh-pages@v4
|
||||
if: github.ref == 'refs/heads/master'
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
12
vendor/phpoffice/math/.github/workflows/php.yml
vendored
12
vendor/phpoffice/math/.github/workflows/php.yml
vendored
@@ -103,4 +103,14 @@ jobs:
|
||||
run: |
|
||||
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.4.3/php-coveralls.phar
|
||||
chmod +x php-coveralls.phar
|
||||
php php-coveralls.phar --coverage_clover=build/clover.xml --json_path=build/coveralls-upload.json -vvv
|
||||
php php-coveralls.phar --coverage_clover=build/clover.xml --json_path=build/coveralls-upload.json -vvv
|
||||
|
||||
roave-backwards-compatibility-check:
|
||||
name: Roave Backwards Compatibility Check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: "Check for BC breaks"
|
||||
run: docker run -u $(id -u) -v $(pwd):/app nyholm/roave-bc-check-ga
|
||||
|
||||
6
vendor/phpoffice/math/composer.json
vendored
6
vendor/phpoffice/math/composer.json
vendored
@@ -7,7 +7,11 @@
|
||||
"license": "MIT",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PhpOffice\\Math\\": "src/Math/",
|
||||
"PhpOffice\\Math\\": "src/Math/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\PhpOffice\\Math\\": "tests/Math/"
|
||||
}
|
||||
},
|
||||
|
||||
4
vendor/phpoffice/math/mkdocs.yml
vendored
4
vendor/phpoffice/math/mkdocs.yml
vendored
@@ -22,7 +22,7 @@ extra:
|
||||
generator: false
|
||||
extra_javascript:
|
||||
- assets/mathjax.js
|
||||
- https://polyfill.io/v3/polyfill.min.js?features=es6
|
||||
- https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?version=3.111.0&features=es6
|
||||
- https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
|
||||
markdown_extensions:
|
||||
## Syntax highlighting
|
||||
@@ -61,4 +61,4 @@ nav:
|
||||
- Developers:
|
||||
- 'Coveralls': 'https://coveralls.io/github/PHPOffice/Math'
|
||||
- 'Code Coverage': 'coverage/index.html'
|
||||
- 'PHPDoc': 'docs/index.html'
|
||||
- 'PHPDoc': 'docs/index.html'
|
||||
|
||||
23
vendor/phpoffice/math/src/Math/Reader/MathML.php
vendored
23
vendor/phpoffice/math/src/Math/Reader/MathML.php
vendored
@@ -19,7 +19,7 @@ class MathML implements ReaderInterface
|
||||
/** @var DOMDocument */
|
||||
private $dom;
|
||||
|
||||
/** @var DOMXpath */
|
||||
/** @var DOMXPath */
|
||||
private $xpath;
|
||||
|
||||
public function read(string $content): ?Math
|
||||
@@ -48,7 +48,7 @@ class MathML implements ReaderInterface
|
||||
*/
|
||||
protected function parseNode(?DOMNode $nodeRowElement, $parent): void
|
||||
{
|
||||
$this->xpath = new DOMXpath($this->dom);
|
||||
$this->xpath = new DOMXPath($this->dom);
|
||||
foreach ($this->xpath->query('*', $nodeRowElement) ?: [] as $nodeElement) {
|
||||
if ($parent instanceof Element\Semantics
|
||||
&& $nodeElement instanceof DOMElement
|
||||
@@ -61,12 +61,7 @@ class MathML implements ReaderInterface
|
||||
continue;
|
||||
}
|
||||
|
||||
$element = $this->getElement($nodeElement);
|
||||
$parent->add($element);
|
||||
|
||||
if ($element instanceof Element\AbstractGroupElement) {
|
||||
$this->parseNode($nodeElement, $element);
|
||||
}
|
||||
$parent->add($this->getElement($nodeElement));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +103,11 @@ class MathML implements ReaderInterface
|
||||
|
||||
return new Element\Operator($nodeValue);
|
||||
case 'mrow':
|
||||
return new Element\Row();
|
||||
$mrow = new Element\Row();
|
||||
|
||||
$this->parseNode($nodeElement, $mrow);
|
||||
|
||||
return $mrow;
|
||||
case 'msup':
|
||||
$nodeList = $this->xpath->query('*', $nodeElement);
|
||||
if ($nodeList && $nodeList->length == 2) {
|
||||
@@ -124,7 +123,11 @@ class MathML implements ReaderInterface
|
||||
$nodeElement->nodeName
|
||||
));
|
||||
case 'semantics':
|
||||
return new Element\Semantics();
|
||||
$semantics = new Element\Semantics();
|
||||
|
||||
$this->parseNode($nodeElement, $semantics);
|
||||
|
||||
return $semantics;
|
||||
default:
|
||||
throw new NotImplementedException(sprintf(
|
||||
'%s : The tag `%s` is not implemented',
|
||||
|
||||
@@ -18,7 +18,7 @@ class OfficeMathML implements ReaderInterface
|
||||
/** @var Math */
|
||||
protected $math;
|
||||
|
||||
/** @var DOMXpath */
|
||||
/** @var DOMXPath */
|
||||
protected $xpath;
|
||||
|
||||
/** @var string[] */
|
||||
@@ -52,7 +52,7 @@ class OfficeMathML implements ReaderInterface
|
||||
*/
|
||||
protected function parseNode(?DOMNode $nodeRowElement, $parent): void
|
||||
{
|
||||
$this->xpath = new DOMXpath($this->dom);
|
||||
$this->xpath = new DOMXPath($this->dom);
|
||||
foreach ($this->xpath->query('*', $nodeRowElement) ?: [] as $nodeElement) {
|
||||
$element = $this->getElement($nodeElement);
|
||||
$parent->add($element);
|
||||
|
||||
@@ -165,6 +165,60 @@ class MathMLTest extends TestCase
|
||||
$math = $reader->read($content);
|
||||
}
|
||||
|
||||
public function testReadFractionWithRow(): void
|
||||
{
|
||||
$content = '<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<mfrac>
|
||||
<mrow>
|
||||
<mn>3</mn>
|
||||
<mo>-</mo>
|
||||
<mi>x</mi>
|
||||
</mrow>
|
||||
<mn>2</mn>
|
||||
</mfrac>
|
||||
</math>';
|
||||
|
||||
$reader = new MathML();
|
||||
$math = $reader->read($content);
|
||||
$this->assertInstanceOf(Math::class, $math);
|
||||
|
||||
$elements = $math->getElements();
|
||||
$this->assertCount(1, $elements);
|
||||
$this->assertInstanceOf(Element\Fraction::class, $elements[0]);
|
||||
|
||||
/** @var Element\Fraction $element */
|
||||
$element = $elements[0];
|
||||
|
||||
$this->assertInstanceOf(Element\Row::class, $element->getNumerator());
|
||||
/** @var Element\Row $subElement */
|
||||
$subElement = $element->getNumerator();
|
||||
|
||||
$subsubElements = $subElement->getElements();
|
||||
$this->assertCount(3, $subsubElements);
|
||||
|
||||
/** @var Element\Numeric $subsubElement */
|
||||
$subsubElement = $subsubElements[0];
|
||||
$this->assertInstanceOf(Element\Numeric::class, $subsubElement);
|
||||
$this->assertEquals('3', $subsubElement->getValue());
|
||||
|
||||
/** @var Element\Operator $subsubElement */
|
||||
$subsubElement = $subsubElements[1];
|
||||
$this->assertInstanceOf(Element\Operator::class, $subsubElement);
|
||||
$this->assertEquals('-', $subsubElement->getValue());
|
||||
|
||||
/** @var Element\Identifier $subsubElement */
|
||||
$subsubElement = $subsubElements[2];
|
||||
$this->assertInstanceOf(Element\Identifier::class, $subsubElement);
|
||||
$this->assertEquals('x', $subsubElement->getValue());
|
||||
|
||||
$this->assertInstanceOf(Element\Numeric::class, $element->getDenominator());
|
||||
/** @var Element\Numeric $subElement */
|
||||
$subElement = $element->getDenominator();
|
||||
$this->assertEquals('2', $subElement->getValue());
|
||||
}
|
||||
|
||||
public function testReadSuperscriptInvalid(): void
|
||||
{
|
||||
$this->expectException(InvalidInputException::class);
|
||||
|
||||
@@ -95,7 +95,7 @@ class MathMLTest extends WriterTestCase
|
||||
|
||||
$math = new Math();
|
||||
|
||||
$object = new class() extends Element\AbstractElement {};
|
||||
$object = new class extends Element\AbstractElement {};
|
||||
$math->add($object);
|
||||
|
||||
$writer = new MathML();
|
||||
|
||||
@@ -70,7 +70,7 @@ class OfficeMathMLTest extends WriterTestCase
|
||||
|
||||
$math = new Math();
|
||||
|
||||
$object = new class() extends Element\AbstractElement {};
|
||||
$object = new class extends Element\AbstractElement {};
|
||||
$math->add($object);
|
||||
|
||||
$writer = new OfficeMathML();
|
||||
|
||||
Reference in New Issue
Block a user