Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
215 commits
Select commit Hold shift + click to select a range
3d36d2f
Make texvcjs compatible to texvc
physikerwelt Oct 13, 2014
1412221
Ignore .idea files
physikerwelt Nov 19, 2014
6fa9a41
Fix typo in readme
physikerwelt Nov 19, 2014
101925e
Fix broken tests
physikerwelt Nov 20, 2014
535a9b6
Fixup: Remove bad chars from previous commit
physikerwelt Nov 21, 2014
97ca6f4
Merge pull request #1 from physikerwelt/master
physikerwelt Nov 21, 2014
4c80fdd
Merge branch 'master' of https://github.com/cscott/texvcjs into cscot…
physikerwelt Aug 4, 2015
0c81769
Add test cases for mathjax commands
physikerwelt Aug 4, 2015
a773aae
Merge pull request #6 from wikimedia/mathjaxtests
Aug 4, 2015
aa509f0
Use mathrm instead of mbox for text literals
physikerwelt Aug 9, 2015
11bc16d
Use different rending for MathJax output
physikerwelt Oct 17, 2015
ec74549
Update travis cofiguration
physikerwelt Oct 17, 2015
e6ec5e3
Update dependencies
physikerwelt Oct 17, 2015
140dbe1
Rename option mathjax to usemathrm
physikerwelt Oct 20, 2015
3ded7d7
Get rid of the additional space after usemathrm
physikerwelt Oct 23, 2015
e333ceb
Merge pull request #7 from wikimedia/mathrm
Oct 23, 2015
93cae49
Update to pegjs 0.9
physikerwelt Oct 18, 2015
184d119
Merge pull request #8 from wikimedia/pegjs0.9
Oct 26, 2015
a282bfb
Simplify debugging
physikerwelt Nov 5, 2015
1322e14
Merge pull request #9 from physikerwelt/master
Nov 5, 2015
fcd8e6e
Add support for mhchem package
physikerwelt Jan 25, 2016
1efecae
Remove support for cf
physikerwelt Jan 29, 2016
acc302d
Merge pull request #10 from physikerwelt/mhchem
Feb 2, 2016
fd0fd25
Update dev dependencies
physikerwelt Mar 24, 2016
c731229
Fix upstream typo: \hAar -> \hArr
cscott Aug 4, 2015
db27785
Merge pull request #12 from wikimedia/dev-dependencies
Apr 12, 2016
54e9412
Merge pull request #13 from physikerwelt/harr
Apr 26, 2016
6c5a7ab
Add missing contour/surface/volume integrals
poortho Apr 27, 2016
3e9bf45
move test cases
poortho Apr 27, 2016
76dd3e9
Allow curly brakets in box mode
physikerwelt Jun 2, 2016
d5de885
Merge pull request #16 from physikerwelt/curly
Jun 2, 2016
8cf3722
Add mathoid package
poortho Jun 14, 2016
fed3af8
Merge branch 'integrals' of https://github.com/ClaudeZou/texvcjs into…
physikerwelt Jun 15, 2016
a8d8818
Merge branch 'master' of github.com:wikimedia/texvcjs
physikerwelt Jun 15, 2016
9619845
Updating link to phabricator diffusion (#17)
paladox Jun 30, 2016
3c4ce1c
Test against latest node 4 and 5 and 6. (#18)
paladox Jun 30, 2016
28b4151
Reduce function complexity in index.js (#19)
notjagan Aug 18, 2016
c731f6d
Fix problems with limits after mathop (#20)
physikerwelt Oct 10, 2016
7c8137f
Update dev-decencies, i.e., pegjs (#21)
physikerwelt Oct 13, 2016
ddfacd7
Use node to manage the texvcjs versions for mathoid
physikerwelt May 17, 2016
ecaca81
First extension to treat \ce tags differently
Jun 4, 2017
0527993
Just rewriting contains of \ce-tags in output without parsing
Jun 4, 2017
c31f993
Extended grammar by adding rules defined in [grammar file](https://ra…
Jun 6, 2017
b0ee327
Started adding tests
Jun 13, 2017
0f49a97
Most rules of grammar implemented. Switch to text or math mode is sti…
Jun 18, 2017
60f5c26
Added some more test cases
Jun 20, 2017
ed27c44
some improvements
Jun 27, 2017
65c8939
Completed implementing mhchem rules
Jun 30, 2017
4133510
Added code coverage testing
Jul 16, 2017
35f2b0e
updated readme.MD
manfredschaefer Jul 16, 2017
6ad520d
skip regression tests
Jul 16, 2017
cff651b
Added node versions 7 and 8 for testing
Jul 16, 2017
658073b
Code clean up, improved test coverage
Jul 19, 2017
c9d5522
Revert "updated readme.MD"
Jul 21, 2017
e292b53
started adding documentation for mhchem extension.
Aug 29, 2017
8574c86
Simplify structure of the test cases
physikerwelt Sep 6, 2017
0620ba0
Add integral symbol with short horizontal bar in the middle (⨍,⨎)
physikerwelt Sep 6, 2017
fbfd366
Fix: astutil needs to use relative paths to include renderer
physikerwelt Sep 6, 2017
8f5c811
Fix: astutils CHEM_WORD check
physikerwelt Sep 6, 2017
0edd8d6
Fix: astutil special case 4
physikerwelt Sep 6, 2017
c597d66
Simplify output mode
physikerwelt Sep 6, 2017
bcae989
Improve test coverage
physikerwelt Sep 6, 2017
9333e5a
Add test for debug mode
physikerwelt Sep 6, 2017
a3d6423
Add API test to check parsed input
physikerwelt Sep 6, 2017
5ea696e
Release version 1.0.0 alpha 1 for testing
physikerwelt Sep 6, 2017
8217c42
Correct version number
physikerwelt Nov 1, 2017
54f5a0d
Update dependencies
physikerwelt Dec 11, 2017
b082590
Allow LaTeX one char command in ce tags
physikerwelt Dec 22, 2017
9a11441
bump version to 0.3.4
physikerwelt Dec 22, 2017
b3a069b
Rename tu.other_literals{1,2,3}
chiawendt Dec 23, 2017
4c2baf7
Fallback to old chem checking if new method fails
physikerwelt Jan 2, 2018
e86c8d9
bump version to 0.3.5
physikerwelt Jan 2, 2018
313a4db
Do not skip chem regression tests
Jan 3, 2018
4eba919
Expose parsed input
physikerwelt Jan 3, 2018
2a9bd59
Merge pull request #29 from golopot/rename-cryptic-variables
physikerwelt Jan 14, 2018
5b2ce83
Add support for italic capital Greek letters
mormegil-cz Mar 13, 2019
cc7fb48
Add newly supported macros to the unit test
mormegil-cz Mar 14, 2019
fc8ff74
Bump version to 0.3.7
mormegil-cz Sep 23, 2019
e1eca77
Update dependencies
physikerwelt Feb 23, 2020
1cb1162
Remove node 6 from travis tests
physikerwelt Feb 23, 2020
11546dc
Update main file to node 8+
physikerwelt Feb 23, 2020
4fa7d1a
Remove travis tests for node version 8
physikerwelt Feb 24, 2020
7f8db2e
Remove redundant no-sudo instruction
physikerwelt Feb 24, 2020
7e5df40
Implement deprecation warnings
physikerwelt Feb 9, 2020
9349dd9
Replace istanbul with nyc
physikerwelt Mar 21, 2020
dbf6911
Replace jshint with eslint
physikerwelt Mar 21, 2020
421f7dd
Merge branch 'master' into T246011
physikerwelt Mar 24, 2020
d6f4024
Merge pull request #39 from physikerwelt/T246011
physikerwelt Mar 24, 2020
68f1ae3
Remove extra curlies from xrightarrow
physikerwelt Mar 21, 2020
28932ab
Remove outdated badges
physikerwelt Sep 17, 2020
37149eb
Update node dependencies
physikerwelt Sep 17, 2020
5731611
Correct spacing for \mathbin and \mathrel
physikerwelt Sep 17, 2020
c6d9b06
build: Updating eslint-config-wikimedia to 0.18.0
Jan 27, 2021
007e637
build: Updating eslint-config-wikimedia to 0.18.1
Jan 30, 2021
b33cd1f
build: Updating eslint-config-wikimedia to 0.18.2
Mar 8, 2021
9db8edb
build: Updating eslint-config-wikimedia to 0.19.0
Mar 15, 2021
e562251
build: Updating eslint-config-wikimedia to 0.20.0
Apr 14, 2021
ea937bf
build: Updating lodash to 4.17.21
May 15, 2021
6ac45fd
build: Updating browserslist to 4.16.6
May 25, 2021
7681200
build: Updating glob-parent to 5.1.2
Jul 23, 2021
393c68f
build: Updating path-parse to 1.0.7
Aug 11, 2021
1ee1017
build: Updating ansi-regex to 5.0.1
Oct 9, 2021
3255e80
build: Updating jsprim to 1.4.2
Nov 30, 2021
867ad0b
Fix rendering of \omicron and \Omicron
physikerwelt Jan 4, 2022
001b8ed
build: Updating eslint-config-wikimedia to 0.21.0
Feb 5, 2022
89974d5
build: Updating npm dependencies
Apr 15, 2022
8de69e0
Move LaTeX function information to JSON file
physikerwelt Apr 21, 2022
d4ea006
Add test for texvc deprecation warnings
physikerwelt Apr 8, 2022
80b18ad
Migrate from peg.js to peggy
physikerwelt Apr 12, 2022
bc6e13c
Merge "Move LaTeX function information to JSON file"
May 16, 2022
ebe6195
Merge "Migrate from peg.js to peggy"
May 19, 2022
54b8460
Add support for phantom commands.
May 10, 2022
a2a28d4
Add test sanity test texutil.json
physikerwelt May 20, 2022
7ef49cd
Fix texvcjs cli
physikerwelt May 30, 2022
9048b9c
Update peggy, and explicit error reading
physikerwelt May 20, 2022
d0b50fe
Merge texvcinfo to texvcjs
Hyper-Node Jun 30, 2022
d114a95
Run eslint on bin/texvcjs
physikerwelt Jul 1, 2022
0d27130
Sort Tex constructus
physikerwelt Jul 3, 2022
55a6d97
Add new array type
physikerwelt Jul 3, 2022
9bd250c
Implement array syntax object
physikerwelt Jul 3, 2022
0ef9b37
Enforce Custom array element in grammar assertions
physikerwelt Jul 3, 2022
10947d4
Enforce new array format
physikerwelt Jul 3, 2022
ad5b09f
Convert console.assert to assert.ok
physikerwelt Jul 3, 2022
c47c935
Implement array extractors
physikerwelt Jul 13, 2022
9b3bbae
Replace LLIST with ast.Tex.ARRAY
physikerwelt Jul 12, 2022
b315df9
Remove RenderT
physikerwelt Jul 14, 2022
021e8b2
Implement class template
physikerwelt Jul 21, 2022
2bdc07e
Implement literal class
physikerwelt Jul 21, 2022
090fe99
Implement dq class
physikerwelt Jul 22, 2022
9298ba7
Eliminate superfluous argument in declh
physikerwelt Jul 22, 2022
f5cf219
Ignore coverage report for fallback handlers
physikerwelt Jul 24, 2022
1433902
Improve test coverage for identifiers
physikerwelt Jul 24, 2022
7c8bd8c
Implement array node
physikerwelt Jul 22, 2022
60ccabc
Merge "Eliminate superfluous argument in declh"
Jul 25, 2022
8de42e5
Merge "Ignore coverage report for fallback handlers"
Jul 25, 2022
709c120
Remove unused statement in subscript handling
physikerwelt Jul 24, 2022
e76d145
Merge "Improve test coverage for identifiers"
Jul 25, 2022
1ebc0a9
Implement matrix node
physikerwelt Jul 22, 2022
2c99dd6
Fix coverage test
physikerwelt Jul 24, 2022
afb0b29
Eliminate no-base variants
physikerwelt Jul 25, 2022
6e3ee66
Implement uq node
physikerwelt Jul 22, 2022
1f8513e
Implement curly
physikerwelt Jul 22, 2022
8f6af74
Implement dollar
physikerwelt Jul 24, 2022
b6db909
Merge "Fix coverage test"
Jul 25, 2022
14e43f5
Implement fq node
physikerwelt Jul 22, 2022
7b053e8
Merge "Eliminate no-base variants"
Jul 25, 2022
99fc520
Merge "Implement curly"
Jul 25, 2022
24f2951
Merge "Implement uq node"
Jul 25, 2022
f6905fc
Merge "Implement dollar"
Jul 25, 2022
15a7b21
Merge "Remove unused statement in subscript handling"
Jul 25, 2022
2dbf434
Merge "Implement fq node"
Jul 25, 2022
4260e9b
Set minimal test coverage to 99%
physikerwelt Jul 25, 2022
c50ff71
Implement functions with two arguments
physikerwelt Jul 25, 2022
f73b0ec
Implement boxes
physikerwelt Jul 25, 2022
0968e40
Merge "Implement boxes"
Jul 26, 2022
16a178a
Fix error in assertion
physikerwelt Jul 26, 2022
eb727ea
Implement functions with one argument
physikerwelt Jul 25, 2022
170d640
Merge "Implement functions with one argument"
Jul 26, 2022
b7e8b7a
Implement chemistry types
physikerwelt Jul 25, 2022
d75e33e
Merge "Fix error in assertion"
Jul 26, 2022
0cf35ff
Merge "Implement chemistry types"
Jul 26, 2022
465bd89
Trigger tests in subdirectories
physikerwelt Jul 26, 2022
f65299a
Unify inCurlies rendering
physikerwelt Jul 26, 2022
90b74bd
Remove comments in parser test
physikerwelt Jul 26, 2022
50031b6
Add node utility to test new classes
physikerwelt Jul 26, 2022
bd81f3e
Improve test coverage
physikerwelt Jul 28, 2022
e800f25
Implement contains_func matching
physikerwelt Jul 28, 2022
57813bd
Fix typo in subscripts
physikerwelt Jul 31, 2022
8c778c1
Remove impossible infixh declarations
physikerwelt Aug 7, 2022
6c6988c
Implement identifier extraction
physikerwelt Aug 11, 2022
402626a
Implement array identifier extraction
physikerwelt Aug 11, 2022
6f42028
Implement literal identifier extraction
physikerwelt Aug 11, 2022
332fd25
Implement fun1 identifier extraction
physikerwelt Aug 11, 2022
aabec24
Implement fun2 identifier extraction
physikerwelt Aug 11, 2022
7f982fc
Implement chemistry identifier extraction
physikerwelt Aug 12, 2022
5d55400
Implement curly identifier extraction
physikerwelt Aug 12, 2022
9ea04a9
Implement simple identifier extraction
physikerwelt Aug 12, 2022
759a5f3
Merge "Implement curly identifier extraction"
Aug 18, 2022
58bc31f
Merge "Implement fun2 identifier extraction"
Aug 18, 2022
d16d097
Implement matrix identifier extraction
physikerwelt Aug 14, 2022
16d8803
Merge "Implement simple identifier extraction"
Aug 18, 2022
27be235
Merge "Implement matrix identifier extraction"
Aug 18, 2022
edb0157
Implement dq identifier extraction
physikerwelt Aug 14, 2022
e40a201
Implement declh subscript extraction
physikerwelt Aug 12, 2022
010a144
Merge "Implement dq identifier extraction"
Aug 18, 2022
e75b5af
Add more identifier extraction test
physikerwelt Aug 14, 2022
9accdb4
Extend identifier extraction test coverage
physikerwelt Aug 19, 2022
f52b9fe
Add missing getModIdent implementation in dq
physikerwelt Aug 19, 2022
37d8cb0
Extend test coverage with mathjax-texvcjs cases
physikerwelt Aug 20, 2022
22b936d
Switchover to new rendering
physikerwelt Aug 8, 2022
abe4c2d
Move Astutil functionality to TexNode
physikerwelt Aug 21, 2022
1fe9e41
Move literal list and letterMod list to texutil
physikerwelt Aug 22, 2022
fb56991
Release version 0.5.0
physikerwelt Aug 23, 2022
9ea4d84
Update documentation
physikerwelt Nov 27, 2022
ca9b33d
Restructure and enable en-wiki test cases
physikerwelt Nov 27, 2022
58de15a
Bump version to 0.5.1
physikerwelt Dec 7, 2022
1792ad2
Make texvcinfo compatible to node16
physikerwelt Dec 10, 2022
fd169cc
build: Updating json5 to 2.2.2
Dec 29, 2022
d455f60
Add script for batch evaluation
physikerwelt Dec 30, 2022
80f1da8
Merge "Add script for batch evaluation"
Dec 30, 2022
f1b39bd
Rename confusing field in uq
physikerwelt Jan 3, 2023
7696365
Allow \circ command in bonds
physikerwelt Feb 11, 2023
4ac4238
Split latex_function_names and braces
physikerwelt Mar 15, 2023
9439f63
Remove \strokeint command
physikerwelt Oct 7, 2023
96db066
Add \intBar command
physikerwelt Oct 8, 2023
3a9422f
Add test for UTF16 char input
physikerwelt Oct 31, 2023
38de3cf
Release mathoid-texvcjs 0.5.4
physikerwelt Oct 31, 2023
caef4b5
build: Updating @babel/traverse to 7.23.9
Feb 3, 2024
e6ce17f
build: Updating braces to 3.0.3
Jun 11, 2024
46df83b
build: Updating npm dependencies
Feb 27, 2025
4079f93
build: Updating @babel/helpers to 7.26.10
Mar 13, 2025
c328bbe
build: Updating brace-expansion to 1.1.12, 2.0.2
Jul 26, 2025
0ec3149
Update npm dependencies
physikerwelt Oct 29, 2025
6be6546
Bump version to 0.6.0
physikerwelt Nov 6, 2025
a8b44ea
build: Updating npm dependencies
Nov 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lib/parser.js
test
32 changes: 32 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
extends:
- wikimedia/server

rules:
array-bracket-spacing:
- off
camelcase:
- error
- properties: never
computed-property-spacing:
- error
- never
indent:
- error
- 4
- SwitchCase: 1
MemberExpression: off
no-multi-spaces:
- off
# defined in eslint-config-wikimedia to avoid breaking IE. Not needed here
no-restricted-syntax:
- off
no-underscore-dangle:
- off
no-unused-vars:
- error
- args: none
space-in-parens:
- error
- never
es-x/no-hashbang:
- off
56 changes: 56 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,57 @@
node_modules

### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm

*.iml

## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:

# User-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/dictionaries

# Sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
# .idea/uiDesigner.xml

# Gradle:
# .idea/gradle.xml
# .idea/libraries

# Mongo Explorer plugin:
# .idea/mongoSettings.xml

## File-based project format:
*.ipr
*.iws

## Plugin-specific files:

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties

# nyc
.nyc_output
coverage
/doc/main.aux
/doc/main.fdb_latexmk
/doc/main.fls
/doc/main.log
3 changes: 3 additions & 0 deletions .gitreview
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[gerrit]
host=gerrit.wikimedia.org
project=mediawiki/services/texvcjs
1 change: 0 additions & 1 deletion .jshintignore

This file was deleted.

36 changes: 0 additions & 36 deletions .jshintrc

This file was deleted.

6 changes: 0 additions & 6 deletions .travis.yml

This file was deleted.

13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# texvcjs x.x.x (not yet released)
# texvcjs 0.6.0 (2025-11-06)

* Update low-level grammar to Peggy version 5
* test with node version 22

# texvcjs 0.5.0 (2022-08-23)

* Remove low-level API export as the internal structure has been refactored significantly.

# texvcjs 0.4.0 (2022-07-14)

* RenderT is removed from the AST

# texvcjs 0.3.1 (2014-07-29)

Expand Down
72 changes: 49 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
# texvcjs
[![NPM][NPM1]][NPM2]

[![Build Status][1]][2] [![dependency status][3]][4] [![dev dependency status][5]][6]
[![NPM][NPM1]][NPM2]

A TeX/LaTeX validator.
A TeX/LaTeX validator.

`texvcjs` takes user input and validates it while replacing
MediaWiki-specific functions. It is a JavaScript port of [texvc],
which was originally written in [OCaml] for the [Math extension].

The `texvcjs` library was originally written to be used by the
[mw-ocg-latexer] PDF-generation backend of the mediawiki
[mw-ocg-latexer] PDF-generation backend of the MediaWiki
[Collection extension].

`texvcjs` also makes it possible to print the identified texvc tokens.
Moreover, it provides additional information on the input, such as
* listing the identifiers;
* discovering if the expression ends with a dot.

## Installation

Node version 0.8 and 0.10 are tested to work.
Node version 22 is tested to work.

Install the node package dependencies with:
```
Expand All @@ -37,6 +41,12 @@ which should emit:
+\sin(x)+{}{}\cos(x)^{2}newcommand
```

To test the info functionalities, run texvcjs with the info flag:
```
./bin/texvcjs --info -o json \\frac12 > ./vis/data.json
```


## API

Your programs can also use the JavaScript API exported by the
Expand All @@ -59,7 +69,7 @@ The `status` field is a single character:
* `-`: Some other problem occurred.

For status types `F`, `S`, and `-`, the position of the error may be found
in the `line`, `column` and `offset` fields of the result. More information
in the `line`, `column`, and `offset` fields of the result. More information
about the problem can be found in the `details` field of the result, which
is a string.

Expand All @@ -69,33 +79,49 @@ string requires the use of the corresponding [LaTeX packages].
The `ams_required` field requires the use of the `amsmath` and `amssymb`
packages.

### Low-level API

The low level parser, abstract syntax tree (AST), and renderer are also
exported from the module. This allows you to define more interesting
queries on the input source. An example can be found in `lib/astutil.js`
which defines a visitor function to test for the presence of specific
TeX functions in the input.
## mhchem

To use the `\ce` tags from the mhchem package, the parser needs to be called
with the mhchem option. During the parsing, if a `\ce` tag is encountered,
its contents are treated according to the [mhchem grammar]. The parsing in
general and the building up of the AST is done in a similar fashion to the
math mode, but preserves the whitespaces when needed.

As the design of the parser does not allow the usage of the dollar sign in
the math mode, the tags `\begin{math}` and `\end{math}` were introduced to
provide the ability to switch to math mode within a chemical formula. The
undocumented `\color` tag of mhchem is only supported for named colors.
The full documentation of the mhchem package can be found on the
[mhchem website].

### Examples:
This example would be typeset wrongly without the extended parser, as some
charges would be typeset as bonds, and some addition signs would end up as
charges. Running:
```sh
bin/texvcjs --usemhchem '\ce{2Na + 2H2O -> 2Na+ + 2OH- + H-H}'
```
emits:
```
+{\ce {2Na + 2H2O -> 2Na+ + 2OH- + H-H}}
```
More examples can be found on the [mhchem website].

## License

Copyright (c) 2014 C. Scott Ananian
Copyright (c) 2014-2022 C. Scott Ananian, Moritz Schubotz, Johannes Stegmüller

Licensed under GPLv2.

[mw-ocg-latexer]: https://github.com/wikimedia/mediawiki-extensions-Collection-OfflineContentGenerator-latex_renderer
[texvc]: https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FMath/REL1_23/texvccheck%2FREADME
[texvc]: https://phabricator.wikimedia.org/diffusion/EMAT/browse/REL1_23/texvccheck/README
[Math extension]: https://www.mediawiki.org/wiki/Extension:Math
[Collection extension]: https://www.mediawiki.org/wiki/Extension:Collection
[OCaml]: https://ocaml.org/
[LaTeX packages]: http://www.ctan.org/

[NPM1]: https://nodei.co/npm/texvcjs.svg
[NPM2]: https://nodei.co/npm/texvcjs/
[mhchem grammar]: https://raw.githubusercontent.com/mhchem/MathJax-mhchem-validity-syntax/master/mhchem-strict-simplified.grm
[mhchem website]: https://mhchem.github.io/MathJax-mhchem/

[1]: https://travis-ci.org/cscott/texvcjs.svg
[2]: https://travis-ci.org/cscott/texvcjs
[3]: https://david-dm.org/cscott/texvcjs.svg
[4]: https://david-dm.org/cscott/texvcjs
[5]: https://david-dm.org/cscott/texvcjs/dev-status.svg
[6]: https://david-dm.org/cscott/texvcjs#info=devDependencies
[NPM1]: https://nodei.co/npm/mathoid-texvcjs.png
[NPM2]: https://nodei.co/npm/mathoid-texvcjs/
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
functions they are valid after.
* Verify UTF-8 handling
- does CLI handle utf-8 correctly?
* Add test cases from [[mw:MathTest]]
* Add test cases from [[mw:MathTest]]
30 changes: 30 additions & 0 deletions bin/batch-evaluate
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env node
'use strict';

const program = require('commander');

const json = require('../package.json');

program
.version(json.version)
.usage('[options] <input> <output>')
.description('Gets a json file with inputs in the form' +
' key=>input and writes out a json file in the form' +
' key=>output')
;
program.parse();

const texvcjs = require('../');

const formulae = require(program.args[0]);
Object.keys(formulae).forEach((k) => {
formulae[k] = texvcjs.check(formulae[k]).output;
})
const fs = require('fs');
fs.writeFileSync(
program.args[1],
JSON.stringify(formulae, null, 2));

process.exit(0);


Loading