Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.git
coverage
node_modules
.nyc_output
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ node_modules
mathoid*.iml
config.vagrant.yaml
Thumbs.db
.eslintcache
# nyc
.nyc_output
2 changes: 1 addition & 1 deletion .pipeline/helm.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
chart: https://releases.wikimedia.org/charts/mathoid-0.0.17.tgz
chart: https://releases.wikimedia.org/charts/mathoid-0.0.19.tgz
18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"docker-start": "service-runner docker-start",
"docker-test": "service-runner docker-test",
"test-build": "service-runner docker-test && service-runner build --deploy-repo --force",
"coverage": "istanbul cover _mocha -- -R spec",
"coverage": "nyc --reporter=lcov node_modules/.bin/_mocha",
"coveralls": "cat ./coverage/lcov.info | coveralls"
},
"repository": {
Expand Down Expand Up @@ -46,14 +46,14 @@
"compression": "^1.7.1",
"express": "^4.16.2",
"http-shutdown": "^1.2.0",
"js-yaml": "^3.12.1",
"js-yaml": "^3.12.2",
"mathoid-mathjax-node": "^0.7.0",
"mock-express-request": "^0.2.2",
"mock-express-response": "^0.2.2",
"preq": "^0.5.4",
"service-runner": "^2.6.9",
"speech-rule-engine": "^2.1.1",
"svgo": "^1.0.4",
"service-runner": "^2.6.17",
"speech-rule-engine": "^2.3.2",
"svgo": "^1.2.0",
"swagger-router": "^0.7.1",
"texvcinfo": "^0.5.3"
},
Expand All @@ -66,15 +66,17 @@
"commander": "^2.9.0",
"coveralls": "^3.0.2",
"dom-compare": "^0.3.1",
"eslint-config-wikimedia": "^0.10.1",
"eslint-plugin-jsdoc": "^4.1.0",
"eslint-plugin-json": "^1.2.0",
"eslint-config-wikimedia": "^0.11.0",
"eslint-plugin-jsdoc": "^4.1.1",
"eslint-plugin-json": "^1.4.0",
"eslint": "^5.15.1",
"extend": "^3.0.0",
"istanbul": "^0.4.5",
"microtime": "^3.0.0",
"mocha": "^5.2.0",
"mocha-lcov-reporter": "^1.3.0",
"mock-require": "^3.0.3",
"nyc": "^13.3.0",
"rewire": "^4.0.1",
"xmldom": "^0.1.21"
},
Expand Down
2 changes: 1 addition & 1 deletion routes/mathoid.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ router.get('/get/:outformat?/:type?/:q?', (req, res) => {
* GET /
* Performs the check get request
*/
router.get('/zlib/:outformat?/:type?/:q*', (req, res) => {
router.get('/zlib/:outformat/:type/:q*', (req, res) => {
if (!(req.params.q)) {
emitError('q (query) parameter is missing!');
}
Expand Down
143 changes: 97 additions & 46 deletions spec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
swagger: '2.0'
openapi: 3.0.1
info:
version: 0.2.8
title: Mathoid
description: Renders TeX to SVG and MathML using MathJax
termsOfService: https://wikimediafoundation.org/wiki/Terms_of_Use
Expand All @@ -10,6 +9,11 @@ info:
license:
name: Apache2
url: http://www.apache.org/licenses/LICENSE-2.0
version: 0.2.8
# TODO: uncomment once we have support for removing
# trailing slashes in service-checker
#servers:
# - url: /
paths:
# from routes/root.js
/robots.txt:
Expand All @@ -18,14 +22,20 @@ paths:
- Root
- Robots
description: Gets robots.txt
responses:
200:
description: OK
content: {}
x-monitor: false
/:
get:
tags:
- Root
description: The root service end-point
produces:
- application/json
responses:
200:
description: OK
content: {}
x-amples:
- title: spec from root
request:
Expand All @@ -37,29 +47,37 @@ paths:
tags:
- Render
description: Converts TeX to MathML, SVG, PNG and IMG
produces:
- application/json
responses:
200:
description: OK
content: {}
400:
description: invalid input
content: {}
x-amples:
# from routes/info.js
- title: mass-energy equivalence (json)
request:
body:
q: 'E=mc^2'
q: E=mc^2
response:
status: 200
body:
log: success
success: true
svg: /.+/
mml: /.+/
# from routes/info.js
/_info:
get:
tags:
- Service information
description: Gets information about the service
produces:
- application/json
responses:
200:
description: OK
content: {}
x-amples:
# from routes/mathoid.js
- title: retrieve service info
request: {}
response:
Expand All @@ -71,23 +89,42 @@ paths:
description: /.+/
version: /.+/
home: /.+/
# from routes/mathoid.js
/{format}/:
post:
tags:
- Render
description: Converts TeX to SVG, PNG or MathML depending on the parameter format. The special format 'texvcinfo' returns information about the input without to render anything.
produces:
- image/svg+xml
- application/mathml+xml
- application/json
description: Converts TeX to SVG, PNG or MathML depending on the parameter format.
The special format 'texvcinfo' returns information about the input without
to render anything.
parameters:
- name: format
in: path
description: output type
required: true
schema:
type: string
enum:
- texvcinfo
- speech
- mml
- svg
- png
- json
- complete
responses:
200:
description: OK
content: {}
400:
description: invalid input
content: {}
x-amples:
- title: mass-energy equivalence (complete)
request:
params:
format: complete
body:
q: 'E=mc^2'
q: E=mc^2
response:
status: 200
headers:
Expand All @@ -108,7 +145,7 @@ paths:
params:
format: svg
body:
q: 'E=mc^2'
q: E=mc^2
response:
status: 200
headers:
Expand All @@ -119,7 +156,7 @@ paths:
params:
format: mml
body:
q: 'E=mc^2'
q: E=mc^2
response:
status: 200
headers:
Expand All @@ -130,21 +167,24 @@ paths:
params:
format: texvcinfo
body:
q: 'E = m c^2'
q: E = m c^2
response:
status: 200
headers:
content-type: application/json
body:
success: true
checked: /E=mc/
identifiers: ["E", "m", "c"]
- title: Invaid command (texvcinfo)
identifiers:
- E
- m
- c
- title: Invalid command (texvcinfo)
request:
params:
format: texvcinfo
body:
q: 'a + \invalid = b'
q: a + \invalid = b
response:
status: 400
headers:
Expand All @@ -157,42 +197,52 @@ paths:
location:
start:
column: 5
/zlib{/outformat}{/type}/{q}:
/zlib/{outformat}/{type}/{q}:
get:
tags:
- zLib
description: Converts a formula encoded in the URI to TeX to SVG, PNG or MathML depending on the parameter format. The special format 'texvcinfo' returns information about the input without to render anything.
produces:
- image/svg+xml
- application/mathml+xml
- application/json
description: Converts a formula encoded in the URI to TeX to SVG, PNG or MathML
depending on the parameter format. The special format 'texvcinfo' returns
information about the input without to render anything.
parameters:
- name: outformat
in: path
type: string
description: output type
enum:
- texvcinfo
- speech
- mml
- svg
- png
- json
- complete
required: true
schema:
type: string
enum:
- texvcinfo
- speech
- mml
- svg
- png
- json
- complete
- name: type
in: path
type: string
description: input type
enum:
- tex
- inline-tex
- mml
- ascii
required: true
schema:
type: string
enum:
- tex
- inline-tex
- mml
- ascii
- name: q
in: path
type: string
required: true
description: compressed input to be converted
required: true
schema:
type: string
responses:
200:
description: OK
content: {}
400:
description: Bad request
content: {}
# TODO: remove and uncomment the below example
# once T215220 has been resolved
x-monitor: false
Expand All @@ -214,3 +264,4 @@ paths:
# - E
# - m
# - c
components: {}
50 changes: 50 additions & 0 deletions test/files/mathjax-texvc/mathjax-texvc.json
Original file line number Diff line number Diff line change
Expand Up @@ -468,5 +468,55 @@
"id": 93,
"input": "{\\displaystyle \\left(\\left(\\sum_A\\right)B \\right)}",
"texvcjs": "{\\displaystyle \\left(\\left(\\sum_A\\right)B \\right)}"
},
{
"id": 94,
"input": "\\varDelta",
"texvcjs": "\\varDelta "
},
{
"id": 95,
"input": "\\varGamma",
"texvcjs": "\\varGamma "
},
{
"id": 96,
"input": "\\varLambda",
"texvcjs": "\\varLambda "
},
{
"id": 97,
"input": "\\varOmega",
"texvcjs": "\\varOmega "
},
{
"id": 98,
"input": "\\varPhi",
"texvcjs": "\\varPhi "
},
{
"id": 99,
"input": "\\varPi",
"texvcjs": "\\varPi "
},
{
"id": 100,
"input": "\\varSigma",
"texvcjs": "\\varSigma "
},
{
"id": 101,
"input": "\\varTheta",
"texvcjs": "\\varTheta "
},
{
"id": 102,
"input": "\\varUpsilon",
"texvcjs": "\\varUpsilon "
},
{
"id": 103,
"input": "\\varXi",
"texvcjs": "\\varXi "
}
]
Binary file added test/files/mathjax-texvc/png/100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/files/mathjax-texvc/png/101.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/files/mathjax-texvc/png/102.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/files/mathjax-texvc/png/103.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/files/mathjax-texvc/png/94.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/files/mathjax-texvc/png/95.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/files/mathjax-texvc/png/96.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/files/mathjax-texvc/png/97.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/files/mathjax-texvc/png/98.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/files/mathjax-texvc/png/99.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading