This commit is contained in:
wangjinlei
2024-07-17 09:23:45 +08:00
parent edf9deeb1a
commit 881ac3e056
1001 changed files with 41032 additions and 5452 deletions

View File

@@ -0,0 +1,17 @@
window.MathJax = {
tex: {
inlineMath: [["\\(", "\\)"]],
displayMath: [["\\[", "\\]"]],
processEscapes: true,
processEnvironments: true
},
options: {
ignoreHtmlClass: ".*|",
processHtmlClass: "arithmatex"
}
};
document$.subscribe(() => {
MathJax.typesetPromise()
})

View File

@@ -0,0 +1,19 @@
# 0.1.0
## Enhancements
- Initial version by [@Progi1984](https://github/Progi1984)
- MathML Reader : Support for Semantics by [@Progi1984](https://github/Progi1984) in [#4](https://github.com/PHPOffice/Math/pull/4)
- PHPUnit : Improved Unit Tests by [@Progi1984](https://github/Progi1984) in [#8](https://github.com/PHPOffice/Math/pull/8)
## Bug fixes
- N/A
## Miscellaneous
- Github Actions : PHPCSFixer by [@Progi1984](https://github/Progi1984) in [#1](https://github.com/PHPOffice/Math/pull/1)
- Github Actions : PHPStan by [@Progi1984](https://github/Progi1984) in [#2](https://github.com/PHPOffice/Math/pull/2)
- Removed dependency friendsofphp/php-cs-fixer by [@Progi1984](https://github/Progi1984) in [#3](https://github.com/PHPOffice/Math/pull/3)
- Github Actions : Dependabot by [@Progi1984](https://github/Progi1984) in [#5](https://github.com/PHPOffice/Math/pull/5)
- Bump actions/checkout from 2 to 4 by [@dependabot](https://github/dependabot) in [#6](https://github.com/PHPOffice/Math/pull/6)
- Added documentation (MkDocs / Coverage / PHPDoc) by [@Progi1984](https://github/Progi1984) in [#7](https://github.com/PHPOffice/Math/pull/7)

8
vendor/phpoffice/math/docs/credits.md vendored Normal file
View File

@@ -0,0 +1,8 @@
## References
### MathML
- [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/MathML)
### OfficeMathML

59
vendor/phpoffice/math/docs/index.md vendored Normal file
View File

@@ -0,0 +1,59 @@
#
Math is a library written in pure PHP that provides a set of classes to manipulate different formula file formats, i.e. [MathML](https://en.wikipedia.org/wiki/MathML) and [Office MathML (OOML)](https://en.wikipedia.org/wiki/Office_Open_XML_file_formats#Office_MathML_(OMML)).
Math is an open source project licensed under the terms of [MIT](https://github.com/PHPOffice/Math/blob/master/LICENCE). Math is aimed to be a high quality software product by incorporating [continuous integration and unit testing](https://github.com/PHPOffice/Math/actions/workflows/php.yml). You can learn more about Math by reading this Developers'Documentation and the [API Documentation](http://phpoffice.github.io/Math/docs/develop/)
## Features
- Insert elements:
* Basic :
* Identifier : <math display="inline"><mi>a</mi></math>
* Operator : <math display="inline"><mo>+</mo></math>
* Numeric : <math display="inline"><mn>2</mn></math>
* Simple :
* Fraction : <math display="inline"><mfrac><mi>a</mi><mn>3</mn></mfrac></math>
* Superscript : <math display="inline"><msup><mi>a</mi><mn>3</mn></msup></math>
* Architectural :
* Row
* Semantics
## Support
### Readers
| Features | | MathML | Office MathML |
|---------------------------|----------------------|:----------------:|:----------------:|
| **Basic** | Identifier | :material-check: | :material-check: |
| | Operator | :material-check: | :material-check: |
| | Numeric | :material-check: | :material-check: |
| **Simple** | Fraction | :material-check: | :material-check: |
| | Superscript | :material-check: | |
| **Architectural** | Row | :material-check: | |
| | Semantics | :material-check: | |
### Writers
| Features | | MathML | Office MathML |
|---------------------------|----------------------|:----------------:|:----------------:|
| **Basic** | Identifier | :material-check: | :material-check: |
| | Operator | :material-check: | :material-check: |
| | Numeric | :material-check: | :material-check: |
| **Simple** | Fraction | :material-check: | :material-check: |
| | Superscript | :material-check: | |
| **Architectural** | Row | :material-check: | :material-check: |
| | Semantics | | |
## Contributing
We welcome everyone to contribute to Math. Below are some of the things that you can do to contribute:
- [Fork us](https://github.com/PHPOffice/Math/fork) and [request a pull](https://github.com/PHPOffice/Math/pulls) to the [master](https://github.com/PHPOffice/Math/tree/master) branch
- Submit [bug reports or feature requests](https://github.com/PHPOffice/Math/issues) to GitHub
- Follow [@PHPOffice](https://twitter.com/PHPOffice) on Twitter

25
vendor/phpoffice/math/docs/install.md vendored Normal file
View File

@@ -0,0 +1,25 @@
# Installation
## Requirements
Mandatory:
- PHP 7.1+
- PHP [DOM extension](http://php.net/manual/en/book.dom.php)
- PHP [XML Parser extension](http://www.php.net/manual/en/xml.installation.php)
- PHP [XMLWriter extension](http://php.net/manual/en/book.xmlwriter.php)
## Installation
### Using Composer
To install via [Composer](http://getcomposer.org), add the following lines to your `composer.json`:
``` json
{
"require": {
"phpoffice/math": "dev-master"
}
}
```

View File

@@ -0,0 +1,61 @@
## Usage
To create a fraction, use the `PhpOffice\Math\Element\Fraction` class.
### Methods
#### getDenominator
The method has no parameter.
#### getNumerator
The method has no parameter.
#### setDenominator
The method has one parameter :
* `PhpOffice\Math\Element\AbstractElement` **$element**
#### setNumerator
The method has one parameter :
* `PhpOffice\Math\Element\AbstractElement` **$element**
## Example
### Math
<math display="block">
<mfrac>
<mi>a</mi>
<mn>3</mn>
</mfrac>
</math>
### XML
``` xml
<math display="block">
<mfrac>
<mi>a</mi>
<mn>3</mn>
</mfrac>
</math>
```
### PHP
``` php
<?php
use PhpOffice\Math\Element;
use PhpOffice\Math\Math;
$math = new Math();
$fraction = new Element\Fraction();
$fraction->setDenominator(new Element\Identifier('a'));
$fraction->setNumerator(new Element\Numeric(3));
$math->add($fraction);
```

View File

@@ -0,0 +1,43 @@
## Usage
To create an identifier, use the `PhpOffice\Math\Element\Identifier` class.
### Methods
#### getValue
The method has no parameter.
#### setValue
The method has one parameter :
* `string` **$value**
## Example
### Math
<math display="block">
<mi>a</mi>
</math>
### XML
``` xml
<math display="block">
<mi>a</mi>
</math>
```
### PHP
``` php
<?php
use PhpOffice\Math\Element;
use PhpOffice\Math\Math;
$math = new Math();
$identifier = new Element\Identifier('a');
$math->add($identifier);
```

View File

@@ -0,0 +1,43 @@
## Usage
To create a numeric, use the `PhpOffice\Math\Element\Numeric` class.
### Methods
#### getValue
The method has no parameter.
#### setValue
The method has one parameter :
* `float` **$value**
## Example
### Math
<math display="block">
<mn>3</mn>
</math>
### XML
``` xml
<math display="block">
<mn>3</mn>
</math>
```
### PHP
``` php
<?php
use PhpOffice\Math\Element;
use PhpOffice\Math\Math;
$math = new Math();
$identifier = new Element\Numeric(3);
$math->add($identifier);
```

View File

@@ -0,0 +1,43 @@
## Usage
To create an operator, use the `PhpOffice\Math\Element\Operator` class.
### Methods
#### getValue
The method has no parameter.
#### setValue
The method has one parameter :
* `string` **$value**
## Example
### Math
<math display="block">
<mo>+</mo>
</math>
### XML
``` xml
<math display="block">
<mo>+</mo>
</math>
```
### PHP
``` php
<?php
use PhpOffice\Math\Element;
use PhpOffice\Math\Math;
$math = new Math();
$identifier = new Element\Operator('+');
$math->add($identifier);
```

View File

@@ -0,0 +1,62 @@
## Usage
To create a row, use the `PhpOffice\Math\Element\Row` class.
### Methods
#### add
The method add an element to the row.
The method has one parameter :
* `PhpOffice\Math\Element\AbstractElement` **$element**
#### getElements
The method return all elements of the row.
#### remove
The method remove an element to the row.
The method has one parameter :
* `PhpOffice\Math\Element\AbstractElement` **$element**
## Example
### Math
<math display="block">
<mrow>
<mn>1</mn>
<mo>+</mo>
<mi>K</mi>
</mrow>
</math>
### XML
``` xml
<math display="block">
<mrow>
<mn>1</mn>
<mo>+</mo>
<mi>K</mi>
</mrow>
</math>
```
### PHP
``` php
<?php
use PhpOffice\Math\Element;
use PhpOffice\Math\Math;
$math = new Math();
$row = new Element\Row();
$row->add(new Element\Numeric(1));
$row->add(new Element\Operator('+'));
$row->add(new Element\Identifier('K'));
$math->add($row);
```

View File

@@ -0,0 +1,81 @@
## Usage
To create a semantics, use the `PhpOffice\Math\Element\Semantics` class.
### Methods
#### add
The method add an element to the `semantics` element.
The method has one parameter :
* `PhpOffice\Math\Element\AbstractElement` **$element**
#### addAnnotation
The method add an annotation to the `semantics` element.
The method has two parameters :
* `string` **$encoding**
* `string` **$annotation**
#### getAnnotation
The method return an annotation based on its encoding.
The method has one parameter :
* `string` **$encoding**
#### getAnnotations
The method return alls annotation of the `semantics` element.
The method has no parameter.
#### getElements
The method return all elements of the `semantics` element.
#### remove
The method remove an element to the `semantics` element.
The method has one parameter :
* `PhpOffice\Math\Element\AbstractElement` **$element**
## Example
### Math
<math display="block">
<semantics>
<mi>y</mi>
<annotation encoding="application/x-tex"> y </annotation>
</semantics>
</math>
### XML
``` xml
<math display="block">
<semantics>
<mi>y</mi>
<annotation encoding="application/x-tex"> y </annotation>
</semantics>
</math>
```
### PHP
``` php
<?php
use PhpOffice\Math\Element;
use PhpOffice\Math\Math;
$math = new Math();
$semantics = new Element\Semantics();
$semantics->add(new Element\Identifier('y'));
$semantics->addAnnotation('application/x-tex', ' y ');
$math->add($semantics);
```

View File

@@ -0,0 +1,61 @@
## Usage
To attach a superscript to an expression, use the `PhpOffice\Math\Element\Superscript` class.
### Methods
#### getBase
The method has no parameter.
#### getSuperscript
The method has no parameter.
#### setBase
The method has one parameter :
* `PhpOffice\Math\Element\AbstractElement` **$element**
#### setSuperscript
The method has one parameter :
* `PhpOffice\Math\Element\AbstractElement` **$element**
## Example
### Math
<math display="block">
<msup>
<mi>X</mi>
<mn>2</mn>
</msup>
</math>
### XML
``` xml
<math display="block">
<msup>
<mi>X</mi>
<mn>2</mn>
</msup>
</math>
```
### PHP
``` php
<?php
use PhpOffice\Math\Element;
use PhpOffice\Math\Math;
$math = new Math();
$superscript = new Element\Superscript();
$superscript->setBase(new Element\Identifier('X'));
$superscript->setSuperscript(new Element\Numeric(2));
$math->add($superscript);
```

View File

@@ -0,0 +1,50 @@
## Readers
### MathML
The name of the reader is `MathML`.
``` php
<?php
use PhpOffice\Math\Reader\MathML;
$reader = new MathML();
$math = $reader->read(
'<?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">
<mi> a </mi>
</math>'
);
```
### OfficeMathML
The name of the reader is `OfficeMathML`.
``` php
<?php
use PhpOffice\Math\Reader\OfficeMathML;
$reader = new OfficeMathML();
$math = $reader->read(
'<m:oMathPara xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math">
<m:oMath>
<m:f>
<m:num><m:r><m:t>π</m:t></m:r></m:num>
<m:den><m:r><m:t>2</m:t></m:r></m:den>
</m:f>
</m:oMath>
</m:oMathPara>'
);
```
## Methods
### read
The method has one parameter :
* `string` **$content**
The method returns a `PhpOffice\Math\Math` object.

View File

@@ -0,0 +1,46 @@
## Writers
### MathML
The name of the writer is `MathML`.
``` php
<?php
use PhpOffice\Math\Element;
use PhpOffice\Math\Math;
use PhpOffice\Math\Writer\MathML;
$math = new Math();
$math->add(new Element\Operator('+'));
$writer = new MathML();
$output = $writer->write($math);
```
### OfficeMathML
The name of the writer is `OfficeMathML`.
``` php
<?php
use PhpOffice\Math\Element;
use PhpOffice\Math\Math;
use PhpOffice\Math\Writer\OfficeMathML;
$math = new Math();
$math->add(new Element\Operator('+'));
$writer = new OfficeMathML();
$output = $writer->write($math);
```
## Methods
### writer
The method has one parameter :
* `PhpOffice\Math\Math` **$math**
The method returns a `string`.